3f3a1b
From 21cd963565a43dabd59516bd4cca5c76a614f255 Mon Sep 17 00:00:00 2001
3f3a1b
From: Jakub Martisko <jamartis@redhat.com>
3f3a1b
Date: Tue, 26 Mar 2019 12:29:30 +0100
3f3a1b
Subject: [PATCH] Fix: the value of the skip variable in the gzexe
3f3a1b
3f3a1b
---
3f3a1b
 gzexe.in          |  4 ++--
3f3a1b
 tests/Makefile.am |  1 +
3f3a1b
 tests/gzexe       | 20 ++++++++++++++++++++
3f3a1b
 3 files changed, 23 insertions(+), 2 deletions(-)
3f3a1b
 create mode 100755 tests/gzexe
3f3a1b
3f3a1b
diff --git a/gzexe.in b/gzexe.in
3f3a1b
index 6c61183..cffa84e 100644
3f3a1b
--- a/gzexe.in
3f3a1b
+++ b/gzexe.in
3f3a1b
@@ -145,7 +145,7 @@ for i do
3f3a1b
   if test $decomp -eq 0; then
3f3a1b
     (cat <<'EOF' &&
3f3a1b
 #!/bin/sh
3f3a1b
-skip=44
3f3a1b
+skip=49
3f3a1b
 
3f3a1b
 tab='	'
3f3a1b
 nl='
3f3a1b
@@ -201,7 +201,7 @@ EOF
3f3a1b
 
3f3a1b
   else
3f3a1b
     # decompression
3f3a1b
-    skip=44
3f3a1b
+    skip=49
3f3a1b
     skip_line=`sed -e 1d -e 2q "$file"`
3f3a1b
     case $skip_line in
3f3a1b
     skip=[0-9] | skip=[0-9][0-9] | skip=[0-9][0-9][0-9])
3f3a1b
diff --git a/tests/Makefile.am b/tests/Makefile.am
3f3a1b
index ebdce5b..4dfbccf 100644
3f3a1b
--- a/tests/Makefile.am
3f3a1b
+++ b/tests/Makefile.am
3f3a1b
@@ -15,6 +15,7 @@
3f3a1b
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
3f3a1b
 
3f3a1b
 TESTS =					\
3f3a1b
+	gzexe				\
3f3a1b
   gzip-env				\
3f3a1b
   helin-segv				\
3f3a1b
   help-version				\
3f3a1b
diff --git a/tests/gzexe b/tests/gzexe
3f3a1b
new file mode 100755
3f3a1b
index 0000000..45f71c7
3f3a1b
--- /dev/null
3f3a1b
+++ b/tests/gzexe
3f3a1b
@@ -0,0 +1,20 @@
3f3a1b
+#!/bin/sh
3f3a1b
+#Try running simple shell script compressed by gzexe
3f3a1b
+
3f3a1b
+. "${srcdir=.}/init.sh"; path_prepend_ ..
3f3a1b
+
3f3a1b
+cat <<EOF > foo || framework_failure_
3f3a1b
+#!/bin/sh
3f3a1b
+echo "Hello World!"
3f3a1b
+EOF
3f3a1b
+
3f3a1b
+echo "Hello World!" > exp || framework_failure_
3f3a1b
+
3f3a1b
+fail=0
3f3a1b
+gzexe foo || fail=1
3f3a1b
+/bin/sh foo > out 2> err || fail=1
3f3a1b
+
3f3a1b
+compare exp out || fail=1
3f3a1b
+test -s err && fail=1
3f3a1b
+
3f3a1b
+Exit $fail
3f3a1b
-- 
3f3a1b
2.21.0
3f3a1b