Skip to content

Commit

Permalink
ver_linux: Do not check for ver_linux pattern in version function
Browse files Browse the repository at this point in the history
Checking whether output of commands matches the ver_linux pattern in
the version function is original shell implementation legacy code. When
the original implementation failed to locate a particular utility,
it generated error output along the lines of:

ver_linux:line number: command not found.

The awk implementation, does not contain the name of the script within the
body of the error message returned by the subshell when a given utility
fails to be located. The error message returned is along the lines of:

sh: name of utility: command not found

Safeguarding against the ver_linux pattern being found in the output
being parsed may thus be safely omitted.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Alexander Kapshuk authored and Greg Kroah-Hartman committed Jul 7, 2018
1 parent 34fe3cf commit 71bdd87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/ver_linux
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ BEGIN {
function version(cmd, ver) {
cmd = cmd " 2>&1"
while (cmd | getline > 0) {
if (!/ver_linux/ && match($0, /[0-9]+([.]?[0-9]+)+/)) {
if (match($0, /[0-9]+([.]?[0-9]+)+/)) {
ver = substr($0, RSTART, RLENGTH)
break
}
Expand Down

0 comments on commit 71bdd87

Please sign in to comment.