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