linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number
@ 2015-10-12 18:39 Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 02/22] ver_linux: make --version, " Alexander Kapshuk
                   ` (22 more replies)
  0 siblings, 23 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than a field number.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 7de36df..af6467e 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -11,8 +11,12 @@ echo ' '
 uname -a
 echo ' '
 
-gcc -dumpversion 2>&1| awk \
-'NR==1{print "Gnu C                 ", $1}'
+gcc -dumpversion 2>&1 |
+awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("GNU C\t\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 make --version 2>&1 | awk -F, '{print $1}' | awk \
       '/GNU Make/{print "Gnu make              ",$NF}'
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 02/22] ver_linux: make --version, use regex to find version number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 03/22] ver_linux: binutils, fix inaccurate output Alexander Kapshuk
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than a field number.
Reduce the number of 'awk' invocations from two to one.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index af6467e..31c0e4d 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -18,8 +18,12 @@ awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
 	substr($0,RSTART,RLENGTH))
 }'
 
-make --version 2>&1 | awk -F, '{print $1}' | awk \
-      '/GNU Make/{print "Gnu make              ",$NF}'
+make --version 2>&1 |
+awk '/GNU Make/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("GNU Make\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 echo "binutils               $(ld -v | egrep -o '[0-9]+\.[0-9\.]+')"
 
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 03/22] ver_linux: binutils, fix inaccurate output
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 02/22] ver_linux: make --version, " Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 04/22] ver_linux: util-linux, 'fdformat' not ubiquitous any longer Alexander Kapshuk
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Current implementation output on Gentoo Linux:
binutils               2.25.1
1.1
2.25.1

Proposed implementation:
Binutils		2.25.1

Tested on:
Gentoo Linux
Debian 6.0.10
Oracle Linux Server release 7.1

Rely on regex to find the version number.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 31c0e4d..1fea749 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -25,7 +25,12 @@ awk '/GNU Make/{
 	substr($0,RSTART,RLENGTH))
 }'
 
-echo "binutils               $(ld -v | egrep -o '[0-9]+\.[0-9\.]+')"
+ld -v 2>&1 |
+awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("Binutils\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 echo -n "util-linux             "
 fdformat --version | awk '{print $NF}' | sed -e s/^util-linux-// -e s/\)$//
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 04/22] ver_linux: util-linux, 'fdformat' not ubiquitous any longer
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 02/22] ver_linux: make --version, " Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 03/22] ver_linux: binutils, fix inaccurate output Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 22:04   ` Jim Davis
  2015-10-12 18:39 ` [PATCH 05/22] ver_linux: module-init-tools, look for numerical input, not field number Alexander Kapshuk
                   ` (19 subsequent siblings)
  22 siblings, 1 reply; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

The current implementation relies on 'fdformat' to output the version of
'util-linux'. This does not seem to be reliable any longer, as 'fdformat'
does not seem to come preinstalled in all ditros these days.

The proposed implementation uses 'mount' to output both the version
of 'util-linux' and 'mount' proper, as 'mount' is also a part of the
'util-linux' package.

Tested on:
Gentoo Linux
Debian 6.0.10
Oracle Linux Server release 7.1

Rely on regex to find the version number, rather than a field number.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 1fea749..28e7640 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -32,11 +32,12 @@ awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
 	substr($0,RSTART,RLENGTH))
 }'
 
-echo -n "util-linux             "
-fdformat --version | awk '{print $NF}' | sed -e s/^util-linux-// -e s/\)$//
-
-echo -n "mount                  "
-mount --version | awk '{print $NF}' | sed -e s/^mount-// -e s/\)$//
+mount --version 2>&1 |
+awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	$0 = substr($0,RSTART,RLENGTH)
+	printf("Util-linux\t\t%s\nMount\t\t\t%s\n",$0,$0)
+}'
 
 depmod -V  2>&1 | awk 'NR==1 {print "module-init-tools     ",$NF}'
 
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 05/22] ver_linux: module-init-tools, look for numerical input, not field number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (2 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 04/22] ver_linux: util-linux, 'fdformat' not ubiquitous any longer Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 06/22] ver_linux: e2fsprogs, " Alexander Kapshuk
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.

