Skip to contentSkip to conversation

ver_linux is [censored]

PATCH Applied Alexey Dobriyan 5 participants 8 messages Aug 21, 2007 – Aug 28, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ver_linux is [censored]

Commit 4a645d5ea65baaa5736bcb566673bf4a351b2ad8 broke ver_linux on etch which glibc has 3-digit version number. Patch replaces awk wanking with more robust sed wanking.

Tested on gentoo, etch, centos 4.2.

---

 scripts/ver_linux |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/ver_linux +3 -3
@@ -65,9 +65,9 @@ isdnctrl 2>&1 | grep version | awk \
 showmount --version 2>&1 | grep nfs-utils | awk \
 'NR==1{print "nfs-utils             ", $NF}'
 
-ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed \
--e 's/\.so$//' | sed -e 's/>//' | \
-awk -F'[.-]' '{print "Linux C Library        "$(NF-1)"."$NF}'
+echo -n "Linux C Library        "
+ls -l `ldd /bin/sh | awk '/libc/{print $3}'` 	| \
+	sed -e 's/.*libc-//' -e 's/\.so$//'
 
 ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \
 'NR==1{print "Dynamic linker (ldd)  ", $NF}'
Tested-by on v1 1/1
#1 lore raw
Quoted 2 lines · Alexey Dobriyan

Commit 4a645d5ea65baaa5736bcb566673bf4a351b2ad8 broke ver_linux on etch which glibc has 3-digit version number.

Whoops, sorry about that.

Quoted 5 lines

Patch replaces awk
wanking with more robust sed wanking.

Tested on gentoo, etch, centos 4.2.

I tested your patch on Slackware 12.0, Debian 3.1 & Gentoo Base System release 1.12.9 and it works fine on those as well.

Quoted 1 line
Quoted 4 lines

---

 scripts/ver_linux |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
#2 lore raw
Quoted 6 lines · Jesper Juhl
Quoted 2 lines · Alexey Dobriyan

Commit 4a645d5ea65baaa5736bcb566673bf4a351b2ad8 broke ver_linux on etch which glibc has 3-digit version number.

Whoops, sorry about that.

Quoted 7 lines
Quoted 5 lines

Patch replaces awk
wanking with more robust sed wanking.

Tested on gentoo, etch, centos 4.2.

I tested your patch on Slackware 12.0, Debian 3.1 & Gentoo Base System release 1.12.9 and it works fine on those as well.

How about simply doing
sh -c 'cat /proc/$$/maps'|sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' and to hell with parsing ls -l output?

#3 lore raw
Quoted 10 lines · Al Viro
Quoted 9 lines · Jesper Juhl
Quoted 2 lines · Alexey Dobriyan

Commit 4a645d5ea65baaa5736bcb566673bf4a351b2ad8 broke ver_linux on etch which glibc has 3-digit version number.

Whoops, sorry about that.

Quoted 3 lines

Patch replaces awk
wanking with more robust sed wanking.

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

Tested on gentoo, etch, centos 4.2.

I tested your patch on Slackware 12.0, Debian 3.1 & Gentoo Base System release 1.12.9 and it works fine on those as well.

How about simply doing
sh -c 'cat /proc/$$/maps'|sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' and to hell with parsing ls -l output?

Works for me.

Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
#4 lore raw
Quoted 5 lines · Jesper Juhl
Quoted 4 lines

How about simply doing
sh -c 'cat /proc/$$/maps'|sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' and to hell with parsing ls -l output?

Works for me.

or, simpler yet,

sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' </proc/self/maps

#5 lore raw

Fix ver_linux glibc version printing (for real this time)

Alexey Dobriyan reported that commit 4a645d5ea65baaa5736bcb566673bf4a351b2ad8 broke ver_linux when glibc has a 3 digit version number, and proposed a patch.
Al Viro then suggested a simpler way to solve the problem which I've then simply put into patch form.

---

 scripts/ver_linux |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
scripts/ver_linux +2 -3
index 8f8df93..5a16bad 100755
@@ -65,9 +65,8 @@ isdnctrl 2>&1 | grep version | awk \
 showmount --version 2>&1 | grep nfs-utils | awk \
 'NR==1{print "nfs-utils             ", $NF}'
 
-ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed \
--e 's/\.so$//' | sed -e 's/>//' | \
-awk -F'[.-]' '{print "Linux C Library        "$(NF-1)"."$NF}'
+echo -n "Linux C Library        "
+sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' < /proc/self/maps
 
 ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \
 'NR==1{print "Dynamic linker (ldd)  ", $NF}'
Applied
#6 lore raw
Quoted 26 lines · Jesper Juhl

Fix ver_linux glibc version printing (for real this time)

Alexey Dobriyan reported that commit 4a645d5ea65baaa5736bcb566673bf4a351b2ad8 broke ver_linux when glibc has a 3 digit version number, and proposed a patch.
Al Viro then suggested a simpler way to solve the problem which I've then simply put into patch form.

---

 scripts/ver_linux |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
scripts/ver_linux +0 -0
index 8f8df93..5a16bad 100755
@@ -65,9 +65,8 @@ isdnctrl 2>&1 | grep version | awk \
 showmount --version 2>&1 | grep nfs-utils | awk \

scripts/ver_linux isdnctrl 2>&1 | grep version | awk \ · line 72

Quoted 10 lines
scripts/ver_linux +2 -3
 'NR==1{print "nfs-utils             ", $NF}'
 
-ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed \
--e 's/\.so$//' | sed -e 's/>//' | \
-awk -F'[.-]' '{print "Linux C Library        "$(NF-1)"."$NF}'
+echo -n "Linux C Library        "
+sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' < /proc/self/maps
 
 ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \
 'NR==1{print "Dynamic linker (ldd)  ", $NF}'

Applied.

Sam

#7 lore raw
In reply to Al Viro

Al Viro <[email protected]> wrote:

| or, simpler yet,
| 
| sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' </proc/self/maps

Or:

sed -n 's/^.*\/libc-\([^/]*\)\.so$/\1/p; T; q' < /proc/self/maps

Signature · 3 lines
Dick Streefland                      ////                      Altium BV
[email protected]           (@ @)          http://www.altium.com
--------------------------------oOO--(_)--OOo---------------------------