diff options
author | Ruediger Meier | 2017-06-27 08:25:10 +0200 |
---|---|---|
committer | Ruediger Meier | 2017-06-27 08:25:10 +0200 |
commit | e8e9267f5deed3a2b071590256244aafe2af7075 (patch) | |
tree | c24499602493c04ed0a404a65e3b5329271fae9e /tools | |
parent | Merge branch 'travis-fix' of https://github.com/rudimeier/util-linux (diff) | |
download | kernel-qcow2-util-linux-e8e9267f5deed3a2b071590256244aafe2af7075.tar.gz kernel-qcow2-util-linux-e8e9267f5deed3a2b071590256244aafe2af7075.tar.xz kernel-qcow2-util-linux-e8e9267f5deed3a2b071590256244aafe2af7075.zip |
tools: ignore unsafe commands in checkusage.sh
These commands behave unusual with --unknownopt.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/checkusage.sh | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/checkusage.sh b/tools/checkusage.sh index 68bf57154..3d573a253 100755 --- a/tools/checkusage.sh +++ b/tools/checkusage.sh @@ -21,7 +21,12 @@ cmds=$(echo $@ | tr ' ' '\n' | sort) ## alt_whereis__help="-h" # in past whereis(1) had no longopt for --help ## alt_more__help="x" # more(1) had neither --help nor -h -alt_fsck__unknownopt="-Tunknown" # no title (-T) and pass -unknown to fsck.foo +alt_fsck__unknownopt="x" # fsck passes unknown opts to fsck.ext4, etc. +alt_mkfs__unknownopt="x" # dito +alt_kill__unknownopt="inval pids" # trick, kill does not use errtryhelp() +if [ $(id -ru) -eq 0 ]; then + alt_sulogin__unknownopt="x" # would hang at pwd prompt +fi function exec_option { local cmdb=$1 @@ -39,8 +44,8 @@ function exec_option { opt=$alt fi - out=$("$cmd" "$opt" 2>/dev/null) - err=$("$cmd" "$opt" 2>&1 >/dev/null) + out=$("$cmd" $opt 2>/dev/null) + err=$("$cmd" $opt 2>&1 >/dev/null) ret=$? # hardcoded ... nologin should always return false @@ -118,10 +123,7 @@ function check_unknownopt { out_len=$(echo "$out" | wc -l) err_len=$(echo "$err" | wc -l) if test "$err_len" -gt 2; then - # hardcoded ignore ... mkfs sends options to mkfs.ext2 - if test "$cb" != "mkfs" -a "$cb" != "fsck"; then - echo "$cb: $opt, stderr too long: $err_len" - fi + echo "$cb: $opt, stderr too long: $err_len" elif test "$err_len" -lt 2; then echo "$cb: $opt, stderr too short: $err_len" fi |