From 037e47981374fc72ea76b9b71e150b4786cc3ca6 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 31 Jul 2025 10:59:03 +0200 Subject: gpgtar: Fix regression in end-of-archive detection. * tools/gpgtar-extract.c (gpgtar_extract): Detect end-of-archive and break loop. * tools/gpgtar-list.c (gpgtar_list): Ditto. Also do not print "running failed" if the exitcode is 0. -- GnuPG-bug-id: 7757 In the old code (gnupg 2.4) we did not call gnupg_release_process when cleaning up the gpg process and thus it could keep on running and deliver its output to the status-fd. The new code does a gnupg_release_process which sends a SIGTERM to a not yet terminated process and thus the output was cut off. --- tools/gpgtar-extract.c | 2 ++ tools/gpgtar-list.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/gpgtar-extract.c b/tools/gpgtar-extract.c index 5ec22e8f7..55a517220 100644 --- a/tools/gpgtar-extract.c +++ b/tools/gpgtar-extract.c @@ -525,6 +525,8 @@ gpgtar_extract (const char *filename, int decrypt) for (;;) { err = gpgtar_read_header (stream, tarinfo, &header, &extheader); + if (!err && !header) + break; /* End of archive. */ if (err || header == NULL) goto leave; diff --git a/tools/gpgtar-list.c b/tools/gpgtar-list.c index 07056575d..14a77bb33 100644 --- a/tools/gpgtar-list.c +++ b/tools/gpgtar-list.c @@ -559,6 +559,8 @@ gpgtar_list (const char *filename, int decrypt) for (;;) { err = read_header (stream, tarinfo, &header, &extheader); + if (!err && !header) + break; /* End of archive. */ if (err || header == NULL) goto leave; @@ -585,8 +587,9 @@ gpgtar_list (const char *filename, int decrypt) int exitcode; gpgrt_process_ctl (proc, GPGRT_PROCESS_GET_EXIT_ID, &exitcode); - log_error ("running %s failed (exitcode=%d): %s", - opt.gpg_program, exitcode, gpg_strerror (err)); + if (exitcode) + log_error ("running %s failed (exitcode=%d): %s", + opt.gpg_program, exitcode, gpg_strerror (err)); } gpgrt_process_release (proc); proc = NULL; -- cgit v1.2.3