From b0ba12d49c2d79a4e88a5965f30c01aaea49dd33 Mon Sep 17 00:00:00 2001 From: Jindrich Makovicka Date: Tue, 5 Jul 2011 17:13:21 +0200 Subject: [PATCH] Ticket #2569: fix bashisms in extfs Several extfs scripts (notably iso9660) don't work on linux distributions using dash as the default shell. This patch fixes all current problems in extfs reported by checkbashisms utility. Signed-off-by: Slava Zanko --- src/vfs/extfs/helpers/iso9660.in | 2 +- src/vfs/extfs/helpers/uace.in | 8 +++++++- src/vfs/extfs/helpers/uarc.in | 8 +++++++- src/vfs/extfs/helpers/uc1541.in | 8 +++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/vfs/extfs/helpers/iso9660.in b/src/vfs/extfs/helpers/iso9660.in index c78c829a1..296ac54a0 100644 --- a/src/vfs/extfs/helpers/iso9660.in +++ b/src/vfs/extfs/helpers/iso9660.in @@ -78,7 +78,7 @@ BEGIN { } mcisofs_copyout () { - if [ "x$SEMICOLON" == "xYES" ]; then + if [ "x$SEMICOLON" = "xYES" ]; then $ISOINFO -i "$1" -x "/$2;1" 2>/dev/null > "$3" else $ISOINFO -i "$1" -x "/$2" 2>/dev/null > "$3" diff --git a/src/vfs/extfs/helpers/uace.in b/src/vfs/extfs/helpers/uace.in index 062d82f93..6b00f7a41 100644 --- a/src/vfs/extfs/helpers/uace.in +++ b/src/vfs/extfs/helpers/uace.in @@ -22,7 +22,13 @@ ACE_GET="unace x" # ls: mc_ace_fs_list() { - $ACE_LIST "$1" | gawk -v uid=${UID-0} ' + if [ "x$UID" = "x" ]; then + UID=`id -ru 2>/dev/null` + if [ "x$UID" = "x" ]; then + UID=0 + fi + fi + $ACE_LIST "$1" | gawk -v uid=$UID ' BEGIN { Month="JanFebMarAprMayJunJulAugSepOctNovDec" } /%/ { split($1,date,".") diff --git a/src/vfs/extfs/helpers/uarc.in b/src/vfs/extfs/helpers/uarc.in index 3f71277b7..e3269cb09 100644 --- a/src/vfs/extfs/helpers/uarc.in +++ b/src/vfs/extfs/helpers/uarc.in @@ -19,7 +19,13 @@ ARC_DEL="arc d" mc_arc_fs_list() { - $ARC_LIST "$1" | gawk -v uid=${UID-0} ' + if [ "x$UID" = "x" ]; then + UID=`id -ru 2>/dev/null` + if [ "x$UID" = "x" ]; then + UID=0 + fi + fi + $ARC_LIST "$1" | gawk -v uid=$UID ' BEGIN { } /^Name/ { next } /===/ { next } diff --git a/src/vfs/extfs/helpers/uc1541.in b/src/vfs/extfs/helpers/uc1541.in index fed3301f9..a9620a167 100644 --- a/src/vfs/extfs/helpers/uc1541.in +++ b/src/vfs/extfs/helpers/uc1541.in @@ -20,7 +20,13 @@ C1541="c1541" # There are no time stamps in the disk image, so a bogus timestamp is displayed mc_c1541_fs_list() { - $C1541 "$1" -list | gawk -v uid=${UID-0} ' + if [ x"$UID" = x ]; then + UID=`id -ru 2>/dev/null` + if [ "x$UID" = "x" ]; then + UID=0 + fi + fi + $C1541 "$1" -list | gawk -v uid=$UID ' BEGIN { FS = "\"" } /No LINES!/ { next } /BLOCKS FREE/ { next }