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