Subject: pkg/26351: When tnftp on Linux is interrupted, Linux shell doesn't catch signal.
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <ogi@fmi.uni-sofia.bg>
List: pkgsrc-bugs
Date: 07/17/2004 06:09:31
>Number:         26351
>Category:       pkg
>Synopsis:       When tnftp on Linux is interrupted, Linux shell doesn't catch signal.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 17 08:34:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Ognyan Kulev
>Release:        Debian GNU/Linux testing
>Organization:
Faculty of Mathematics and Informatics, University of Sofia
>Environment:
Linux batman 2.4.18-bf2.4 #1 Son Apr 14 09:53:28 CEST 2002 i686 GNU/Linux
>Description:
Latest pkgsrc is installed.  Let's run this example in Linux shell (bash) and interrupt it:

while :; do date; sleep 1; done

Hitting Ctrl-C interrupts it.

Let's run this (uses tnftp):

while :; do rm welcome.msg; ftp ftp://ftp.uni-sofia.bg/welcome.msg; done

This time Ctrl-C doesn't help.

This behavious affects bmake fetch and is very inconvenient.

I've looked at the code and it seems that tnftp turns SIGINT into normal exit code (1).  I've run strace and shell receives SIGINT, but looking at exit code of exited child it just continues.
>How-To-Repeat:
On Linux shell, type this:

while :; do rm welcome.msg; ftp ftp://ftp.uni-sofia.bg/welcome.msg; done

Type Ctrl-C and the loop won't stop.

(If you press and hold Ctrl-C, you have a chance to catch a moment when ftp is not running and the loop will interrupt.)
>Fix:
In Single Unix Specification, exit codes greater that 128 shall be used when process is terminated by signal: see last paragraph in http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_08_02
>Release-Note:
>Audit-Trail:
>Unformatted: