On Tue, Nov 22, 2016 at 04:21:58PM +0100, Marc Espie wrote:
> I'm pretty sure you have something funky in your shell,
> I've been able to reproduce this finally.
>
> $ trap "" PIPE
> $ $ pkg_add -nuix screen-- 
> quirks-2.270 signed on 2016-11-21T13:44:48Z
> Error from 
> http://ftp.fr.openbsd.org/pub/OpenBSD/snapshots/packages/amd64/screen-4.0.3p6.tgz
> signify: write to stdout: Broken pipe
> Error from 
> http://ftp.fr.openbsd.org/pub/OpenBSD/snapshots/packages/amd64/screen-4.0.3p6-shm.tgz
> signify: write to stdout: Broken pipe
> 
> which is more or less what you see...
> 
> somehow you've got a shell with PIPE deleted, and perl inherits it...
> 

Thank you for investigating! I believe this is not caused by my shell
config, but the X window manager I use (spectrwm). My .profile is
standard except for setting PS1, EDITOR, PAGER, HISTFILE and some
aliases. Spectrwm on the other hand does signal(SIGPIPE, SIG_IGN) and
doesn't reset the signal handlers before spawning a terminal with
execvp(). That would explain why SIGPIPE is ignored in a plain xterm,
but not in the console and in tmux, which does clear the signals before
spawning a new process. Oh my.

> 
> So, let's make sure the signal is set correctly where it matters...
> 
> Martin, tell me whether this fixes your issue.

Yes, it does, thanks.


> 
> Index: OpenBSD/PackageRepository.pm
> ===================================================================
> RCS file: 
> /build/data/openbsd/cvs/src/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm,v
> retrieving revision 1.138
> diff -u -p -r1.138 PackageRepository.pm
> --- OpenBSD/PackageRepository.pm      5 Oct 2016 13:50:20 -0000       1.138
> +++ OpenBSD/PackageRepository.pm      22 Nov 2016 15:15:29 -0000
> @@ -239,6 +239,7 @@ sub open
>  
>       # kill old files if too many
>       my $already = $self->make_room;
> +     local $SIG{'PIPE'} = 'DEFAULT';
>       my $fh = $self->open_pipe($object);
>       if (!defined $fh) {
>               return;

Reply via email to