#1144371 unzip: shell prompt remains on same line after SIGINT

Package:
unzip
Source:
unzip
Description:
De-archiver for .zip files
Submitter:
Adn Ehab Elkawass
Date:
2026-08-14 12:07:01 UTC
Severity:
normal
Tags:
#1144371#5
Date:
2026-08-14 09:14:40 UTC
From:
To:
When unzip is interrupted with Ctrl+C at an interactive replacement prompt, the shell prompt appears on the same line as ^C.

Steps to reproduce:

1. Create a file and archive it:

   tmpdir=$(mktemp -d)
   cd "$tmpdir"
   printf 'hello\n' > file.txt
   zip -q sample.zip file.txt

2. Run:

   unzip sample.zip

3. Press Ctrl+C at the replacement prompt.

The current output is:

replace file.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: ^Cuser@host:~$

The expected output is:

replace file.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: ^C
user@host:~$

The signal handler in fileio.c already contains code intended to add a newline. However, its compile-time condition excludes that code on systems defining SIGBUS or SIGSEGV, including Linux, regardless of the signal actually received.

The attached patch preserves the existing behavior on other systems and adds a runtime SIGINT branch when the original condition suppresses the newline.

The problem was originally reproduced with Ubuntu's unzip 6.0-29ubuntu1. I confirmed that the affected code is present in Debian's 6.0-31 source package.

Testing performed:

* Built successfully using the complete Debian patch series.
* Built the binary Debian package successfully with dpkg-buildpackage.
* Debian-profile Lintian completed with exit code 0.
* Confirmed that the shell prompt starts on a new line after Ctrl+C.
* Confirmed that the exit code remains 80.

#1144371#10
Date:
2026-08-14 10:16:28 UTC
From:
To:
Patch looks ok. Only question is whether this could ever trigger a double new line. Would need SIGINT to be defined and one or both of SIGBUS/SIGSEGV to be undefined.

For Debian and all other modern Linux systems I don't see that being a problem. Not sure if that is true for legacy/niche platforms.


diff --git a/fileio.c b/fileio.c
index ba0a1d0..aa3117d 100644
--- a/fileio.c
+++ b/fileio.c
@@ -1637,3 +1637,6 @@ void handler(signal)   /* upon interrupt, turn on echo and exit cleanly */
 #if !(defined(SIGBUS) || defined(SIGSEGV))      /* add a newline if not at */
     (*G.message)((zvoid *)&G, slide, 0L, 0x41); /*  start of line (to stderr; */
+#elif defined(SIGINT)
+    if (signal == SIGINT)
+        (*G.message)((zvoid *)&G, slide, 0L, 0x41);
 #endif

#1144371#15
Date:
2026-08-14 12:05:23 UTC
From:
To:
Misread the patch. It cannot result in a doble newline.

Santiago, the patch is good to go