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