Bug#1028275: perl: Return value of system()

Niko Tyni ntyni at debian.org
Mon Jan 9 19:35:52 GMT 2023


Control: forwarded -1 https://github.com/Perl/perl5/issues/19020
Control: block -1 with 436466

On Sun, Jan 08, 2023 at 08:49:49PM -0800, David Christensen wrote:
> Package: perl
> Version: 5.32.1-4+deb11u2
> Severity: normal
> X-Debbugs-Cc: dpchrist at holgerdanske.com

> not ok 4 - signal-child_error-system.t 24 $?(33024) == SIGHUP(1)
> #   Failed test 'signal-child_error-system.t 24 $?(33024) == SIGHUP(1)'
> #   at signal-child_error-system.t line 24.
> #          got: '33024'
> #     expected: '1'

Hi, this is about a difference in bash vs. dash as /bin/sh.

Perl runs the single arg form of system() through /bin/sh, and when that
shell is dash (as it is by default on Debian), the child perl gets forked
rather than execed in the shell process (like bash does.)

The signal information is then consumed by dash and never reaches the
parent perl process.

There's a Perl upstream discussion about this in
  https://github.com/Perl/perl5/issues/19020
and it looks like dash upstream is nowadays doing the exec() thing
but Debian dash is carrying a patch to disable that. See #436466.

Not much we can do about this on the perl side apart from configuring
perl to always use /bin/bash as the intermediate shell. I'm not thrilled
about that option and would much rather see the dash behaviour changed.

Workarounds I can see are calling system() in list form so the shell
doesn't get invoked, or locally changing /bin/sh to point to bash.
-- 
Niko Tyni   ntyni at debian.org




More information about the Perl-maintainers mailing list