Skip to contentSkip to conversation

unzip01.sh: Fix failure with BusyBox unzip

PATCH New Radoslav Kolev 2 participants 2 messages Dec 21, 2020 – Jan 5, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 unzip01.sh: Fix failure with BusyBox unzip

BusyBox unzip uses the word 'inflating' instead of 'extracting'. Detect it and check for the correct match in the output.

---
 testcases/commands/unzip/unzip01.sh | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
testcases/commands/unzip/unzip01.sh +14 -6
index 750718de4..1b9a1665f 100755
@@ -12,6 +12,14 @@ TST_NEEDS_TMPDIR=1
 TST_NEEDS_CMDS="unzip"
 . tst_test.sh
 
+EXTRACT_MATCH=""
+
+if unzip 2>&1 | grep -q 'BusyBox'; then
+	EXTRACT_MATCH="inflating"
+else
+	EXTRACT_MATCH="extracting"
+fi
+
 setup()
 {
 	cat > unzip_exp.out <<EOF
@@ -21,15 +29,15 @@ Archive:  $TST_DATAROOT/test.zip
    creating: dir/d2/
    creating: dir/d3/
    creating: dir/d4/
- extracting: dir/d1/f1
- extracting: dir/d1/f2
- extracting: dir/d1/f3
+ $EXTRACT_MATCH: dir/d1/f1
+ $EXTRACT_MATCH: dir/d1/f2
+ $EXTRACT_MATCH: dir/d1/f3
    creating: dir/d2/d1/
    creating: dir/d2/d2/
    creating: dir/d2/d3/
- extracting: dir/d2/f1
- extracting: dir/d2/f2
- extracting: dir/d2/f3
+ $EXTRACT_MATCH: dir/d2/f1
+ $EXTRACT_MATCH: dir/d2/f2
+ $EXTRACT_MATCH: dir/d2/f3
    creating: dir/d3/d1/
    creating: dir/d3/d2/
    creating: dir/d3/d3/
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/1 unzip01.sh: Fix failure with BusyBox unzip

Hi Radoslav,

Quoted 13 lines

BusyBox unzip uses the word 'inflating' instead of 'extracting'. Detect it and check for the correct match in the output.

---
 testcases/commands/unzip/unzip01.sh | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
testcases/commands/unzip/unzip01.sh +0 -0
index 750718de4..1b9a1665f 100755

testcases/commands/unzip/unzip01.sh TST_NEEDS_TMPDIR=1 · line 15

Quoted 4 lines
testcases/commands/unzip/unzip01.sh +1 -0
@@ -12,6 +12,14 @@ TST_NEEDS_TMPDIR=1
 TST_NEEDS_CMDS="unzip"
 . tst_test.sh
 
+EXTRACT_MATCH=""

FYI shell syntax allow to drop quotes here:
EXTRACT_MATCH=

testcases/commands/unzip/unzip01.sh TST_NEEDS_TMPDIR=1 · line 21

Quoted 6 lines
testcases/commands/unzip/unzip01.sh +6 -0
+
+if unzip 2>&1 | grep -q 'BusyBox'; then
+	EXTRACT_MATCH="inflating"
+else
+	EXTRACT_MATCH="extracting"
+fi

Thanks for a fix. Obviously correct, I pushed it with a tiny change (readability):

EXTRACT_MATCH="extracting"

if unzip 2>&1 | grep -q 'BusyBox'; then
EXTRACT_MATCH="inflating"
fi

Kind regards,
Petr