Subject: bug#35002: closed (Re: bug#35002: [Patch][BUG] Wrong skip value in gzexe)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 27 Mar 2019 02:48:03 +0000

Your bug report

#35002: [Patch][BUG] Wrong skip value in gzexe

which was filed against the gzip package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
35002: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=35002
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#35002: [Patch][BUG] Wrong skip value in gzexe
From: Paul Eggert <[email-masked]>
To: Jakub Martisko <[email-masked]>, [email-masked]
Date: Tue, 26 Mar 2019 19:46:52 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On 3/26/19 5:41 AM, Jakub Martisko wrote:
> the skip value in gzexe seems to be wrong since the [1] commit.
>
> [1]: http://git.savannah.gnu.org/cgit/gzip.git/commit/?id=63aa2268a5abfed0116d04bbe3952e4a753af91d
>
Thanks, I installed the attached to fix it. Pretty fragile script, if
you ask me, but now's not the time to redo the plumbing....

>From 21033c04ffda821e462fe773e86c16547cae0a31 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Tue, 26 Mar 2019 19:44:43 -0700
Subject: [PATCH] gzexe: fix count of lines to skip

Problem reported by Jakub Martisko (Bug#35002).
* gzexe.in (skip): Bump from 44 to 49.
---
 gzexe.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gzexe.in b/gzexe.in
index 8fca8c8..832cd07 100644
--- a/gzexe.in
+++ b/gzexe.in
@@ -145,7 +145,7 @@ for i do
   if test $decomp -eq 0; then
     (cat <<'EOF' &&
 #!/bin/sh
-skip=44
+skip=49
 
 tab='	'
 nl='
-- 
2.20.1

Subject: [Patch][BUG] Wrong skip value in gzexe
From: Jakub Martisko <[email-masked]>
To: [email-masked]
Date: Tue, 26 Mar 2019 13:41:06 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

the skip value in gzexe seems to be wrong since the [1] commit. See the
attached patch/test. The problem and its solution has been originaly
reported here [2] (Mentioning just for the credit sake).

Thanks,
Jakub

[1]: http://git.savannah.gnu.org/cgit/gzip.git/commit/?id=63aa2268a5abfed0116d04bbe3952e4a753af91d
[2]: https://bugzilla.redhat.com/show_bug.cgi?id=1690825
>From 21cd963565a43dabd59516bd4cca5c76a614f255 Mon Sep 17 00:00:00 2001
From: Jakub Martisko <[email-masked]>
Date: Tue, 26 Mar 2019 12:29:30 +0100
Subject: [PATCH] Fix: the value of the skip variable in the gzexe

---
 gzexe.in          |  4 ++--
 tests/Makefile.am |  1 +
 tests/gzexe       | 20 ++++++++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100755 tests/gzexe

diff --git a/gzexe.in b/gzexe.in
index 6c61183..cffa84e 100644
--- a/gzexe.in
+++ b/gzexe.in
@@ -145,7 +145,7 @@ for i do
   if test $decomp -eq 0; then
     (cat <<'EOF' &&
 #!/bin/sh
-skip=44
+skip=49
 
 tab='	'
 nl='
@@ -201,7 +201,7 @@ EOF
 
   else
     # decompression
-    skip=44
+    skip=49
     skip_line=`sed -e 1d -e 2q "$file"`
     case $skip_line in
     skip=[0-9] | skip=[0-9][0-9] | skip=[0-9][0-9][0-9])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ebdce5b..4dfbccf 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,6 +15,7 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 TESTS =					\
+	gzexe				\
   gzip-env				\
   helin-segv				\
   help-version				\
diff --git a/tests/gzexe b/tests/gzexe
new file mode 100755
index 0000000..45f71c7
--- /dev/null
+++ b/tests/gzexe
@@ -0,0 +1,20 @@
+#!/bin/sh
+#Try running simple shell script compressed by gzexe
+
+. "${srcdir=.}/init.sh"; path_prepend_ ..
+
+cat <<EOF > foo || framework_failure_
+#!/bin/sh
+echo "Hello World!"
+EOF
+
+echo "Hello World!" > exp || framework_failure_
+
+fail=0
+gzexe foo || fail=1
+/bin/sh foo > out 2> err || fail=1
+
+compare exp out || fail=1
+test -s err && fail=1
+
+Exit $fail
-- 
2.21.0