Bug 57736 - bool data should be 0 or 1
Summary: bool data should be 0 or 1
Alias: None
Product: eCos
Classification: Retired
Component: CDL   
(Show other bugs)
Version: 1.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bart Veer
QA Contact: eCos bugs internal list
Keywords: FutureFeature
Depends On:
TreeView+ depends on / blocked
Reported: 2001-12-20 15:30 UTC by George Thomas
Modified: 2007-04-18 16:38 UTC (History)
0 users

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

Attachments (Terms of Use)

Description George Thomas 2001-12-20 15:30:27 UTC
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:

Actual Results:

Expected Results:

Additional Information:

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

Index: cdllint
RCS file:
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 16:09:20 UTC
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.