This queue is for tickets about the CPAN CPAN distribution.

Report information
The Basics
Id:
107353
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
cavac [...] cavac.at
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
2.14

Attachments


Subject: CPAN shell crashes on SIGWINCH signal during module installation
While installing modules, the CPAN shell is suseptible to SIGWINCH Unix signal (window size change). This has been tested on ActivePerl 5.20 as well as a freshly compiled perl 5.22 (compiled with all the defaults to a custom path, as described on http://www.cpan.org/src/ The client is Xubuntu 14.04 x64, latest updates installed, tested with the "Terminal" application and xterm. Tested locally and via SSH. After installation of the newly compiled Perl, all modules where upgraded with the "upgrade" command. Then i installed Term::ReadLine::Perl installed to make history work (which should work in the default install BTW...). I also installed Bundle::CPAN. The bug is easy to reproduce: $ cpan
Show quoted text
cpan> install some_large_package
Resize the window while the installation is running and it crashed with: Signal SIGWINCH received, but no signal handler set. I tried a few other things as well, see attached chatlog file with Corion on Perlmonks. I realize it's not a very critical bug, but it's very annoying if you can't rearrange your terminal windows while installing a module with 100+ dependencies.
Subject: perlmonks_sigwinch_chat.txt
[cavac] Having a bit of trouble with my cpan shell. [cavac] It always crashes when it gets a SIGWINCH signal (e.g. when the window resizes) [cavac] Any idea how to fix that? [Corion] cavac: Maybe Term::Readline is broken? But maybe that happened because something else is broken, like mixing XS modules from different versions of Perl? [Corion] An easy fix for disabling Term::Readline is to export TERM= (I think) [Corion] Also, there are Term::Readline-specific environment variables to influence its choice of backend [cavac] I just compiled a fresh version of perl from source (5.22) [Corion] Ah. export PERL_RL=0, according to Term::Readline [Corion] cavac: That feels weird. Are you sure it doesn't pick up other module paths? Inspect @INC [Corion] Maybe you have $ENV{PERL5LIB} set to some older/other version of Perl? [Corion] I find it unlikely that (say) Term::Readline would break but nothing else ;-) [Corion] Meh - Term::ReadLine [cavac] Nope, no (shell) environment variables regarding perl except PATH and MANPATH [cavac] Ok, just notices something interesting: [Corion] cavac: Hmmm - that sounds weird... So, maybe it is just Term::ReadLine. Or something in the Term:: namespace, because that's the only thing that I imagine that the cpan program loads which would react to $SIG{SIGWINCH} [cavac] cpan shell itself works when resizing the window, but as sone as i'm building a module (e.g. install something), the shell is suseptible to SIGWINCH during the install [Corion] cavac: Hmm - that sounds like (un)safe signals. Most likely, the perl running the cpan shell doesn't like getting a signal while running system(...) - still not nice. Did you compile with unsafe signals? [cavac] I compiled on linux/x64 with all the defaults except a custom path. [cavac] Just as it says to do it on cpan.org/src/ [Corion] cavac: Hmm - that would imply safe signals, which shouldn't cause you that kind of trouble. Weird. [cavac] Then i installed Bundle::CPAN and Term::Readline::Perl (to make history work which is also broken in the default install) [Corion] cavac: Maybe you can test something like ./perl -wle 'system(qq(kill -WINCH $$))' and see if that immediately crashes too? [cavac] Nope, get a command prompt [Corion] cavac: Hmm - maybe your GNU readline library is weird/wrong bitness/whatever, then? Does forcing Term::ReadLine to disable itself help? [cavac] My guess is it has something to do with Makemaker or Build.PL not handling the signal and somehow killing the parent. Maybe... [Corion] cavac: Sure but that shouldn't crash the parent ;) [cavac] When i set the environment variable as you said, didn't notice any difference at all. [cavac] Basically, i say "install somelargepackage" and resize the window. Then i get [cavac] Signal SIGWINCH received, but no signal handler set [Corion] cavac: Hmm. Yeah, maybe it should be set to 'IGNORE' or whatever... I try to avoid signals ;) [cavac] Well, i can exclude now the possibility that it's a problem with the shell. Tried it with different ones, local and via SSH. [cavac] Also tried it with an older ActiveState perl 5.20, same thing. [Corion] cavac: Hmm - then it is at least not a recent regression. "Don't do that" , then? ;-) [Corion] But my knowledge about how signals should behave with respect to child processes etc. is limited, so beyond that, I don't think I have good suggestions to make ;) [cavac] Well, with multi-tabbed consoles, the problem is: If i have two shells open (one running cpan) and i close the OTHER one, the first one running the cpan shell also gets SIGWINCH because the terminal emulator disables the tab bar and resizes the shell... [cavac] Where can i officially report this as a bug? (no mailing list, please) [Corion] cavac: just run the perlbug utility, or send mail to bugs-CPAN@rt.cpan.org, depending on whether you think it's a bug in Perl (signal handling) or in the CPAN shell (lack of signal handling) [Corion] The CPAN RT bug tracker also has a web interface if you're reluctant to send email :-) [cavac] Thanks, will do :-) [Corion] CPAN bug tracker [Corion] I would lean more towards CPAN than Perl as the bug recipient.
On 2015-09-26 10:05:13, CAVAC wrote:
Show quoted text
> While installing modules, the CPAN shell is suseptible to SIGWINCH > Unix signal (window size change). > > This has been tested on ActivePerl 5.20 as well as a freshly compiled > perl 5.22 (compiled with all the defaults to a custom path, as > described on http://www.cpan.org/src/ > > The client is Xubuntu 14.04 x64, latest updates installed, tested with > the "Terminal" application and xterm. Tested locally and via SSH. > > After installation of the newly compiled Perl, all modules where > upgraded with the "upgrade" command. Then i installed > Term::ReadLine::Perl installed to make history work (which should work > in the default install BTW...). > > I also installed Bundle::CPAN. > > The bug is easy to reproduce: > $ cpan >
> cpan> install some_large_package
> > Resize the window while the installation is running and it crashed > with: > > Signal SIGWINCH received, but no signal handler set. > > I tried a few other things as well, see attached chatlog file with > Corion on Perlmonks. > > I realize it's not a very critical bug, but it's very annoying if you > can't rearrange your terminal windows while installing a module with > 100+ dependencies.
I see this problem too. My workaround is to put the following line into the wrapper script before calling CPAN.pm: local $SIG{WINCH} = sub { warn "IGNORE SIGWINCH" };
Patched in 1993900. Thanks for the report!
Thanks for the report! Please consider removing your own workarounds, so you can test how well the cpan shell behaves with regard to window changes.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.