Tested on:
Gentoo Linux
Debian 6.0.10
Oracle Linux Server release 7.1

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 28e7640..7cc74d1 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -39,7 +39,12 @@ awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
 	printf("Util-linux\t\t%s\nMount\t\t\t%s\n",$0,$0)
 }'
 
-depmod -V  2>&1 | awk 'NR==1 {print "module-init-tools     ",$NF}'
+depmod -V  2>&1 |
+awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("Module-init-tools\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 tune2fs 2>&1 | grep "^tune2fs" | sed 's/,//' |  awk \
 'NR==1 {print "e2fsprogs             ", $2}'
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 06/22] ver_linux: e2fsprogs, look for numerical input, not field number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (3 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 05/22] ver_linux: module-init-tools, look for numerical input, not field number Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 07/22] ver_linux: jfsutils, " Alexander Kapshuk
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.
Proposed implementation also eliminates the necessity to invoke 'grep' + 'sed' + 'awk'.

Tested on:
Gentoo Linux
Debian 6.0.10
Oracle Linux Server release 7.1

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 7cc74d1..2e1929f 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -46,8 +46,12 @@ awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
 	substr($0,RSTART,RLENGTH))
 }'
 
-tune2fs 2>&1 | grep "^tune2fs" | sed 's/,//' |  awk \
-'NR==1 {print "e2fsprogs             ", $2}'
+tune2fs 2>&1 |
+awk '/^tune2fs/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("E2fsprogs\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 fsck.jfs -V 2>&1 | grep version | sed 's/,//' |  awk \
 'NR==1 {print "jfsutils              ", $3}'
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 07/22] ver_linux: jfsutils, look for numerical input, not field number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (4 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 06/22] ver_linux: e2fsprogs, " Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 08/22] ver_linux: reiserfsprogs, " Alexander Kapshuk
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.
Proposed implementation also eliminates the necessity to invoke 'grep' + 'sed' + 'awk'.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 2e1929f..7d85447 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -53,8 +53,12 @@ awk '/^tune2fs/{
 	substr($0,RSTART,RLENGTH))
 }'
 
-fsck.jfs -V 2>&1 | grep version | sed 's/,//' |  awk \
-'NR==1 {print "jfsutils              ", $3}'
+fsck.jfs -V 2>&1 |
+awk '/version/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("Jfsutils\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 reiserfsck -V 2>&1 | grep ^reiserfsck | awk \
 'NR==1{print "reiserfsprogs         ", $2}'
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 08/22] ver_linux: reiserfsprogs, look for numerical input, not field number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (5 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 07/22] ver_linux: jfsutils, " Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 09/22] ver_linux: xfsprogs, " Alexander Kapshuk
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.

Proposed implementation also eliminates the necessity to invoke 'grep' + 'awk'.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 7d85447..65d4c02 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -60,8 +60,12 @@ awk '/version/{
 	substr($0,RSTART,RLENGTH))
 }'
 
-reiserfsck -V 2>&1 | grep ^reiserfsck | awk \
-'NR==1{print "reiserfsprogs         ", $2}'
+reiserfsck -V 2>&1 |
+awk '/^reiserfsck/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("Reiserfsprogs\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 fsck.reiser4 -V 2>&1 | grep ^fsck.reiser4 | awk \
 'NR==1{print "reiser4progs          ", $2}'
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 09/22] ver_linux: xfsprogs, look for numerical input, not field number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (6 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 08/22] ver_linux: reiserfsprogs, " Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 10/22] ver_linux: pcmciautils, " Alexander Kapshuk
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.
Proposed implementation also eliminates the necessity to invoke 'grep' + 'awk'.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 65d4c02..a926225 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -70,8 +70,12 @@ awk '/^reiserfsck/{
 fsck.reiser4 -V 2>&1 | grep ^fsck.reiser4 | awk \
 'NR==1{print "reiser4progs          ", $2}'
 
