Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jan 2024 15:56:12 GMT
From:      Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= <des@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ab215565c81a - stable/13 - Fix test output when gzip is run with -tlv
Message-ID:  <202401171556.40HFuCIQ009765@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=ab215565c81a0dc1f97635cc0647084ad1480ba3

commit ab215565c81a0dc1f97635cc0647084ad1480ba3
Author:     Tom Jones <thj@FreeBSD.org>
AuthorDate: 2022-01-27 17:17:13 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2024-01-17 15:52:02 +0000

    Fix test output when gzip is run with -tlv
    
    When run with test, verbose and list we need to parse the file otherwise
    the test output is "NOT OK" even for the file is valid.
    
    Reviewed by:    kevans, allanjude, imp
    Sponsored by:   Klara Inc.
    Differential Revision:  https://reviews.freebsd.org/D34046
    
    (cherry picked from commit 21c966a6b9f2e9110b8dc2a822ad2b4583f4f18b)
---
 usr.bin/gzip/gzip.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/usr.bin/gzip/gzip.c b/usr.bin/gzip/gzip.c
index 95525f99b881..a21039aeb59c 100644
--- a/usr.bin/gzip/gzip.c
+++ b/usr.bin/gzip/gzip.c
@@ -1654,10 +1654,13 @@ file_uncompress(char *file, char *outfile, size_t outsize)
 	case FT_XZ:
 		if (lflag) {
 			size = unxz_len(fd);
-			print_list_out(in_size, size, file);
-			return -1;
-		}
-		size = unxz(fd, zfd, NULL, 0, NULL);
+			if (!tflag) {
+				print_list_out(in_size, size, file);
+				close(fd);
+				return -1;
+			}
+		} else
+			size = unxz(fd, zfd, NULL, 0, NULL);
 		break;
 #endif
 
@@ -1682,8 +1685,10 @@ file_uncompress(char *file, char *outfile, size_t outsize)
 	default:
 		if (lflag) {
 			print_list(fd, in_size, outfile, isb.st_mtime);
-			close(fd);
-			return -1;	/* XXX */
+			if (!tflag) {
+				close(fd);
+				return -1;	/* XXX */
+			}
 		}
 
 		size = gz_uncompress(fd, zfd, NULL, 0, NULL, file);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401171556.40HFuCIQ009765>