Package: nocache
Version: 1.0-1
Severity: wishlist

nocache does not properly handle the situation where an invalid flag
was passed to the script. It complains about the options and continues.
The correct thing to do would be to print a usage statement and exit.
It would also be nice to add a help option to print the usage info.

$ nocache --help echo foo
/usr/bin/nocache: illegal option -- -
/usr/bin/nocache: illegal option -- h
/usr/bin/nocache: illegal option -- e
/usr/bin/nocache: illegal option -- l
/usr/bin/nocache: illegal option -- p
foo

$ shellcheck -eSC2145 `which nocache` 

In /usr/bin/nocache line 6:
case "$opt" in
^-- SC2220: Invalid flags are not handled. Add a *) case.

$ cp `which nocache` .

$ sed -i 's/esac/*) echo usage statement here ; exit ;; esac/' nocache 

$ ./nocache --help echo foo
./nocache: illegal option -- -
usage statement here

-- System Information:
Debian Release: buster/sid
  APT prefers testing-debug
  APT policy: (900, 'testing-debug'), (900, 'testing'), (800, 
'unstable-debug'), (800, 'unstable'), (790, 'buildd-unstable'), (700, 
'experimental-debug'), (700, 'experimental'), (690, 'buildd-experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.18.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_AU.utf8, LC_CTYPE=en_AU.utf8 (charmap=UTF-8), 
LANGUAGE=en_AU.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages nocache depends on:
ii  libc6  2.28-2

nocache recommends no packages.

nocache suggests no packages.

-- no debconf information

-- 
bye,
pabs

https://wiki.debian.org/PaulWise

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to