3 ms·
'set -o nounset' is a must have. I Just suffered this script from Samsung Printer setting Utility. sudo ./uninstall wiped the /opt DEST_PATH=/opt/$VENDOR/$DE
by rshm 12y ago
'set -o nounset' is a must have. I Just suffered this script from Samsung Printer setting Utility. sudo ./uninstall wiped the /opt
DEST_PATH=/opt/$VENDOR/$DEST_DIRNAME
#remove destination
VERSION=`cat "$DEST_PATH/bin/.version"`
if rm -fr "$DEST_PATH"; then
echo "INFO: $APP_NAME (ver.$VERSION) has been uninstalled successfully."
...
- laurent123456 12y agoWow, nounset or not, doing a `rm -rf` on a variable without any check is quite irresponsible. Especially if they expect the script to be run as sudo.
- jacquesm 12y agoJust checking if .version exists and if it doesn't exiting with an error code would be a huge improvement, checking if $DEST_PATH is set is a must as well. Scary to see a big company like Samsung release code this bad.