GNU bug report logs - #74651
maint: fix s390 buffer flushes

Previous Next

Package: gzip;

Reported by: Eduard Stefes <eduard.stefes <at> ibm.com>

Date: Mon, 2 Dec 2024 14:56:03 UTC

Severity: normal

Merged with 75911, 75924

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74651 in the body.
You can then email your comments to 74651 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gzip <at> gnu.org:
bug#74651; Package gzip. (Mon, 02 Dec 2024 14:56:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eduard Stefes <eduard.stefes <at> ibm.com>:
New bug report received and forwarded. Copy sent to bug-gzip <at> gnu.org. (Mon, 02 Dec 2024 14:56:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eduard Stefes <eduard.stefes <at> ibm.com>
To: bug-gzip <bug-gzip <at> gnu.org>
Cc: Andreas Hasenack <andreas.hasenack <at> canonical.com>,
 Eduard Stefes <eduard.stefes <at> ibm.com>, Ilya Leoshkevich <iii <at> linux.ibm.com>
Subject: maint: fix s390 buffer flushes
Date: Mon,  2 Dec 2024 10:35:55 +0100
Problem reported by Nick Rosbrook in:
https://bugs.launchpad.net/ubuntu/+source/rsyslog/+bug/2083700

align the behavior of dfltcc_inflate to do the same as gzip_inflate
when it hits a premature EOF
---

Notes:
    Hi, the ubuntu folks found a problem with gzip on the ibm s390x
    architecture.
    ( https://bugs.launchpad.net/ubuntu/+source/rsyslog/+bug/2083700 )
    The dfltcc_inflate function will not flush the outbuffer in case it
    encounters a premature EOF.
    
    I changed the code to break and flush the buffers just like the regular
    implementation does.
    I also had to change the `hufts` test. For this special test-data the
    dfltcc decompression routine request more data instead of reporting a
    data--format error.

 dfltcc.c    | 2 +-
 tests/hufts | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dfltcc.c b/dfltcc.c
index 811c1f8..2a5b350 100644
--- a/dfltcc.c
+++ b/dfltcc.c
@@ -434,7 +434,7 @@ dfltcc_inflate ()
         flush_outbuf ();
       if (inptr == insize)
         {
-          if (fill_inbuf (1) == EOF)
+          if (fill_inbuf (0) == EOF)
             {
               /* Premature EOF.  */
               return 2;
diff --git a/tests/hufts b/tests/hufts
index c464ef6..6dbb8ac 100755
--- a/tests/hufts
+++ b/tests/hufts
@@ -40,10 +40,12 @@ compare exp err || fail=1
 
 printf '\037\213\010\000\060\060\060\060\060\060\144\000\000\000' > bug33501 \
   || framework_failure_
-printf '\ngzip: stdin: invalid compressed data--format violated\n' >exp33501 \
+printf '\ngzip: stdin: invalid compressed data--format violated\n' > exp33501.1 \
+  || framework_failure_
+printf '\ngzip: stdin: unexpected end of file\n' > exp33501.2 \
   || framework_failure_
 returns_ 1 gzip -d <bug33501 >out33501 2> err33501-raw || fail=1
 sed "$clean_stderr" err33501-raw > err33501 || framework_failure_
-compare exp33501 err33501 || fail=1
+compare exp33501.1 err33501 || compare exp33501.2 err33501 || fail=1
 
 Exit $fail
-- 
2.47.1





Information forwarded to bug-gzip <at> gnu.org:
bug#74651; Package gzip. (Tue, 28 Jan 2025 14:36:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eduard Stefes <Eduard.Stefes <at> ibm.com>
To: "bug-gzip <at> gnu.org" <bug-gzip <at> gnu.org>
Cc: Eduard Stefes <Eduard.Stefes <at> ibm.com>,
 "iii <at> linux.ibm.com" <iii <at> linux.ibm.com>,
 "andreas.hasenack <at> canonical.com" <andreas.hasenack <at> canonical.com>
Subject: Re: maint: fix s390 buffer flushes
Date: Tue, 28 Jan 2025 14:34:49 +0000
Hi,

After @AnderesHasenack tried to verify my patch, We found more problems
with the output buffer flushing in dfltcc_inflate in dfltcc.c. 

I wrote a new patch and Andreas verified it with the ubuntu rsyslog
build.[1]

I will send the patch to the ML here. 


[1]
https://launchpad.net/~ahasenack/+archive/ubuntu/rsyslog-apparmor/+build/29355576

On Mon, 2024-12-02 at 10:35 +0100, Eduard Stefes wrote:
> Problem reported by Nick Rosbrook in:
> https://bugs.launchpad.net/ubuntu/+source/rsyslog/+bug/2083700
> 
> align the behavior of dfltcc_inflate to do the same as gzip_inflate
> when it hits a premature EOF
> ---
> 
> Notes:
>     Hi, the ubuntu folks found a problem with gzip on the ibm s390x
>     architecture.
>     (
> https://bugs.launchpad.net/ubuntu/+source/rsyslog/+bug/2083700 )
>     The dfltcc_inflate function will not flush the outbuffer in case
> it
>     encounters a premature EOF.
>     
>     I changed the code to break and flush the buffers just like the
> regular
>     implementation does.
>     I also had to change the `hufts` test. For this special test-data
> the
>     dfltcc decompression routine request more data instead of
> reporting a
>     data--format error.
> 
>  dfltcc.c    | 2 +-
>  tests/hufts | 6 ++++--
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/dfltcc.c b/dfltcc.c
> index 811c1f8..2a5b350 100644
> --- a/dfltcc.c
> +++ b/dfltcc.c
> @@ -434,7 +434,7 @@ dfltcc_inflate ()
>          flush_outbuf ();
>        if (inptr == insize)
>          {
> -          if (fill_inbuf (1) == EOF)
> +          if (fill_inbuf (0) == EOF)
>              {
>                /* Premature EOF.  */
>                return 2;
> diff --git a/tests/hufts b/tests/hufts
> index c464ef6..6dbb8ac 100755
> --- a/tests/hufts
> +++ b/tests/hufts
> @@ -40,10 +40,12 @@ compare exp err || fail=1
>  
>  printf '\037\213\010\000\060\060\060\060\060\060\144\000\000\000' >
> bug33501 \
>    || framework_failure_
> -printf '\ngzip: stdin: invalid compressed data--format violated\n'
> >exp33501 \
> +printf '\ngzip: stdin: invalid compressed data--format violated\n' >
> exp33501.1 \
> +  || framework_failure_
> +printf '\ngzip: stdin: unexpected end of file\n' > exp33501.2 \
>    || framework_failure_
>  returns_ 1 gzip -d <bug33501 >out33501 2> err33501-raw || fail=1
>  sed "$clean_stderr" err33501-raw > err33501 || framework_failure_
> -compare exp33501 err33501 || fail=1
> +compare exp33501.1 err33501 || compare exp33501.2 err33501 || fail=1
>  
>  Exit $fail

-- 
Eduard Stefes <Eduard.Stefes <at> ibm.com>

Merged 74651 75911 75924. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Wed, 29 Jan 2025 19:02:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 07 May 2025 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 40 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.