On Mon, 21 Jul 2014 00:19:33 +0200 Samuel Thibault <sthiba...@debian.org> wrote: > Package: dash > Version: 0.5.7-4 > Severity: normal > User: debian-h...@lists.debian.org > Usertags: hurd
> We have been having issues on hurd-i386 with the dash shell, we often > get "cannot create /dev/null: Interrupted system call" errors. With > research from Svante Signell, we have found that this is actually due > to a signal which unfortunately interrupts the open() call used by > dash to redirect some output. dash indeed does not set the SA_RESTART > flag when calling sigaction for SIGINT or SIGCHLD. There can probably > be other calls in dash that could get interrupted too. dash seems to > take care of at least some of them by handling EINTR, but it's much > safer to simply let the system handle all of them by setting > SA_RESTART. The attached patch does this, and fixes the issue on > hurd-i386, could you consider applying it? This breaks interrupting blocking redirection opens with ^C. Although relying on [EINTR] like this leaves a race window (where SIGINT arrives between the last check and the open blocking), if the open has blocked "long enough", SIGINT will make it fail with [EINTR]. In most cases, dash avoids this race by longjmp from the signal handler but for a blocking open that approach may leak the file descriptor. The cause of the regression is the SIGCHLD handler which is always enabled even if there is no SIGCHLD trap. It will probably help to use SA_RESTART for the SIGCHLD handler if there is no trap (therefore, setting a trap should disable SA_RESTART). In FreeBSD sh, another ash derivative, I have been even more careful, only enabling the SIGCHLD handler while it is needed (during a wait builtin). Apart from that, my FreeBSD/Linux-centric view says that opening /dev/null should not fail with [EINTR], just like a read or write from/to a regular file on a "normal" filesystem (an intr NFS mount is not normal). -- Jilles Tjoelker -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org