Bug#916313: perl: open "|command" does not set up child process's stdin correctly on perl 5.28 (5.24 is OK)

Zygo Blaxell zblaxell at qnx.com
Wed Dec 12 21:54:22 GMT 2018


Package: perl
Version: 5.28.1-3
Severity: normal

Dear Maintainer,

The following one-line perl script fails:

	perl -e 'close(STDIN); open(CHILD, "|wc -l")'

On Debian stable (5.24.1-3+deb9u5) it produces:

	$ perl -e 'close(STDIN); open(CHILD, "|wc -l")'
	0

but on Debian testing/unstable (5.28.1-1, 5.28.1-3) it produces:

	$ perl -e 'close(STDIN); open(CHILD, "|wc -l")'
	wc: 'standard input': Bad file descriptor
	0
	wc: -: Bad file descriptor

Other variants of open to a command
(e.g. open(CHILD, "-|") || exec ...) are similarly broken if STDIN is closed.

This wreaks havoc on Perl filter scripts that pass data between child
shell commands: the commands unexpectedly get EBADF when reading from
stdin, or they unexpectedly use one of the other files they open as
their stdin.

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?

Noticed Perl scripts operating incorrectly after upgrading Perl packages
to Debian testing (apt-get -uf install perl -t testing) or unstable.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

Reverted to snapshot of root filesystem with earlier Perl version.

   * What was the outcome of this action?

Everything works again.

   * What outcome did you expect instead?

No regression on a core Perl feature.

*** End of the template - remove these template lines ***


-- System Information:
Debian Release: 9.6
  APT prefers stable
  APT policy: (500, 'stable'), (189, 'testing'), (179, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.14.71-zb64+ (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: sysvinit (via /sbin/init)

Versions of packages perl depends on:
ii  dpkg               1.18.25
ii  libperl5.28        5.28.1-3
ii  perl-base          5.28.1-3
ii  perl-modules-5.28  5.28.1-3

Versions of packages perl recommends:
ii  netbase  5.4

Versions of packages perl suggests:
pn  libb-debug-perl                           <none>
ii  libterm-readline-gnu-perl                 1.35-4+b1
ii  libterm-readline-perl-perl                1.0303-1
ii  make                                      4.1-9.1
ii  perl-doc                                  5.28.1-1
ii  perl-modules-5.24 [liblocale-codes-perl]  5.24.1-3+deb9u5

-- no debconf information




More information about the Perl-maintainers mailing list