Bug 57736 - bool data should be 0 or 1
bool data should be 0 or 1
Status: CLOSED WONTFIX
Product: eCos
Classification: Retired
Component: CDL (Show other bugs)
1.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bart Veer
eCos bugs internal list
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-12-20 10:30 EST by George Thomas
Modified: 2007-04-18 12:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-06-20 12:09:20 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description George Thomas 2001-12-20 10:30:27 EST
Description of Problem:

CDL objects with flavor 'bool' should be forced to evaluate to either
0 or 1 and a warning provided if they do not.  

This has been the source of many a bug...

Version-Release number of selected component (if applicable):


How Reproducible:


Steps to Reproduce:
1. 
2. 
3. 

Actual Results:


Expected Results:


Additional Information:
Comment 1 Bart Veer 2002-01-02 10:43:48 EST
Fixing this should be relatively simple. It would require a patch
along the following lines:

Index: cdllint
===================================================================
RCS file:
/home/cvs/ecc/host/tools/cdllint/cdllint,v
retrieving revision 1.207
diff -u -u -r1.207 cdllint

+ proc cdllint_test286_boolflavor_plus_nonbool_value { valuable } {
+
+    if { "bool" == [cdl_info $valuable flavor] } {
+        set expr ""
+        if { [cdl_info $valuable has_property "default_value"] } {
+            set expr [cdl_info $valuable get_property "default_value"]
+        } elseif { [cdl_info $valuable has_property "calculated"] } {
+            set expr [cdl_info $valuable get_property "calculated"]
+        }
+        if { "" != $expr } {
+            set result [cdl_eval $expr]
+            if { (0 != $result) && (1 != $result) } {
+                  cdllint_report_failure "Valuable [cdl_info $valuable get_name] \
+                                        is boolean but the default_value or
calculated \
+                                        expression evaluates to something other
than 0 or 1.
+            }
+        }
+    }
+ }
+
+ cdllint_apply_valuables cdllint_test286_boolflavor_plus_nonbool_value


Obviously the same thing could be done at the libcdl C++ level, but it
would require somewhat more code and certainly more development
effort. A script-based solution is much easier to extend over time.

There are only two minor problems with the above patch:

1) there is no functional Tcl interface to the libcdl data yet. As far
   as I am concerned this is the single largest hole in the current
   eCos host-side tools, and quite possible in all of eCos.

2) and hence there is no cdllint script yet. Once script access to the
   CDL data is available it should be possible to write a cdllint
   framework in just a few days, providing utility functions such as
   apply_values and report_failure, and then additional tests can be
   added as and when problems are reported. However progress is
   blocked until resources are allocated to work on the scripting.
Comment 2 Alex Schuilenburg 2003-06-20 12:09:20 EDT
This bug has moved to http://bugs.ecos.sourceware.org/show_bug.cgi?id=57736

Note You need to log in before you can comment on or make changes to this bug.