bug in some /proc/sys/kernel/* files (1.3.99)

Andreas Koppenhoefer (koppenas@koppenas.dialup.informatik.uni-stuttgart.de)
11 May 1996 17:28:53 +0200


-----BEGIN PGP SIGNED MESSAGE-----

Dear kernel programmer,

while writing some shell script (bash) I dicovered a bug in some of
/proc/sys/kernel/* files. Some of these files have a null character
followed by a newline in them like "...\0\n". I think this should be
reversed as in "...\n\0" or leave out null character completely
"...\n".

Difficults arise when you try to read a value with a bash command...

read RELEASE </proc/sys/kernel/osrelease

but bash (version 1.14.4) assigns an empty value to RELEASE.
You may try this yourself...

for i in /proc/sys/kernel/*; do echo $i:; od -c $i; done

in bash. Here is what I'll get (stripped down, edited and commented).

/proc/sys/kernel/domainname:
( n o n e ) \0 \n
^^^^
/proc/sys/kernel/hostname:
k o p p e n a s \0 \n
^^^^
/proc/sys/kernel/osrelease:
1 . 3 . 9 9 \0 \n
^^^^
/proc/sys/kernel/ostype:
L i n u x \0 \n
^^^^
/proc/sys/kernel/version:
# 1 3 T h u M a y 9 0 8
: 4 3 : 0 5 M E T D S T 1
9 9 6 \0 \n
^^^^
IMHO this is not a feature - it a bug!

- - - Andreas
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2i
Comment: Processed by Mailcrypt 3.3, an Emacs/PGP interface

iQBVAwUBMZSyE0VdjNvyndGpAQEISAH+Oi8uuTiSAjTKZULvqC0iy7ArdTrY2jPS
KlT6SuHh3DTn8GAn7H8Fi7S9T71Ry9DsAjLaG7XS2fqrjthebQuqBA==
=LU4Q
-----END PGP SIGNATURE-----

-- 
Andreas Koppenhoefer, Student der Universitaet Stuttgart, BR Deutschland 
<koppenas@informatik.uni-stuttgart.de>, <akoppenhoefer@schweinfurt.netsurf.de>
Franz-Schubert-Str. 2, 97616 Bad Neustadt, Germany, +49 9771 7943 (9-21h MEZ)