public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roberto Nibali <ratz@drugphish.ch>
To: David Ford <david+cert@blue-labs.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: ver_linux script updates
Date: Fri, 15 Feb 2002 03:25:16 +0100	[thread overview]
Message-ID: <3C6C718C.8050402@drugphish.ch> (raw)
In-Reply-To: <3C6ADCAA.6080600@blue-labs.org> <3C6B0DF8.10209@drugphish.ch> <3C6B144C.4020904@blue-labs.org> <3C6B20FD.1070601@drugphish.ch> <3C6B6C01.8000403@blue-labs.org>

[-- Attachment #1: Type: text/plain, Size: 5434 bytes --]

Hi,

> declare removed, printf can be a sh-util file as well as a bash built in 
> so I'm not concerned with that.

Well, you added it again in version 1.4 of your script. I removed it. 
But I reckon you should write it in bash, can safe you some lines :)

> What is the full output of your loadkeys program with --junkoption?  I 
> avoided using combinations of programs and chose to concentrate on 
> implementing a one program only solution which was common through the 
> script.

Et voilà, feel free to vomit:

ratz@laphish:~ > grep declare ver_linux.*
ver_linux.txt:      declare -i count
ratz@laphish:~ > loadkeys --junkoption
loadkeys: unrecognized option `--junkoption'
loadkeys version 1.04

Usage: loadkeys [option...] [mapfile...]

valid options are:

	-c --clearcompose clear kernel compose table
	-d --default	  load "defkeymap.map"
	-h --help	  display this help text
	-m --mktable      output a "defkeymap.c" to stdout
	-s --clearstrings clear kernel string table
	-u --unicode      implicit conversion to Unicode
	-v --verbose      report the changes
ratz@laphish:~ >
> loadkeys is part of the kbd/console-tools mess.  It can report a 
> version, not report a version, use --version or -V depending on what 
> package or date in history your package comes from.

This is an information which you exactly don't have.

>> This is so gross you could as well do a strings on all those broken 
>> binaries and maintain a table of offsets where to find the version 
>> string. 
>  
> Unfortunately this would evolve into a big pile of versions and offsets 
> that nobody would want to touch with a 10' pole.

I was more making a joke on this one ...

> One doesn't, it's a generic list that makes some assumptions.  To this 
> end, I've decided to add some /proc checking before searching for 
> certain tool versions.

Ok, hope /proc-fs doesn't change semantics.

> One of the most visible points in history is pppd, for a long while it 
> seemed like the most frequently recurring bug post was why pppd didn't 
> work. The version the bug reporter had was less than required.

I haven't seen one in a year or so but I assume you know how Linux 
kernel development history goes, so it's you call. I saw that you made 
some /proc check for ppp. This is very acceptable then.

> I've just added checking to a few of the version searches that takes 
> note from /proc files as to whether or not said support is loaded and 
> running.  In other words it doesn't make to much sense to check for pppd 
> if the user doesn't use pppd.  Note that this can certainly be 
> misconstrued and I should put a --verbose, or perhaps trying to be smart 
> here will just make matters worse.

Yes, agreed.

>> o Why is this script still in the kernel tree? It is not mentioned
>>   anywhere and it doesn't work reliably. 
>  
> It is mentioned in the top level REPORTING-BUGS file.

Oups, my bad, sorry.

>> The whole concept looks pretty broken to me, but then again I'm just a 
>> little fart that doesn't see the big picture. 
> 
> 
> It helps to clean up  some ambiguities when a bug report comes in.

Ok.

> I've updated it a few times since you've last retrieved it.

I saw. I attached a diff of your 1.4 to 1.5. Changelog:

o bumped version
o made echo ' ' -> echo. No need to pass strings
o safe/restore IFS. This is important in case you want to output lkm
   with spaces instead of newlines
o function truth() should check $1==0 and not $@ because if one calls
   truth() with more arguments, it fails.
o added yesno() function for tained mode
o added space to isdnlegitimate to read isdn legitimate
o rewrote modules output: I think it is cleaner now.
o removed remaining declare, printf is still there
o fixed ECN test already reported by another guy
o added tainted lkm checking

> Personally I dislike perl ['s bubblegum fixes everything approach], I 
> don't think it's worth it to make such a heavy requirement of a user. 
> The hang has been removed by adding the --junkoption, and as far as I 
> know none of the given version checks should hang now.

You're right so far.

> Actually, on four of my seven systems I don't have 'fdformat' so 
> 'util-linux' would have failed, but I -do- have 'mount' which is part of 
> the same package.

Then use mount which is obviously more often deployed than fdformat.

> The only problem with patching tools like this, is that it often doesn't 
> get back to the author or doesn't get implemented by the author, much 
> less it doesn't fix earlier versions of the same software.

I've a some dozens of patches lying around exactly because one of your 
above mentioned reasons. This, however, will never change. You tool 
needs to be intelligent enough to handle broken user space apps.

> Ugg, don't get me started.  "pppd --version"  means I want the version. 
> I don't give a flying fsck whether the kernel supports it or not, and I 
> don't give a flying fsck if I have a messed up options file.  I want the 
> version, nothing more, nothing less. What's worse, there isn't a textual 
> string for the version in the binary that I can grab.

You seemed to have solved it in a way. One little invariant to fix 
remains though. Think what happens with your script, when one doesn't 
have proc-fs support ;)

Best regards,
Roberto Nibali, ratz

[-- Attachment #2: ver_linux-1.5.diff --]
[-- Type: text/plain, Size: 3231 bytes --]

--- ver_linux.txt	Fri Feb 15 02:33:08 2002
+++ ver_linux.new	Fri Feb 15 03:20:54 2002
@@ -6,7 +6,7 @@
 #
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
 cat <<EOF
-Version: 1.4 (14 Feb 2002)
+Version: 1.5 (15 Feb 2002)
 If version fields appear unusual you may have an old version. Compare to the
 current minimal requirements in linux/Documentation/Changes. Please double
 check lines that say "error getting version, try manually" for validity.
@@ -19,9 +19,10 @@
 (grep ^Kernel /var/log/*dmesg* || (echo -n "Kernel command line: " ;\
       cat /proc/cmdline)) 2>/dev/null
 
-echo ' '
+echo
 
 function pv {
+      oldIFS=$IFS
       IFS=''
       title="$1"
       ver="$2"
@@ -30,27 +31,38 @@
       if [ "x$ver" == "x" -a "x$ev" != "x" ]; then
             eexists="$($ev --junkoption >/dev/null 2>&1 || echo $?)"
             if [ $eexists -eq 127 ]; then
+                  IFS=$oldIFS
                   return
             else
                   ver="error getting version, try manually"
             fi
       else
             if [ "x$ver" == "x" ]; then
+                  IFS=$oldIFS
                   return
             fi
       fi
 
       printf "%-34s%s\n" $title $ver
+      IFS=$oldIFS
 }
 
 function truth {
-      if [ "$@" == "0" ]; then
+      if [ "$1" == "0" ]; then
             echo "disabled";
       else
             echo "enabled"
       fi
 }
 
+function yesno {
+      if [ "$1" == "0" ]; then
+            echo "no";
+      else
+            echo "yes"
+      fi
+}
+
 pv "Gnu C compiler" "$(gcc --version 2>/dev/null)" gcc
 pv "Kgcc compiler" "$(kgcc --version 2>/dev/null)" kgcc
 
@@ -79,7 +91,7 @@
       awk '/^tune2fs/ {print $2}'|sed 's/,//')" tune2fs
 
 if [ $(grep -c reiserfs /proc/filesystems 2>/dev/null) -ne 0 ]; then
-pv "reiserfsprogs" \
+      pv "reiserfsprogs" \
       "$(reiserfsck 2>&1 |
       awk '/^reiserfsprogs/ {print $NF}')" reiserfsck
 fi
@@ -91,12 +103,12 @@
 fi
 
 if [ $(grep -c ppp /proc/devices 2>/dev/null) -ne 0 ]; then
-pv "pppd" \
+      pv "pppd" \
       "$(pppd --version 2>&1 |
       awk '/^pppd version/ {print $3}')" pppd
 fi
 
-echo "help me please, is this check for isdnlegitimate?"
+echo "help me please, is this check for isdn legitimate?"
 if [ $(grep -c isdn /proc/devices 2>/dev/null) -ne 0 ]; then
 pv "isdn4k-utils" \
       "$(isdnctrl 2>&1 |
@@ -144,17 +156,22 @@
       awk '/sh-utils/ {print $4}')"
 
 if [ -e /proc/modules ]; then
-      declare -i count
-      count=$(grep -c "^" /proc/modules)
-      if [ $count -gt 0 ]; then
-				modules="$(sed -e 's/ .*$//;s/\(.*\)/[\1]/' /proc/modules)"
-            pv "loaded modules" "$modules"
-      fi
+      while read a rest; do
+            modules="$modules [$a]"
+      done < /proc/modules
+      pv "loaded modules" "$(echo $modules)"
 fi
 
 echo
 # kernel tuning options
-if [ -e /proc/sys/net/ipv4/tcp_ecn ]; then
-	v=$(cat /proc/sys/net/ipv4/tcp_ecn)
-	pv "TCP option: ECN" "$(truth v)"
+TCP_ECN="/proc/sys/net/ipv4/tcp_ecn"
+if [ -e ${TCP_ECN} ]; then
+	v=$(< ${TCP_ECN})
+	pv "TCP option: ECN" "$(truth $v)"
+fi
+# kernel module taint information
+LKM_TAINT="/proc/sys/kernel/tainted"
+if [ -e ${LKM_TAINT} ]; then
+	v=$(< ${LKM_TAINT})
+	pv "modules tainted:" "$(yesno $v)"
 fi

  reply	other threads:[~2002-02-15  2:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-13 21:37 ver_linux script updates David Ford
2002-02-14  1:08 ` Roberto Nibali
2002-02-14  1:35   ` David Ford
2002-02-14  2:29     ` Roberto Nibali
2002-02-14  7:49       ` David Ford
2002-02-15  2:25         ` Roberto Nibali [this message]
2002-02-15  7:46           ` David Ford
2002-02-14 12:34 ` Stefan Becker
2002-02-14 18:08   ` David Ford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C6C718C.8050402@drugphish.ch \
    --to=ratz@drugphish.ch \
    --cc=david+cert@blue-labs.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox