A small bug with CONFIG_EXPERIMENTAL

Michael Elizabeth Chastain (mec@shout.net)
Tue, 19 Oct 1999 04:42:27 -0500


Hi *,

Tonight I noticed a small bug in some of the Config.in files relating
to CONFIG_EXPERIMENTAL. Here is a sample of the bug:

# fs/Config.in, line 62
if [ "$CONFIG_SYSV_FS" != "n" -a "$CONFIG_EXPERIMENTAL" ]; then
bool ' SYSV filesystem write support (DANGEROUS)' CONFIG_SYSV_FS_WRITE
fi

This code works as intended when CONFIG_EXPERIMENTAL=y. But when
CONFIG_EXPERIMENTAL=n, this is also a non-null value!

config, oldconfig, and menuconfig all treat this non-null value as true,
so they enable the subsequent line. xconfig behaves as the Config.in
author expected.

Here is a patch which fixes all the occurrences I found. I also added
a paragraph to the config language spec to cover this. Also, mconfig
0.17 already gives a warning for this construct ("naked word in conditional
expression").

I would be grateful if someone could check my reasoning and my patch
before I send this to Linus.

Michael Elizabeth Chastain
<mailto:mec@shout.net>
"love without fear"

===

diff -u -r -N linux-2.3.22/Documentation/kbuild/config-language.txt linux/Documentation/kbuild/config-language.txt
--- linux-2.3.22/Documentation/kbuild/config-language.txt Thu Oct 7 10:17:08 1999
+++ linux/Documentation/kbuild/config-language.txt Tue Oct 19 02:34:23 1999
@@ -1,5 +1,5 @@
Config Language Specification
-28 September 1999
+18 October 1999
Michael Elizabeth Chastain, <mailto:mec@shout.net>


@@ -568,15 +568,31 @@
/expr/ may contain the following atoms and operators. Note that, unlike
shell, you must use double quotes around every atom.

- "..." a literal
- "$..." a variable
-
- /atom/ = /atom/ true if atoms have identical value
- /atom/ != /atom/ true if atoms have different value
+ /atom/:
+ "..." a literal
+ "$..." a variable
+
+ /expr/:
+ /atom/ = /atom/ true if atoms have identical value
+ /atom/ != /atom/ true if atoms have different value
+
+ /expr/:
+ /expr/ -o /expr/ true if either expression is true
+ /expr/ -a /expr/ true if both expressions are true
+ ! /expr/ true if expression is not true
+
+Note that a naked /atom/ is not a valid /expr/. If you try to use it
+as such:
+
+ # Do not do this.
+ if [ "$CONFIG_EXPERIMENTAL" ]; then
+ bool 'Bogus experimental feature' CONFIG_BOGUS
+ fi

- /expr/ -o /expr/ true if either expression is true
- /expr/ -a /expr/ true if both expressions are true
- ! /expr/ true if expression is not true
+... then you will be surprised, because CONFIG_EXPERIMENTAL never has a
+value of the empty string! It is always "y" or "n", and both of these
+are treated as true (non-empty) by the bash-based interpreters Configure
+and Menuconfig.

Configure: implemented
Menuconfig: implemented
diff -u -r -N linux-2.3.22/arch/arm/config.in linux/arch/arm/config.in
--- linux-2.3.22/arch/arm/config.in Thu Oct 7 10:17:08 1999
+++ linux/arch/arm/config.in Tue Oct 19 02:28:05 1999
@@ -110,7 +110,7 @@

endmenu

-if [ "$CONFIG_CPU_32" = "y" -a "$CONFIG_ARCH_EBSA110" != "y" -a "$CONFIG_EXPERIMENTAL" ]; then
+if [ "$CONFIG_CPU_32" = "y" -a "$CONFIG_ARCH_EBSA110" != "y" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then
bool 'Enable kernel-mode alignment trap handler (EXPERIMENTAL)' CONFIG_ALIGNMENT_TRAP
fi
#bool 'Split text into discardable sections' CONFIG_TEXT_SECTIONS
diff -u -r -N linux-2.3.22/fs/Config.in linux/fs/Config.in
--- linux-2.3.22/fs/Config.in Fri Oct 15 11:49:37 1999
+++ linux/fs/Config.in Tue Oct 19 02:25:01 1999
@@ -59,11 +59,11 @@
tristate 'ROM filesystem support' CONFIG_ROMFS_FS
tristate 'Second extended fs support' CONFIG_EXT2_FS
tristate 'System V and Coherent filesystem support' CONFIG_SYSV_FS
-if [ "$CONFIG_SYSV_FS" != "n" -a "$CONFIG_EXPERIMENTAL" ]; then
+if [ "$CONFIG_SYSV_FS" != "n" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then
bool ' SYSV filesystem write support (DANGEROUS)' CONFIG_SYSV_FS_WRITE
fi
tristate 'UFS filesystem support (read only)' CONFIG_UFS_FS
-if [ "$CONFIG_UFS_FS" != "n" -a "$CONFIG_EXPERIMENTAL" ]; then
+if [ "$CONFIG_UFS_FS" != "n" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then
bool ' UFS filesystem write support (DANGEROUS)' CONFIG_UFS_FS_WRITE
fi

@@ -79,7 +79,7 @@
if [ "$CONFIG_NFS_FS" = "y" -a "$CONFIG_IP_PNP" = "y" ]; then
bool ' Root file system on NFS' CONFIG_ROOT_NFS
fi
- if [ "$CONFIG_EXPERIMENTAL" ]; then
+ if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
tristate 'NFS server support (EXPERIMENTAL)' CONFIG_NFSD
if [ "$CONFIG_NFSD" != "n" ]; then
bool ' Emulate SUN NFS server' CONFIG_NFSD_SUN
diff -u -r -N linux-2.3.22/net/decnet/Config.in linux/net/decnet/Config.in
--- linux-2.3.22/net/decnet/Config.in Thu Oct 14 14:22:09 1999
+++ linux/net/decnet/Config.in Tue Oct 19 02:24:13 1999
@@ -2,7 +2,7 @@
# DECnet configuration
#
bool ' DECnet: SIOCGIFCONF support' CONFIG_DECNET_SIOCGIFCONF
-if [ "$CONFIG_EXPERIMENTAL" ]; then
+if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
bool ' DECnet: router support (EXPERIMENTAL)' CONFIG_DECNET_ROUTER
fi
bool ' DECnet: raw socket support' CONFIG_DECNET_RAW

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/