-xfs_db -V 2>&1 | grep version | awk \
-'NR==1{print "xfsprogs              ", $3}'
+xfs_db -V 2>&1 |
+awk '/version/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("Xfsprogs\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 pccardctl -V 2>&1| grep pcmciautils | awk '{print "pcmciautils           ", $2}'
 
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 10/22] ver_linux: pcmciautils, look for numerical input, not field number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (7 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 09/22] ver_linux: xfsprogs, " Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 11/22] ver_linux: quota-tools, " Alexander Kapshuk
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.
Proposed implementation also eliminates the necessity to invoke 'grep' + 'awk'.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index a926225..e36cceb 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -77,7 +77,12 @@ awk '/version/{
 	substr($0,RSTART,RLENGTH))
 }'
 
-pccardctl -V 2>&1| grep pcmciautils | awk '{print "pcmciautils           ", $2}'
+pccardctl -V 2>&1 |
+awk '/pcmciautils/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("Pcmciautils\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 cardmgr -V 2>&1| grep version | awk \
 'NR==1{print "pcmcia-cs             ", $3}'
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 11/22] ver_linux: quota-tools, look for numerical input, not field number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (8 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 10/22] ver_linux: pcmciautils, " Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 12/22] ver_linux: ppp, " Alexander Kapshuk
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.
Proposed implementation also eliminates the necessity to invoke 'grep' + 'awk'.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index e36cceb..d5b342e 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -87,8 +87,12 @@ awk '/pcmciautils/{
 cardmgr -V 2>&1| grep version | awk \
 'NR==1{print "pcmcia-cs             ", $3}'
 
-quota -V 2>&1 | grep version | awk \
-'NR==1{print "quota-tools           ", $NF}'
+quota -V 2>&1 |
+awk '/version/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("Quota-tools\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 pppd --version 2>&1| grep version | awk \
 'NR==1{print "PPP                   ", $3}'
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 12/22] ver_linux: ppp, look for numerical input, not field number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (9 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 11/22] ver_linux: quota-tools, " Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 13/22] ver_linux: libc, input redirection to sed fails in some distros Alexander Kapshuk
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.
Proposed implementation also eliminates the necessity to invoke 'grep' + 'awk'.

Tested on:
Oracle Linux

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index d5b342e..af5ac82 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -94,8 +94,12 @@ awk '/version/{
 	substr($0,RSTART,RLENGTH))
 }'
 
-pppd --version 2>&1| grep version | awk \
-'NR==1{print "PPP                   ", $3}'
+pppd --version 2>&1 |
+awk '/version/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("PPP\t\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 isdnctrl 2>&1 | grep version | awk \
 'NR==1{print "isdn4k-utils          ", $NF}'
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 13/22] ver_linux: libc, input redirection to sed fails in some distros
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (10 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 12/22] ver_linux: ppp, " Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 14/22] ver_linux: ldd, look for numerical input, not field number Alexander Kapshuk
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

The current implementation has been found not to work across all distros.

The proposed implementation relies on 'sed' to both output the string
'Linux C Library' as well as to open '/proc/self/maps' without having
to use output redirection.

Tested on:
Gentoo Linux
Debian 6.0.10
Oracle Linux Server release 7.1
Arch Linux
openSuSE 13.2

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index af5ac82..909d039 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -107,8 +107,12 @@ isdnctrl 2>&1 | grep version | awk \
 showmount --version 2>&1 | grep nfs-utils | awk \
 'NR==1{print "nfs-utils             ", $NF}'
 
-echo -n "Linux C Library        "
-sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' < /proc/self/maps
+test -r /proc/self/maps &&
+sed '
+	/.*libc-\(.*\)\.so$/!d
+	s//Linux C Library\t\t\1/
+	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}'
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 14/22] ver_linux: ldd, look for numerical input, not field number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (11 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 13/22] ver_linux: libc, input redirection to sed fails in some distros Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 15/22] ver_linux: libcpp, fix missing output Alexander Kapshuk
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.
Proposed implementation also eliminates the necessity to invoke 'head' + 'awk'.

The '-v' flag either seems to have been deprecated in some distros, e.g. Gentoo, or is an alias for '--version' in others. The proposed implementation uses the latter flag only.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 909d039..a7d0eca 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -114,8 +114,12 @@ sed '
 	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}'
+ldd --version 2>&1 |
+awk '/^ldd/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("Dynamic linker (ldd)\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 ls -l /usr/lib/libg++.so /usr/lib/libstdc++.so  2>/dev/null | awk -F. \
        '{print "Linux C++ Library      " $4"."$5"."$6}'
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 15/22] ver_linux: libcpp, fix missing output
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (12 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 14/22] ver_linux: ldd, look for numerical input, not field number Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 16/22] ver_linux: procps, look for numerical input, not field number Alexander Kapshuk
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Neither 'libg++.so', nor 'libstdc++.so' were found where the current
implementation expects them to be found in the distros below.

Gentoo Linux
Debian 6.0.10
Oracle Linux Server release 7.1

Which results in zero ouput generated.

The proposed implementation relies on 'ldconfig' to locate the libraries
in question.  'Sed' is used to do the text processing.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index a7d0eca..882ddb9 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -121,9 +121,18 @@ awk '/^ldd/{
 	substr($0,RSTART,RLENGTH))
 }'
 
-ls -l /usr/lib/libg++.so /usr/lib/libstdc++.so  2>/dev/null | awk -F. \
-       '{print "Linux C++ Library      " $4"."$5"."$6}'
-
+libcpp=`ldconfig -p 2>/dev/null |
+	awk '/(libg|stdc)[+]+\.so/ {
+	print $NF
+	exit
+	}
+'`
+test -r "$libcpp" &&
+ls -l $libcpp |
+sed '
+	s!.*so\.!!
+	s!^!Linux C++ Library\t!
+'
 ps --version 2>&1 | grep version | awk \
 'NR==1{print "Procps                ", $NF}'
 
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 16/22] ver_linux: procps, look for numerical input, not field number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (13 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 15/22] ver_linux: libcpp, fix missing output Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 17/22] ver_linux: net-tools, " Alexander Kapshuk
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.
Proposed implementation also eliminates the necessity to invoke 'grep' + 'awk'.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 882ddb9..2269803 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -133,8 +133,12 @@ sed '
 	s!.*so\.!!
 	s!^!Linux C++ Library\t!
 '
-ps --version 2>&1 | grep version | awk \
-'NR==1{print "Procps                ", $NF}'
+ps --version 2>&1 |
+awk '/version/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("Procps\t\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 ifconfig --version 2>&1 | grep tools | awk \
 'NR==1{print "Net-tools             ", $NF}'
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 17/22] ver_linux: net-tools, look for numerical input, not field number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (14 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 16/22] ver_linux: procps, look for numerical input, not field number Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 18/22] ver_linux: loadkeys, " Alexander Kapshuk
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.
Proposed implementation also eliminates the necessity to invoke 'grep' + 'awk'.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 2269803..4ef1b7d 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -140,8 +140,12 @@ awk '/version/{
 	substr($0,RSTART,RLENGTH))
 }'
 
-ifconfig --version 2>&1 | grep tools | awk \
-'NR==1{print "Net-tools             ", $NF}'
+ifconfig --version 2>&1 |
+awk '/tools/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("Net-tools\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 # Kbd needs 'loadkeys -h',
 loadkeys -h 2>&1 | awk \
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 18/22] ver_linux: loadkeys, look for numerical input, not field number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (15 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 17/22] ver_linux: net-tools, " Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:39 ` [PATCH 19/22] ver_linux: sh-utils, " Alexander Kapshuk
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

'loadkeys -h' no longer prints the version number across all distros,
despite the claim to do so in the manpage, which I found to be the case
on a Debian Linux system.

The proposed implementation utilises the output of 'loadkeys -V' to
acquire the version of both 'Kbd' and 'Console-tools'.

Tested on:
Gentoo Linux
Debian 6.0.10
Oracle Linux Server release 7.1

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 4ef1b7d..e6b57d5 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -147,13 +147,12 @@ awk '/tools/{
 	substr($0,RSTART,RLENGTH))
 }'
 
-# Kbd needs 'loadkeys -h',
-loadkeys -h 2>&1 | awk \
-'(NR==1 && ($3 !~ /option/)) {print "Kbd                   ", $3}'
-
-# while console-tools needs 'loadkeys -V'.
-loadkeys -V 2>&1 | awk \
-'(NR==1 && ($2 ~ /console-tools/)) {print "Console-tools         ", $3}'
+loadkeys -V 2>&1 |
+awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	$0 = substr($0,RSTART,RLENGTH)
+	printf("Kbd\t\t\t%s\nConsole-tools\t\t%s\n",$0,$0)
+}'
 
 oprofiled --version 2>&1 | awk \
 '(NR==1 && ($2 == "oprofile")) {print "oprofile              ", $3}'
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 19/22] ver_linux: sh-utils, look for numerical input, not field number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (16 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 18/22] ver_linux: loadkeys, " Alexander Kapshuk
@ 2015-10-12 18:39 ` Alexander Kapshuk
  2015-10-12 18:40 ` [PATCH 20/22] ver_linux: use 'udevadm', instead of 'udevinfo' Alexander Kapshuk
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.

Tested on:
Gentoo Linux
Debian 6.0.10
Oracle Linux Server release 7.1

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index e6b57d5..1c6ec22 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -157,7 +157,12 @@ awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
 oprofiled --version 2>&1 | awk \
 '(NR==1 && ($2 == "oprofile")) {print "oprofile              ", $3}'
 
-expr --v 2>&1 | awk 'NR==1{print "Sh-utils              ", $NF}'
+expr --v 2>&1 |
+awk '/^expr/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("Sh-utils\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 udevinfo -V 2>&1 | grep version | awk '{print "udev                  ", $3}'
 
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 20/22] ver_linux: use 'udevadm', instead of 'udevinfo'
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (17 preceding siblings ...)
  2015-10-12 18:39 ` [PATCH 19/22] ver_linux: sh-utils, " Alexander Kapshuk
@ 2015-10-12 18:40 ` Alexander Kapshuk
  2015-10-12 18:40 ` [PATCH 21/22] ver_linux: wireless-tools, look for numerical input, not field number Alexander Kapshuk
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

'udevinfo' no longer seems to be available across various
distros. 'udevadm' seems to be the currently valid way to look up the
'udev' version.

Tested on:
Gentoo Linux
Debian 6.0.10
Oracle Linux Server release 7.1

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.
Proposed implementation also eliminates the necessity to invoke 'grep' + 'awk'.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 1c6ec22..f839be3 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -164,7 +164,12 @@ awk '/^expr/{
 	substr($0,RSTART,RLENGTH))
 }'
 
-udevinfo -V 2>&1 | grep version | awk '{print "udev                  ", $3}'
+udevadm --version 2>&1 |
+awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("Udev\t\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 iwconfig --version 2>&1 | awk \
 '(NR==1 && ($3 == "version")) {print "wireless-tools        ",$4}'
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 21/22] ver_linux: wireless-tools, look for numerical input, not field number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (18 preceding siblings ...)
  2015-10-12 18:40 ` [PATCH 20/22] ver_linux: use 'udevadm', instead of 'udevinfo' Alexander Kapshuk
@ 2015-10-12 18:40 ` Alexander Kapshuk
  2015-10-12 18:40 ` [PATCH 22/22] ver_linux: proc/modules, limit text processing to 'sed' Alexander Kapshuk
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.

Tested on:
Gentoo Linux

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index f839be3..ae426c2 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -171,8 +171,12 @@ awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
 	substr($0,RSTART,RLENGTH))
 }'
 
-iwconfig --version 2>&1 | awk \
-'(NR==1 && ($3 == "version")) {print "wireless-tools        ",$4}'
+iwconfig --version 2>&1 |
+awk '/version/{
+	match($0, /[0-9]+([.]?[0-9]+)+/)
+	printf("Wireless-tools\t\t%s\n",
+	substr($0,RSTART,RLENGTH))
+}'
 
 if [ -e /proc/modules ]; then
     X=`cat /proc/modules | sed -e "s/ .*$//"`
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 22/22] ver_linux: proc/modules, limit text processing to 'sed'
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (19 preceding siblings ...)
  2015-10-12 18:40 ` [PATCH 21/22] ver_linux: wireless-tools, look for numerical input, not field number Alexander Kapshuk
@ 2015-10-12 18:40 ` Alexander Kapshuk
  2015-10-12 20:22   ` Jim Davis
  2015-10-13 23:21 ` [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Jim Davis
  2015-12-02 14:24 ` Pavel Machek
  22 siblings, 1 reply; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-12 18:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jim.epost, richard, tytso, Alexander Kapshuk

This patch is more of a personal preference, rather than a fix for a problem.

The current implementation used a combination of both 'cat' and 'sed'
to generate an unsorted list of kernel modules separated by while space.

The proposed implementation uses 'sort' and 'sed' to generate a sort
list of kernel modules separated by while space.

Tested on:
Gentoo Linux
Debian 6.0.10
Oracle Linux Server release 7.1
Arch Linux
openSuSE 13.2

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
 scripts/ver_linux | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index ae426c2..024a11a 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -178,7 +178,16 @@ awk '/version/{
 	substr($0,RSTART,RLENGTH))
 }'
 
-if [ -e /proc/modules ]; then
-    X=`cat /proc/modules | sed -e "s/ .*$//"`
-    echo "Modules Loaded         "$X
-fi
+test -e /proc/modules &&
+sort /proc/modules |
+sed '
+	s/ .*//
+	H
+${
+	g
+	s/^\n/Modules Loaded\t\t/
+	y/\n/ /
+	q
+}
+	d
+'
-- 
2.4.9


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [PATCH 22/22] ver_linux: proc/modules, limit text processing to 'sed'
  2015-10-12 18:40 ` [PATCH 22/22] ver_linux: proc/modules, limit text processing to 'sed' Alexander Kapshuk
@ 2015-10-12 20:22   ` Jim Davis
  2015-10-13 17:33     ` Alexander Kapshuk
  0 siblings, 1 reply; 29+ messages in thread
From: Jim Davis @ 2015-10-12 20:22 UTC (permalink / raw)
  To: Alexander Kapshuk
  Cc: linux-kernel, Greg Kroah-Hartman, richard, Theodore Ts'o

On Mon, Oct 12, 2015 at 11:40 AM, Alexander Kapshuk
<alexander.kapshuk@gmail.com> wrote:
> This patch is more of a personal preference, rather than a fix for a problem.

Using the sed hold space isn't exactly easy to follow...  if, unlike
the other patches, there isn't some potential improvement over the
status quo I'd suggest sticking with the original version.

-- 
Jim

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 04/22] ver_linux: util-linux, 'fdformat' not ubiquitous any longer
  2015-10-12 18:39 ` [PATCH 04/22] ver_linux: util-linux, 'fdformat' not ubiquitous any longer Alexander Kapshuk
@ 2015-10-12 22:04   ` Jim Davis
  0 siblings, 0 replies; 29+ messages in thread
From: Jim Davis @ 2015-10-12 22:04 UTC (permalink / raw)
  To: Alexander Kapshuk
  Cc: linux-kernel, Greg Kroah-Hartman, richard, Theodore Ts'o

On Mon, Oct 12, 2015 at 11:39 AM, Alexander Kapshuk
<alexander.kapshuk@gmail.com> wrote:
> The current implementation relies on 'fdformat' to output the version of
> 'util-linux'. This does not seem to be reliable any longer, as 'fdformat'
> does not seem to come preinstalled in all ditros these days.

No fdformat?!  Hmph, kids today with their shiny SSDs.  But seriously,
if you want to drop fdformat as the canonical util-linux program,
should Documentation/Changes should be updated too?

-- 
Jim

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 22/22] ver_linux: proc/modules, limit text processing to 'sed'
  2015-10-12 20:22   ` Jim Davis
@ 2015-10-13 17:33     ` Alexander Kapshuk
  0 siblings, 0 replies; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-13 17:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jim Davis, Greg Kroah-Hartman, richard, Theodore Ts'o

On Mon, Oct 12, 2015 at 11:22 PM, Jim Davis <jim.epost@gmail.com> wrote:
> On Mon, Oct 12, 2015 at 11:40 AM, Alexander Kapshuk
> <alexander.kapshuk@gmail.com> wrote:
>> This patch is more of a personal preference, rather than a fix for a problem.
>
> Using the sed hold space isn't exactly easy to follow...  if, unlike
> the other patches, there isn't some potential improvement over the
> status quo I'd suggest sticking with the original version.
>
> --
> Jim

Thanks for your feedback.

If the use of a shell variable to store the generated list of modules
be deemed more favourable than the use of the 'sed' hold space, may I
at least suggest either of the two approaches below:

Sorted list:
Y=`sort /proc/modules | sed 's/ .*$//'`

Unsorted list:
Z=`sed 's/ .*$//' /proc/modules`

The use of 'cat' in the context of the original implementation is redundant.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (20 preceding siblings ...)
  2015-10-12 18:40 ` [PATCH 22/22] ver_linux: proc/modules, limit text processing to 'sed' Alexander Kapshuk
@ 2015-10-13 23:21 ` Jim Davis
  2015-10-14  9:29   ` Alexander Kapshuk
  2015-12-02 14:24 ` Pavel Machek
  22 siblings, 1 reply; 29+ messages in thread
From: Jim Davis @ 2015-10-13 23:21 UTC (permalink / raw)
  To: Alexander Kapshuk
  Cc: linux-kernel, Greg Kroah-Hartman, richard, Theodore Ts'o

I tried out patches 1-22 on a Fedora 22 system with the v4.3-rc5
source tree; everything looks pretty good.  The old ver_linux script
didn't get the mount version right, but the new one does

< mount                  debug
> Mount            2.26.2

One minor thing with Net-tools, the old version printed

< Net-tools              2.10-alpha

while the regex the in the new version skips the '-alpha'

> Net-tools        2.10

Though I'm not a big fan of patch 22 (the sed hold space thing) there
are several nice improvements all in all.

-- 
Jim

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number
  2015-10-13 23:21 ` [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Jim Davis
@ 2015-10-14  9:29   ` Alexander Kapshuk
  2015-10-14 21:43     ` Jim Davis
  0 siblings, 1 reply; 29+ messages in thread
From: Alexander Kapshuk @ 2015-10-14  9:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jim Davis, Greg Kroah-Hartman, richard, Theodore Ts'o

On Wed, Oct 14, 2015 at 2:21 AM, Jim Davis <jim.epost@gmail.com> wrote:
> I tried out patches 1-22 on a Fedora 22 system with the v4.3-rc5
> source tree; everything looks pretty good.  The old ver_linux script
> didn't get the mount version right, but the new one does
>
> < mount                  debug
>> Mount            2.26.2
>
> One minor thing with Net-tools, the old version printed
>
> < Net-tools              2.10-alpha
>
> while the regex the in the new version skips the '-alpha'
>
>> Net-tools        2.10
>
> Though I'm not a big fan of patch 22 (the sed hold space thing) there
> are several nice improvements all in all.
>
> --
> Jim

Thanks very much for reviewing the patches and for your commentary.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number
  2015-10-14  9:29   ` Alexander Kapshuk
@ 2015-10-14 21:43     ` Jim Davis
  0 siblings, 0 replies; 29+ messages in thread
From: Jim Davis @ 2015-10-14 21:43 UTC (permalink / raw)
  To: Alexander Kapshuk
  Cc: linux-kernel, Greg Kroah-Hartman, richard, Theodore Ts'o

On Wed, Oct 14, 2015 at 2:29 AM, Alexander Kapshuk
<alexander.kapshuk@gmail.com> wrote:
> On Wed, Oct 14, 2015 at 2:21 AM, Jim Davis <jim.epost@gmail.com> wrote:
>> I tried out patches 1-22 on a Fedora 22 system with the v4.3-rc5
>> source tree; everything looks pretty good.  The old ver_linux script
>> didn't get the mount version right, but the new one does
>>
>> < mount                  debug
>>> Mount            2.26.2
>>
>> One minor thing with Net-tools, the old version printed
>>
>> < Net-tools              2.10-alpha
>>
>> while the regex the in the new version skips the '-alpha'
>>
>>> Net-tools        2.10
>>
>> Though I'm not a big fan of patch 22 (the sed hold space thing) there
>> are several nice improvements all in all.
>>
>> --
>> Jim
>
> Thanks very much for reviewing the patches and for your commentary.

You're welcome, but I think you may need to run checkpatch -- from a
quick test there were a few minor whitespace issues.

-- 
Jim

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number
  2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
                   ` (21 preceding siblings ...)
  2015-10-13 23:21 ` [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Jim Davis
@ 2015-12-02 14:24 ` Pavel Machek
  22 siblings, 0 replies; 29+ messages in thread
From: Pavel Machek @ 2015-12-02 14:24 UTC (permalink / raw)
  To: Alexander Kapshuk; +Cc: linux-kernel, gregkh, jim.epost, richard, tytso

On Mon 2015-10-12 21:39:41, Alexander Kapshuk wrote:
> Rely on regex to find the version number, rather than a field
number.

Are you sure that is good idea?

I'd say that the field number is going to fail in more obvious way,
which is a good thing.
								Pavel

> Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
> ---
>  scripts/ver_linux | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/ver_linux b/scripts/ver_linux
> index 7de36df..af6467e 100755
> --- a/scripts/ver_linux
> +++ b/scripts/ver_linux
> @@ -11,8 +11,12 @@ echo ' '
>  uname -a
>  echo ' '
>  
> -gcc -dumpversion 2>&1| awk \
> -'NR==1{print "Gnu C                 ", $1}'
> +gcc -dumpversion 2>&1 |
> +awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
> +	match($0, /[0-9]+([.]?[0-9]+)+/)
> +	printf("GNU C\t\t\t%s\n",
> +	substr($0,RSTART,RLENGTH))
> +}'
>  
>  make --version 2>&1 | awk -F, '{print $1}' | awk \
>        '/GNU Make/{print "Gnu make              ",$NF}'

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2015-12-02 14:24 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 02/22] ver_linux: make --version, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 03/22] ver_linux: binutils, fix inaccurate output Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 04/22] ver_linux: util-linux, 'fdformat' not ubiquitous any longer Alexander Kapshuk
2015-10-12 22:04   ` Jim Davis
2015-10-12 18:39 ` [PATCH 05/22] ver_linux: module-init-tools, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 06/22] ver_linux: e2fsprogs, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 07/22] ver_linux: jfsutils, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 08/22] ver_linux: reiserfsprogs, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 09/22] ver_linux: xfsprogs, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 10/22] ver_linux: pcmciautils, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 11/22] ver_linux: quota-tools, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 12/22] ver_linux: ppp, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 13/22] ver_linux: libc, input redirection to sed fails in some distros Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 14/22] ver_linux: ldd, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 15/22] ver_linux: libcpp, fix missing output Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 16/22] ver_linux: procps, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 17/22] ver_linux: net-tools, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 18/22] ver_linux: loadkeys, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 19/22] ver_linux: sh-utils, " Alexander Kapshuk
2015-10-12 18:40 ` [PATCH 20/22] ver_linux: use 'udevadm', instead of 'udevinfo' Alexander Kapshuk
2015-10-12 18:40 ` [PATCH 21/22] ver_linux: wireless-tools, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:40 ` [PATCH 22/22] ver_linux: proc/modules, limit text processing to 'sed' Alexander Kapshuk
2015-10-12 20:22   ` Jim Davis
2015-10-13 17:33     ` Alexander Kapshuk
2015-10-13 23:21 ` [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Jim Davis
2015-10-14  9:29   ` Alexander Kapshuk
2015-10-14 21:43     ` Jim Davis
2015-12-02 14:24 ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).