Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Args to 'system' not evaluated before forking, making $$ wrong #14489

Closed
p5pRT opened this issue Feb 9, 2015 · 39 comments
Closed

Args to 'system' not evaluated before forking, making $$ wrong #14489

p5pRT opened this issue Feb 9, 2015 · 39 comments

Comments

@p5pRT
Copy link

p5pRT commented Feb 9, 2015

Migrated from rt.perl.org#123775 (status was 'open')

Searchable as RT123775$

@p5pRT
Copy link
Author

p5pRT commented Feb 9, 2015

From @jimav

This is a bug report for perl from jim.avera@​gmail.com,
generated with the help of perlbug 1.40 running under perl 5.20.1.

The original problem which led me to this was​:

  system "ps","-p",$$,"-o","pid,etime,bsdtime,c,rss"; # always shows wrong values

The problem appears to be that $$ is not correct when passed to system().
I'm guessing it evaluates to the pid of an internaly-created child process.

Can 'system' (and any other forking operators) be made to
evaluate their arguments *before* forking?

#!/usr/bin/perl
use strict; use warnings;

my $copy_of_pid = $$;
print "Perl process is $$\n";

system "/bin/echo", 'echo​: $$ =', $$;
system "/bin/echo", 'echo​: $copy_of_pid =', $copy_of_pid;


Flags​:
  category=core
  severity=low


Site configuration information for perl 5.20.1​:

Configured by Debian Project at Fri Oct 10 14​:16​:26 UTC 2014.

Summary of my perl5 (revision 5 version 20 subversion 1) configuration​:
 
  Platform​:
  osname=linux, osvers=3.2.0-37-generic, archname=x86_64-linux-gnu-thread-multi
  uname='linux batsu 3.2.0-37-generic #58-ubuntu smp thu jan 24 15​:28​:10 utc 2013 x86_64 x86_64 x86_64 gnulinux '
  config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Dldflags= -Wl,-Bsymbolic-functions -Wl,-z,relro -Dlddlflags=-shared -Wl,-Bsymbolic-functions -Wl,-z,relro -Dcccdlflags=-fPIC -Darchname=x86_64-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.20 -Darchlib=/usr/lib/x86_64-linux-gnu/perl/5.20 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/x86_64-linux-gnu/perl5/5.20 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.20.1 -Dsitearch=/usr/local/lib/x86_64-linux-gnu/perl/5.20.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Duse64bitint -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -Ui_libutil -Uversiononly -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -Dlibperl=libperl.so.5.20.1 -des'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=define, usemultiplicity=define
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  optimize='-O2 -g',
  cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include'
  ccversion='', gccversion='4.9.1', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
  libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt
  perllibs=-ldl -lm -lpthread -lc -lcrypt
  libc=libc-2.19.so, so=so, useshrplib=true, libperl=libperl.so.5.20
  gnulibc_version='2.19'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
  cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib -fstack-protector'

Locally applied patches​:
  DEBPKG​:debian/cpan_definstalldirs - Provide a sensible INSTALLDIRS default for modules installed from CPAN.
  DEBPKG​:debian/db_file_ver - http​://bugs.debian.org/340047 Remove overly restrictive DB_File version check.
  DEBPKG​:debian/doc_info - Replace generic man(1) instructions with Debian-specific information.
  DEBPKG​:debian/enc2xs_inc - http​://bugs.debian.org/290336 Tweak enc2xs to follow symlinks and ignore missing @​INC directories.
  DEBPKG​:debian/errno_ver - http​://bugs.debian.org/343351 Remove Errno version check due to upgrade problems with long-running processes.
  DEBPKG​:debian/libperl_embed_doc - http​://bugs.debian.org/186778 Note that libperl-dev package is required for embedded linking
  DEBPKG​:fixes/respect_umask - Respect umask during installation
  DEBPKG​:debian/writable_site_dirs - Set umask approproately for site install directories
  DEBPKG​:debian/extutils_set_libperl_path - EU​:MM​: set location of libperl.a under /usr/lib
  DEBPKG​:debian/no_packlist_perllocal - Don't install .packlist or perllocal.pod for perl or vendor
  DEBPKG​:debian/prefix_changes - Fiddle with *PREFIX and variables written to the makefile
  DEBPKG​:debian/fakeroot - Postpone LD_LIBRARY_PATH evaluation to the binary targets.
  DEBPKG​:debian/instmodsh_doc - Debian policy doesn't install .packlist files for core or vendor.
  DEBPKG​:debian/ld_run_path - Remove standard libs from LD_RUN_PATH as per Debian policy.
  DEBPKG​:debian/libnet_config_path - Set location of libnet.cfg to /etc/perl/Net as /usr may not be writable.
  DEBPKG​:debian/mod_paths - Tweak @​INC ordering for Debian
  DEBPKG​:debian/module_build_man_extensions - http​://bugs.debian.org/479460 Adjust Module​::Build manual page extensions for the Debian Perl policy
  DEBPKG​:debian/prune_libs - http​://bugs.debian.org/128355 Prune the list of libraries wanted to what we actually need.
  DEBPKG​:fixes/net_smtp_docs - [rt.cpan.org #36038] http​://bugs.debian.org/100195 Document the Net​::SMTP 'Port' option
  DEBPKG​:debian/perlivp - http​://bugs.debian.org/510895 Make perlivp skip include directories in /usr/local
  DEBPKG​:debian/deprecate-with-apt - http​://bugs.debian.org/747628 Point users to Debian packages of deprecated core modules
  DEBPKG​:debian/squelch-locale-warnings - http​://bugs.debian.org/508764 Squelch locale warnings in Debian package maintainer scripts
  DEBPKG​:debian/skip-upstream-git-tests - Skip tests specific to the upstream Git repository
  DEBPKG​:debian/patchlevel - http​://bugs.debian.org/567489 List packaged patches for 5.20.1-1 in patchlevel.h
  DEBPKG​:debian/skip-kfreebsd-crash - http​://bugs.debian.org/628493 [perl #96272] Skip a crashing test case in t/op/threads.t on GNU/kFreeBSD
  DEBPKG​:fixes/document_makemaker_ccflags - http​://bugs.debian.org/628522 [rt.cpan.org #68613] Document that CCFLAGS should include $Config{ccflags}
  DEBPKG​:debian/find_html2text - http​://bugs.debian.org/640479 Configure CPAN​::Distribution with correct name of html2text
  DEBPKG​:debian/perl5db-x-terminal-emulator.patch - http​://bugs.debian.org/668490 Invoke x-terminal-emulator rather than xterm in perl5db.pl
  DEBPKG​:debian/cpan-missing-site-dirs - http​://bugs.debian.org/688842 Fix CPAN​::FirstTime defaults with nonexisting site dirs if a parent is writable
  DEBPKG​:fixes/memoize_storable_nstore - [rt.cpan.org #77790] http​://bugs.debian.org/587650 Memoize​::Storable​: respect 'nstore' option not respected
  DEBPKG​:debian/regen-skip - Skip a regeneration check in unrelated git repositories
  DEBPKG​:fixes/regcomp-mips-optim - [perl #122817] http​://bugs.debian.org/754054 Downgrade the optimization of regcomp.c on mips and mipsel due to a gcc-4.9 bug
  DEBPKG​:debian/makemaker-pasthru - http​://bugs.debian.org/758471 Pass LD settings through to subdirectories
  DEBPKG​:fixes/perldoc-less-R - [rt.cpan.org #98636] http​://bugs.debian.org/758689 Tell the 'less' pager to allow terminal escape sequences
  DEBPKG​:fixes/hurd_test_todo_socket.t - [perl #122657] http​://bugs.debian.org/758718 Disable failing GNU/Hurd test in t/io/socket.t
  DEBPKG​:fixes/pod_man_reproducible_date - http​://bugs.debian.org/759405 Support POD_MAN_DATE in Pod​::Man for the left-hand footer
  DEBPKG​:fixes/data_dump_infinite_recurse - [19be3be] don't recurse infinitely in Data​::Dumper


@​INC for perl 5.20.1​:
  /home/jima/lib/perl
  /home/jima/perl5/lib/perl5/x86_64-linux-gnu-thread-multi
  /home/jima/perl5/lib/perl5/x86_64-linux-gnu-thread-multi
  /home/jima/perl5/lib/perl5
  /etc/perl
  /usr/local/lib/x86_64-linux-gnu/perl/5.20.1
  /usr/local/share/perl/5.20.1
  /usr/lib/x86_64-linux-gnu/perl5/5.20
  /usr/share/perl5
  /usr/lib/x86_64-linux-gnu/perl/5.20
  /usr/share/perl/5.20
  /usr/local/lib/site_perl
  .


Environment for perl 5.20.1​:
  HOME=/home/jima
  LANG=en_US.UTF-8
  LANGUAGE=en_US
  LD_LIBRARY_PATH=/home/jima/local/lib
  LOGDIR (unset)
  PATH=/home/jima/perl5/bin​:/home/jima/bin​:/home/jima/local/bin​:/home/jima/jima_tools/x86_64/bin​:/home/jima/jima_tools/bin​:/opt/Adobe/Reader9/bin​:/usr/bin​:/bin​:/usr/sbin​:/sbin​:/usr/bin/X11​:/usr/local/sbin​:/usr/games​:/usr/local/games​:/usr/lib/jvm/java-7-oracle/bin​:/usr/lib/jvm/java-7-oracle/db/bin​:/usr/lib/jvm/java-7-oracle/jre/bin​:.
  PERL5LIB=/home/jima/lib/perl​:/home/jima/perl5/lib/perl5/x86_64-linux-gnu-thread-multi​:/home/jima/perl5/lib/perl5
  PERL_BADLANG (unset)
  PERL_LOCAL_LIB_ROOT=/home/jima/perl5
  PERL_MB_OPT=--install_base /home/jima/perl5
  PERL_MM_OPT=INSTALL_BASE=/home/jima/perl5
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Feb 11, 2015

From @iabyn

On Mon, Feb 09, 2015 at 01​:56​:59PM -0800, via RT wrote​:

The original problem which led me to this was​:

system "ps","-p",$$,"-o","pid,etime,bsdtime,c,rss"; # always shows wrong values

The problem appears to be that $$ is not correct when passed to system().
I'm guessing it evaluates to the pid of an internaly-created child process.

Can 'system' (and any other forking operators) be made to
evaluate their arguments *before* forking?

That will also affect things like tied vars, which are currently also
evaluated in the child​:

  sub TIESCALAR { bless [] }
  sub FETCH { print "FETCH​: pid=$$\n"; 1 }
  my $x;
  tie $x, 'main';
  print "parent​: pid=$$\n";
  system "echo", "child​: x=", $x;

which outputs​:

  parent​: pid=4773
  FETCH​: pid=4774
  child​: x= 1

I suspect that evaluating in the parent is The Right Thing to Do, but
worry about backwards compatibility.

--
A walk of a thousand miles begins with a single step...
then continues for another 1,999,999 or so.

@p5pRT
Copy link
Author

p5pRT commented Feb 11, 2015

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Feb 12, 2015

From @karenetheridge

On Wed Feb 11 03​:36​:20 2015, davem wrote​:

I suspect that evaluating in the parent is The Right Thing to Do, but
worry about backwards compatibility.

Agreed on both points.

If the status quo is kept (for now or forever), a documentation note should be added for any variable whose value will differ between processes (I can't think of any besides $$, but maybe some whose lexical scope is significant?)

@p5pRT
Copy link
Author

p5pRT commented Feb 12, 2015

From @ikegami

The workaround is to replace

system(..., $$, ...)

with

system(..., "$$", ...)

@p5pRT
Copy link
Author

p5pRT commented Feb 12, 2015

From @jimav

The workaround is ... system(..., "$$", ...)
Thanks. 0+$$ works too. But the problem is a "hidden gotcha" -- the
behavior is not what a reasonable programmer would expect. It would be
better to get rid of the non-obvious behavior if it's not necessary.

@p5pRT
Copy link
Author

p5pRT commented Feb 13, 2015

From @rjbs

* Dave Mitchell <davem@​iabyn.com> [2015-02-11T06​:28​:48]

I suspect that evaluating in the parent is The Right Thing to Do, but
worry about backwards compatibility.

Same here. We could try making this change in 5.23, but my further worry is
that code that would be affected by this is not going to be tested CPAN code,
but private daemons hidden away. :-/

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented Feb 13, 2015

From chwagner@gmti.gannett.com

This is a confirmed regression introduced with making $$ magic in 5.16. This could also affect any other command that interprets its arguments post fork(). The cheapest fix is probably to make all fork()'ing statements copy the argument list before the fork().

$ perl -le 'print "$^V $$"; system "echo", $$'
v5.14.4 8628
8628

@p5pRT
Copy link
Author

p5pRT commented Feb 13, 2015

From @Leont

On Mon, Feb 9, 2015 at 10​:56 PM, via RT <perlbug-followup@​perl.org> wrote​:

The original problem which led me to this was​:

system "ps","-p",$$,"-o","pid,etime,bsdtime,c,rss"; # always shows
wrong values

The problem appears to be that $$ is not correct when passed to system().
I'm guessing it evaluates to the pid of an internaly-created child process.

Can 'system' (and any other forking operators) be made to
evaluate their arguments *before* forking?

#!/usr/bin/perl
use strict; use warnings;

my $copy_of_pid = $$;
print "Perl process is $$\n";

system "/bin/echo", 'echo​: $$ =', $$;
system "/bin/echo", 'echo​: $copy_of_pid =', $copy_of_pid;

Fix attached.

Leon

@p5pRT
Copy link
Author

p5pRT commented Feb 13, 2015

From @Leont

0001-Evaluate-get-magic-in-system-and-openpipe-before-the.patch
From 14e44794d6597318abed388a8614f5f28eb91389 Mon Sep 17 00:00:00 2001
From: Leon Timmermans <fawaka@gmail.com>
Date: Sat, 14 Feb 2015 00:37:18 +0100
Subject: [PATCH] Evaluate get magic in system and openpipe before the fork

---
 doio.c      |  2 +-
 mathoms.c   |  4 ++++
 pp_sys.c    |  6 ++++++
 t/op/exec.t | 20 +++++++++++++++++++-
 util.c      |  7 +++++++
 5 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/doio.c b/doio.c
index a63f2a2..dc4de86 100644
--- a/doio.c
+++ b/doio.c
@@ -1544,7 +1544,7 @@ Perl_do_aexec5(pTHX_ SV *really, SV **mark, SV **sp,
 
 	while (++mark <= sp) {
 	    if (*mark)
-		*a++ = SvPV_nolen_const(*mark);
+		*a++ = SvPV_nomg_nolen(*mark);
 	    else
 		*a++ = "";
 	}
diff --git a/mathoms.c b/mathoms.c
index 2a65fb4..6ad8eb3 100644
--- a/mathoms.c
+++ b/mathoms.c
@@ -713,8 +713,12 @@ Perl_do_binmode(pTHX_ PerlIO *fp, int iotype, int mode)
 bool
 Perl_do_aexec(pTHX_ SV *really, SV **mark, SV **sp)
 {
+    SV** current;
     PERL_ARGS_ASSERT_DO_AEXEC;
 
+    for (current = mark + 1; current <= SP; current++) {
+	SvGETMAGIC(*current);
+    }
     return do_aexec5(really, mark, sp, 0, 0);
 }
 #endif
diff --git a/pp_sys.c b/pp_sys.c
index e2f8edf..7e4ff61 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -4259,6 +4259,12 @@ PP(pp_system)
 	MARK = ORIGMARK;
 	TAINT_PROPER("system");
     }
+    else {
+	while (++MARK <= SP) {
+	    (void)SvGETMAGIC(*MARK);      /* For get magic */
+	}
+	MARK = ORIGMARK;
+    }
     PERL_FLUSHALL_FOR_CHILD;
 #if (defined(HAS_FORK) || defined(AMIGAOS)) && !defined(VMS) && !defined(OS2) || defined(PERL_MICRO)
     {
diff --git a/t/op/exec.t b/t/op/exec.t
index 6ec3646..e7ef923 100644
--- a/t/op/exec.t
+++ b/t/op/exec.t
@@ -36,7 +36,7 @@ $ENV{LANGUAGE} = 'C';		# Ditto in GNU.
 my $Is_VMS   = $^O eq 'VMS';
 my $Is_Win32 = $^O eq 'MSWin32';
 
-plan(tests => 24);
+plan(tests => 26);
 
 my $Perl = which_perl();
 
@@ -153,6 +153,24 @@ TODO: {
         "exec failure doesn't terminate process");
 }
 
+SKIP: {
+    skip 'Doesn\'t work on Windows/VMS', 2 if $Is_VMS || $Is_Win32;
+    open my $fh, '-|', 'echo', $$;
+    my $pid = <$fh>;
+    chomp $pid;
+    is($pid, $$, 'Pid is as expected in openpipe');
+
+    skip 'Can\'t load POSIX' if not eval { require POSIX };
+    if (my $child = open my $fh, '-|') {
+	my $pid = <$fh>;
+	chomp $pid;
+	is($pid, $child, 'Pid is as expected in system');
+    } else {
+	system 'echo', $$;
+	POSIX::_exit(0);
+    }
+}
+
 my $test = curr_test();
 exec $Perl, '-le', qq{${quote}print 'ok $test - exec PROG, LIST'${quote}};
 fail("This should never be reached if the exec() worked");
diff --git a/util.c b/util.c
index 9ffdbde..ebd3ab4 100644
--- a/util.c
+++ b/util.c
@@ -2349,6 +2349,13 @@ Perl_my_popen_list(pTHX_ const char *mode, int n, SV **args)
     /* Try for another pipe pair for error return */
     if (PerlProc_pipe(pp) >= 0)
 	did_pipes = 1;
+
+    {
+	SV** current;
+	for (current = args; current <= args-1+n; current++) {
+	    SvGETMAGIC(*current);
+	}
+    }
     while ((pid = PerlProc_fork()) < 0) {
 	if (errno != EAGAIN) {
 	    PerlLIO_close(p[This]);
-- 
2.2.0-369-g3b010e3

@p5pRT
Copy link
Author

p5pRT commented Feb 14, 2015

From @jkeenan

On Fri Feb 13 15​:40​:38 2015, LeonT wrote​:

On Mon, Feb 9, 2015 at 10​:56 PM, via RT <perlbug-followup@​perl.org>
wrote​:

The original problem which led me to this was​:

system "ps","-p",$$,"-o","pid,etime,bsdtime,c,rss"; # always shows
wrong values

The problem appears to be that $$ is not correct when passed to
system().
I'm guessing it evaluates to the pid of an internaly-created child
process.

Can 'system' (and any other forking operators) be made to
evaluate their arguments *before* forking?

#!/usr/bin/perl
use strict; use warnings;

my $copy_of_pid = $$;
print "Perl process is $$\n";

system "/bin/echo", 'echo​: $$ =', $$;
system "/bin/echo", 'echo​: $copy_of_pid =', $copy_of_pid;

Fix attached.

Leon

In the parts of the patch where you are adding lines to source code or tests, could you use space characters rather than hard-tabs for leading whitespace, so as to make the appearance tidier?

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Feb 14, 2015

From @Leont

On Wed, Feb 11, 2015 at 12​:28 PM, Dave Mitchell <davem@​iabyn.com> wrote​:

I suspect that evaluating in the parent is The Right Thing to Do, but
worry about backwards compatibility.

The issue didn't exist until 5.16
(0e21945), and frankly I see no reason to
do this deliberately. I don't think we have a serious backwards
compatibility issue here.

Leon

@p5pRT
Copy link
Author

p5pRT commented Feb 14, 2015

From @Leont

On Sat, Feb 14, 2015 at 1​:02 AM, James E Keenan via RT <
perlbug-followup@​perl.org> wrote​:

On Fri Feb 13 15​:40​:38 2015, LeonT wrote​:

On Mon, Feb 9, 2015 at 10​:56 PM, via RT <perlbug-followup@​perl.org>
wrote​:

The original problem which led me to this was​:

system "ps","-p",$$,"-o","pid,etime,bsdtime,c,rss"; # always shows
wrong values

The problem appears to be that $$ is not correct when passed to
system().
I'm guessing it evaluates to the pid of an internaly-created child
process.

Can 'system' (and any other forking operators) be made to
evaluate their arguments *before* forking?

#!/usr/bin/perl
use strict; use warnings;

my $copy_of_pid = $$;
print "Perl process is $$\n";

system "/bin/echo", 'echo​: $$ =', $$;
system "/bin/echo", 'echo​: $copy_of_pid =', $copy_of_pid;

Fix attached.

Leon

In the parts of the patch where you are adding lines to source code or
tests, could you use space characters rather than hard-tabs for leading
whitespace, so as to make the appearance tidier?

Perl's source consistently uses a convention of tabstop=8 and
soft-tabstop=4, which is like "indent 4 spaces, but replace every 8 spaces
with a tab". I'm quite sure space- and tab-lovers alike are not
particularly fond of this mixed use whitespace, but it's a bit late to
change that for the entire codebase. I had actually paid attention to be
consistent (the testfile doesn't have a modeline).

Leon

@p5pRT
Copy link
Author

p5pRT commented Feb 14, 2015

From @khwilliamson

On 02/13/2015 05​:15 PM, Leon Timmermans wrote​:

Perl's source consistently uses a convention of tabstop=8 and
soft-tabstop=4, which is like "indent 4 spaces, but replace every 8
spaces with a tab". I'm quite sure space- and tab-lovers alike are not
particularly fond of this mixed use whitespace, but it's a bit late to
change that for the entire codebase. I had actually paid attention to be
consistent (the testfile doesn't have a modeline).

That is out-of-date. All new code should use spaces exclusively.

@p5pRT
Copy link
Author

p5pRT commented Feb 14, 2015

From @Leont

On Sat, Feb 14, 2015 at 1​:32 AM, Karl Williamson <public@​khwilliamson.com>
wrote​:

That is out-of-date. All new code should use spaces exclusively.

In that case, updated.

Leon

@p5pRT
Copy link
Author

p5pRT commented Feb 14, 2015

From @Leont

0001-Evaluate-get-magic-in-system-and-openpipe-before-the.patch
From 14e44794d6597318abed388a8614f5f28eb91389 Mon Sep 17 00:00:00 2001
From: Leon Timmermans <fawaka@gmail.com>
Date: Sat, 14 Feb 2015 00:37:18 +0100
Subject: [PATCH] Evaluate get magic in system and openpipe before the fork

---
 doio.c      |  2 +-
 mathoms.c   |  4 ++++
 pp_sys.c    |  6 ++++++
 t/op/exec.t | 20 +++++++++++++++++++-
 util.c      |  7 +++++++
 5 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/doio.c b/doio.c
index a63f2a2..dc4de86 100644
--- a/doio.c
+++ b/doio.c
@@ -1544,7 +1544,7 @@ Perl_do_aexec5(pTHX_ SV *really, SV **mark, SV **sp,
 
 	while (++mark <= sp) {
 	    if (*mark)
-		*a++ = SvPV_nolen_const(*mark);
+        *a++ = SvPV_nomg_nolen(*mark);
 	    else
 		*a++ = "";
 	}
diff --git a/mathoms.c b/mathoms.c
index 2a65fb4..6ad8eb3 100644
--- a/mathoms.c
+++ b/mathoms.c
@@ -713,8 +713,12 @@ Perl_do_binmode(pTHX_ PerlIO *fp, int iotype, int mode)
 bool
 Perl_do_aexec(pTHX_ SV *really, SV **mark, SV **sp)
 {
+    SV** current;
     PERL_ARGS_ASSERT_DO_AEXEC;
 
+    for (current = mark + 1; current <= SP; current++) {
+        SvGETMAGIC(*current);
+    }
     return do_aexec5(really, mark, sp, 0, 0);
 }
 #endif
diff --git a/pp_sys.c b/pp_sys.c
index e2f8edf..7e4ff61 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -4259,6 +4259,12 @@ PP(pp_system)
 	MARK = ORIGMARK;
 	TAINT_PROPER("system");
     }
+    else {
+        while (++MARK <= SP) {
+            (void)SvGETMAGIC(*MARK);      /* For get magic */
+        }
+        MARK = ORIGMARK;
+    }
     PERL_FLUSHALL_FOR_CHILD;
 #if (defined(HAS_FORK) || defined(AMIGAOS)) && !defined(VMS) && !defined(OS2) || defined(PERL_MICRO)
     {
diff --git a/t/op/exec.t b/t/op/exec.t
index 6ec3646..e7ef923 100644
--- a/t/op/exec.t
+++ b/t/op/exec.t
@@ -36,7 +36,7 @@ $ENV{LANGUAGE} = 'C';		# Ditto in GNU.
 my $Is_VMS   = $^O eq 'VMS';
 my $Is_Win32 = $^O eq 'MSWin32';
 
-plan(tests => 24);
+plan(tests => 26);
 
 my $Perl = which_perl();
 
@@ -153,6 +153,24 @@ TODO: {
         "exec failure doesn't terminate process");
 }
 
+SKIP: {
+    skip 'Doesn\'t work on Windows/VMS', 2 if $Is_VMS || $Is_Win32;
+    open my $fh, '-|', 'echo', $$;
+    my $pid = <$fh>;
+    chomp $pid;
+    is($pid, $$, 'Pid is as expected in openpipe');
+
+    skip 'Can\'t load POSIX' if not eval { require POSIX };
+    if (my $child = open my $fh, '-|') {
+        my $pid = <$fh>;
+        chomp $pid;
+        is($pid, $child, 'Pid is as expected in system');
+    } else {
+        system 'echo', $$;
+        POSIX::_exit(0);
+    }
+}
+
 my $test = curr_test();
 exec $Perl, '-le', qq{${quote}print 'ok $test - exec PROG, LIST'${quote}};
 fail("This should never be reached if the exec() worked");
diff --git a/util.c b/util.c
index 9ffdbde..ebd3ab4 100644
--- a/util.c
+++ b/util.c
@@ -2349,6 +2349,13 @@ Perl_my_popen_list(pTHX_ const char *mode, int n, SV **args)
     /* Try for another pipe pair for error return */
     if (PerlProc_pipe(pp) >= 0)
 	did_pipes = 1;
+
+    {
+        SV** current;
+        for (current = args; current <= args-1+n; current++) {
+            SvGETMAGIC(*current);
+        }
+    }
     while ((pid = PerlProc_fork()) < 0) {
 	if (errno != EAGAIN) {
 	    PerlLIO_close(p[This]);
-- 
2.2.0-369-g3b010e3

@p5pRT
Copy link
Author

p5pRT commented Feb 14, 2015

From @jkeenan

On Fri Feb 13 16​:46​:53 2015, LeonT wrote​:

On Sat, Feb 14, 2015 at 1​:32 AM, Karl Williamson <public@​khwilliamson.com>
wrote​:

That is out-of-date. All new code should use spaces exclusively.

In that case, updated.

Leon

Thank you very much. Now, can we get comments on the *content* of Leon's patch (which is beyond my skill set to evaluate)?

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Feb 14, 2015

From wagnerc@plebeian.com

I would like to lobby for evaluating all of the arguments that are not literal strings before the fork. True, $PID is the scenario at hand but there could be any number of cases down the road. The other obvious example is anything tie()'d. Spooky action at a distance is bad and I think the expected behavior of anything passed to system(), etc, is to be the value of the expression at that line of the program. I can think of one secenario where a tie variable returns memory information about the current process. Definately do not want that in the forked copy. Forgive me if I didn't see that in the proposed patch.

For the test case, I have a better suggestion. It will work on any system.

<code>
+ my $rv = system $Perl, '-e', 'exit ($ARGV[0] eq $$)', $$;
+ is($rv, 0, 'Pid is as expected in system');
+
+ skip 'Can\'t load POSIX' if not eval { require POSIX };
+ if (my $child = open my $fh, '-|') { #parent
+ my $pid = <$fh>;
+ is($pid, $child, 'Pid is as expected in openpipe');
+ }
+ else { #child
+ system $Perl, '-e', 'print $ARGV[0]', $$;
+ POSIX​::_exit(0);
+ }
</code>

@p5pRT
Copy link
Author

p5pRT commented Feb 14, 2015

From @demerphq

On 14 February 2015 at 08​:55, James E Keenan via RT
<perlbug-followup@​perl.org> wrote​:

On Fri Feb 13 16​:46​:53 2015, LeonT wrote​:

On Sat, Feb 14, 2015 at 1​:32 AM, Karl Williamson <public@​khwilliamson.com>
wrote​:

That is out-of-date. All new code should use spaces exclusively.

In that case, updated.

Leon

Thank you very much. Now, can we get comments on the *content* of Leon's patch (which is beyond my skill set to evaluate)?

He is just magic sure we call GETMAGIC on the arguments, which is
quite reasonable IMO.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

@p5pRT
Copy link
Author

p5pRT commented Feb 14, 2015

From @leonerd

On Fri, 13 Feb 2015 16​:55​:04 -0800
"James E Keenan via RT" <perlbug-followup@​perl.org> wrote​:

Thank you very much. Now, can we get comments on the *content* of
Leon's patch (which is beyond my skill set to evaluate)?

LGTM

--
Paul "LeoNerd" Evans

leonerd@​leonerd.org.uk
http​://www.leonerd.org.uk/ | https://metacpan.org/author/PEVANS

@p5pRT
Copy link
Author

p5pRT commented Feb 15, 2015

From @Leont

On Sat, Feb 14, 2015 at 5​:47 AM, Chris Wagner via RT <
perlbug-followup@​perl.org> wrote​:

I would like to lobby for evaluating all of the arguments that are not
literal strings before the fork. True, $PID is the scenario at hand but
there could be any number of cases down the road. The other obvious
example is anything tie()'d. Spooky action at a distance is bad and I
think the expected behavior of anything passed to system(), etc, is to be
the value of the expression at that line of the program. I can think of
one secenario where a tie variable returns memory information about the
current process. Definately do not want that in the forked copy. Forgive
me if I didn't see that in the proposed patch.

That is already what the patch does.

For the test case, I have a better suggestion. It will work on any system.

<code>
+ my $rv = system $Perl, '-e', 'exit ($ARGV[0] eq $$)', $$;
+ is($rv, 0, 'Pid is as expected in system');

That test was about testing the list form of openpipe, it has the same
issue that system has (because it's a similar but not identical operation).
While the inverted logic is slightly confusing, it may provide a portable
replacement for the second test though.

I was probably too careful, I suspect my version also works on Windows when
using bleadperl (actually, AFAIK this was never broken there). VMS doesn't
seem to have echo, so making it «$Perl, '-e', 'print $ARGV[0]'» may make
sense. Or I guess «'Write', 'Sys$Output'», supposably.

+ skip 'Can\'t load POSIX' if not eval { require POSIX };
+ if (my $child = open my $fh, '-|') { #parent
+ my $pid = <$fh>;
+ is($pid, $child, 'Pid is as expected in openpipe');
+ }
+ else { #child
+ system $Perl, '-e', 'print $ARGV[0]', $$;
+ POSIX​::_exit(0);
+ }
</code>

I would still expect that to run into pseudothreads on Windows, but I
haven't tested either version on Windows yet.

Leon

@p5pRT
Copy link
Author

p5pRT commented Feb 15, 2015

From @Leont

0002-Simplify-system-tests.patch
From c2d16f4e6465f8bfd392400a80c816ac90dc1dfe Mon Sep 17 00:00:00 2001
From: Leon Timmermans <fawaka@gmail.com>
Date: Sat, 14 Feb 2015 15:43:07 +0100
Subject: [PATCH 2/2] Simplify system $$ tests

---
 t/op/exec.t | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/t/op/exec.t b/t/op/exec.t
index d5ec32e..f26b8fd 100644
--- a/t/op/exec.t
+++ b/t/op/exec.t
@@ -153,22 +153,14 @@ TODO: {
         "exec failure doesn't terminate process");
 }
 
-SKIP: {
-    skip 'Doesn\'t work on Windows/VMS', 2 if $Is_VMS || $Is_Win32;
-    open my $fh, '-|', 'echo', $$;
+{
+    my @echo = $Is_VMS ? ($Perl, '-le', 'print $ARGV[0]') : 'echo';
+    open my $fh, '-|', @echo, $$;
     my $pid = <$fh>;
     chomp $pid;
     is($pid, $$, 'Pid is as expected in openpipe');
 
-    skip 'Can\'t load POSIX' if not eval { require POSIX };
-    if (my $child = open my $fh, '-|') {
-        my $pid = <$fh>;
-        chomp $pid;
-        is($pid, $child, 'Pid is as expected in system');
-    } else {
-        system 'echo', $$;
-        POSIX::_exit(0);
-    }
+    ok(!system($Perl, '-e', 'exit ($ARGV[0] eq $$)', $$), 'Pid is as expected in system');
 }
 
 my $test = curr_test();
-- 
2.2.0-369-g3b010e3

@p5pRT
Copy link
Author

p5pRT commented Feb 16, 2015

From chwagner@gmti.gannett.com

On Sat Feb 14 17​:10​:11 2015, LeonT wrote​:

I would still expect that to run into pseudothreads on Windows, but I
haven't tested either version on Windows yet.

Leon

The problem on Windows is likely masked by the pseudo-fork. It prints the "right pid". I verified that two Perl processes get made with the right pids in TaskInfo.

C​:\>perl -le "print qq/$^V\nparent pid $$/; system qw/perl -le/, q/print qq{passed pid $ARGV[0]\nchild pid $$}/, $$;"
v5.20.0
parent pid 12060
passed pid 12060
child pid 13764

This can be elucidated with the following fork example.
C​:\>perl -le "print qq/start pid $$/; if ($p=fork) { print qq/parent p `$p` pid $$/; sleep 10; } else { print qq/child p `$p` pid $$/; sleep 10; } "
start pid 6928
parent p `-9540` pid 6928
child p `0` pid -9540

This pid is negative and there is only ever one Perl process in TaskInfo. So I would say that any improper symbol evaluation is taking place in the 2nd thread. This could still be a problem depending on what is behind a tie()'d variable.

I've come up with this command line that could serve as a universal test case for system() atleast. Change the quotation marks for Unix of course.
perl -le "print qq/$^V\nparent pid $$/; system qw/perl -le/, q/print qq{passed pid $ARGV[0]\nchild pid $$}/, $$;"

Does GETMAGIC cause FETCH to be executed on tie()'d variables?

Thanks.

@p5pRT
Copy link
Author

p5pRT commented Feb 17, 2015

From @tonycoz

On Mon, Feb 16, 2015 at 09​:23​:51AM -0800, Chris Wagner via RT wrote​:

On Sat Feb 14 17​:10​:11 2015, LeonT wrote​:

I would still expect that to run into pseudothreads on Windows, but I
haven't tested either version on Windows yet.

Leon

The problem on Windows is likely masked by the pseudo-fork. It prints the "right pid". I verified that two Perl processes get made with the right pids in TaskInfo.

system() on Win32 doesn't use fork() of any sort.

Tony

@p5pRT
Copy link
Author

p5pRT commented Feb 17, 2015

From @Leont

On Mon, Feb 16, 2015 at 6​:23 PM, Chris Wagner via RT <
perlbug-followup@​perl.org> wrote​:

On Sat Feb 14 17​:10​:11 2015, LeonT wrote​:

I would still expect that to run into pseudothreads on Windows, but I
haven't tested either version on Windows yet.

Leon

The problem on Windows is likely masked by the pseudo-fork. It prints the
"right pid". I verified that two Perl processes get made with the right
pids in TaskInfo.

C​:\>perl -le "print qq/$^V\nparent pid $$/; system qw/perl -le/, q/print
qq{passed pid $ARGV[0]\nchild pid $$}/, $$;"
v5.20.0
parent pid 12060
passed pid 12060
child pid 13764

This can be elucidated with the following fork example.
C​:\>perl -le "print qq/start pid $$/; if ($p=fork) { print qq/parent p
`$p` pid $$/; sleep 10; } else { print qq/child p `$p` pid $$/; sleep 10; }
"
start pid 6928
parent p `-9540` pid 6928
child p `0` pid -9540

This pid is negative and there is only ever one Perl process in TaskInfo.
So I would say that any improper symbol evaluation is taking place in the
2nd thread. This could still be a problem depending on what is behind a
tie()'d variable.

That is exactly what I'd expect.

I've come up with this command line that could serve as a universal test
case for system() atleast. Change the quotation marks for Unix of course.
perl -le "print qq/$^V\nparent pid $$/; system qw/perl -le/, q/print
qq{passed pid $ARGV[0]\nchild pid $$}/, $$;"

I'm not completely sure I understand. Are you saying my second patch isn't
working on Windows?

Does GETMAGIC cause FETCH to be executed on tie()'d variables?

Yes.

Leon

@p5pRT
Copy link
Author

p5pRT commented Feb 17, 2015

From chwagner@gmti.gannett.com

On Tue Feb 17 08​:28​:33 2015, LeonT wrote​:

I'm not completely sure I understand. Are you saying my second patch
isn't working on Windows?

What I was mainly talking about was the Windows command prompt. Apostrophe quoting doesn't work. It must be quotation marks. Nothing to do with the t file test case.

Tony indicated that system() does not use the fork() mechanism on Windows. So that might need a completely seperate patch. Or it could be unaffected.

@p5pRT
Copy link
Author

p5pRT commented Feb 17, 2015

From @avar

On Sat, Feb 14, 2015 at 1​:03 AM, Leon Timmermans <fawaka@​gmail.com> wrote​:

On Wed, Feb 11, 2015 at 12​:28 PM, Dave Mitchell <davem@​iabyn.com> wrote​:

I suspect that evaluating in the parent is The Right Thing to Do, but
worry about backwards compatibility.

The issue didn't exist until 5.16
(0e21945), and frankly I see no reason to
do this deliberately. I don't think we have a serious backwards
compatibility issue here.

That commit was followed-up by my 985213f, which in theory has the
same issue, but with the arbitrary magic GET of this patch any issues
in that wolud be fixed. In any case I can't see a way to make a plain
system() call change the user running the process WRT the argument
list.

@p5pRT
Copy link
Author

p5pRT commented Feb 18, 2015

From @tonycoz

On Fri Feb 13 16​:46​:53 2015, LeonT wrote​:

On Sat, Feb 14, 2015 at 1​:32 AM, Karl Williamson <public@​khwilliamson.com>
wrote​:

That is out-of-date. All new code should use spaces exclusively.

In that case, updated.

Inline Patch
diff --git a/doio.c b/doio.c
index a63f2a2..dc4de86 100644
--- a/doio.c
+++ b/doio.c
@@ -1544,7 +1544,7 @@ Perl_do_aexec5(pTHX_ SV *really, SV **mark, SV **sp,
-		*a++ = SvPV_nolen_const(*mark);
+        *a++ = SvPV_nomg_nolen(*mark);
diff --git a/mathoms.c b/mathoms.c
index 2a65fb4..6ad8eb3 100644
--- a/mathoms.c
+++ b/mathoms.c
@@ -713,8 +713,12 @@ Perl_do_binmode(pTHX_ PerlIO *fp, int iotype, int mode)

+    for (current = mark + 1; current <= SP; current++) {
+        SvGETMAGIC(*current);
+    }
diff --git a/pp_sys.c b/pp_sys.c
index e2f8edf..7e4ff61 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -4259,6 +4259,12 @@ PP(pp_system)
+    else {
+        while (++MARK <= SP) {
+            (void)SvGETMAGIC(*MARK);      /* For get magic */
+        }
+        MARK = ORIGMARK;
+    }

Do we care about overloading? It isn't triggered by SvGETMAGIC() and will still be happening in the child\.

Around Tue Feb 17 10​:57​:01 2015 Chris Wagner said​:

Tony indicated that system() does not use the fork() mechanism on Windows. So
that might need a completely seperate patch. Or it could be unaffected.

system() on Win32 evaluates all of the arguments in the parent process and
(eventually) uses CreateProcess() to create the child.

The same is true of the newer list form pipe open implementation.

If you're seeing this problem on Windows, there's something unrelated going on.

Around Sat Feb 14 17​:10​:11 2015 Leon Timmermans said​:

On Sat, Feb 14, 2015 at 5​:47 AM, Chris Wagner via RT <
perlbug-followup@​perl.org> wrote​:

+ skip 'Can\'t load POSIX' if not eval { require POSIX };
+ if (my $child = open my $fh, '-|') { #parent
+ my $pid = <$fh>;
+ is($pid, $child, 'Pid is as expected in openpipe');
+ }
+ else { #child
+ system $Perl, '-e', 'print $ARGV[0]', $$;
+ POSIX​::_exit(0);
+ }
</code>

I would still expect that to run into pseudothreads on Windows, but I
haven't tested either version on Windows yet.

Windows doesn't handle "-|" with no arguments as a fork (it attempts to
run the "-" program), so it's not an issue.

@p5pRT
Copy link
Author

p5pRT commented Mar 4, 2015

From @Leont

On Wed, Feb 18, 2015 at 4​:46 AM, Tony Cook via RT <perlbug-followup@​perl.org

wrote​:

On Fri Feb 13 16​:46​:53 2015, LeonT wrote​:

On Sat, Feb 14, 2015 at 1​:32 AM, Karl Williamson <
public@​khwilliamson.com>
wrote​:

That is out-of-date. All new code should use spaces exclusively.

In that case, updated.

diff --git a/doio.c b/doio.c
index a63f2a2..dc4de86 100644
--- a/doio.c
+++ b/doio.c
@​@​ -1544,7 +1544,7 @​@​ Perl_do_aexec5(pTHX_ SV *really, SV **mark, SV **sp,
- *a++ = SvPV_nolen_const(*mark);
+ *a++ = SvPV_nomg_nolen(*mark);
diff --git a/mathoms.c b/mathoms.c
index 2a65fb4..6ad8eb3 100644
--- a/mathoms.c
+++ b/mathoms.c
@​@​ -713,8 +713,12 @​@​ Perl_do_binmode(pTHX_ PerlIO *fp, int iotype, int
mode)

+ for (current = mark + 1; current <= SP; current++) {
+ SvGETMAGIC(*current);
+ }
diff --git a/pp_sys.c b/pp_sys.c
index e2f8edf..7e4ff61 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@​@​ -4259,6 +4259,12 @​@​ PP(pp_system)
+ else {
+ while (++MARK <= SP) {
+ (void)SvGETMAGIC(*MARK); /* For get magic */
+ }
+ MARK = ORIGMARK;
+ }

Do we care about overloading? It isn't triggered by SvGETMAGIC()
and will still be happening in the child.

Good point. I suspect the clean way out of this is to rethink do_aexec5 to
just take char** arguments.

Leon

@p5pRT
Copy link
Author

p5pRT commented Oct 8, 2015

From chrjae@gmail.com

This issue is also being discussed on the london.pm mailing list​:

https://groups.perlists.pm/sympa/arc/london.pm/2015-10/msg00003.html

@p5pRT
Copy link
Author

p5pRT commented Oct 8, 2015

From chrjae@gmail.com

This issue is also being discussed on the london.pm mailing list​:

https://groups.perlists.pm/sympa/arc/london.pm/2015-10/msg00003.html

@p5pRT
Copy link
Author

p5pRT commented Oct 9, 2015

From @wolfsage

This looks like a duplicate of
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=123775 (and I see they've
already been merged together).

Thanks,

-- Matthew Horsfall (alh)

@exodist
Copy link
Contributor

exodist commented Sep 3, 2020

This appears to have been fixed in recent perl versions, though not intentionally.

@jkeenan
Copy link
Contributor

jkeenan commented Sep 3, 2020

This appears to have been fixed in recent perl versions, though not intentionally.

How would I know that it has been fixed?

$ perlbrew use perl-5.20.3
$ perl -e 'system "ps","-p",$$,"-o","pid,etime,bsdtime,c,rss";'
  PID     ELAPSED   TIME  C   RSS
 6022       00:00   0:00  0  1528
$ perlbrew use perl-5.32.0
$ perl -e 'system "ps","-p",$$,"-o","pid,etime,bsdtime,c,rss";'
  PID     ELAPSED   TIME  C   RSS
 6031       00:00   0:00  0  4132

@exodist
Copy link
Contributor

exodist commented Sep 3, 2020

I wrote this tester:








print "PARENT PID: $$\n";                                                                                                
system('echo', "CHILD  GOT:", $$);

Simcop on #perl ran it across multiple perl versions:

https://m.perl.bot/p/gtlbev

As can be seen in that paste, it broke around 5.16, then was fixed around 5.28.2

@jkeenan jkeenan added the Closable? We might be able to close this ticket, but we need to check with the reporter label Sep 4, 2020
@jkeenan
Copy link
Contributor

jkeenan commented Sep 4, 2020

I wrote this tester:








print "PARENT PID: $$\n";                                                                                                
system('echo', "CHILD  GOT:", $$);

Simcop on #perl ran it across multiple perl versions:

https://m.perl.bot/p/gtlbev

As can be seen in that paste, it broke around 5.16, then was fixed around 5.28.2

Bisection points to this commit:

64def2aeaeb63f92dadc6dfa33486c1d7b311963 is the first bad commit
commit 64def2aeaeb63f92dadc6dfa33486c1d7b311963
Author: Zefram <zefram@fysh.org>
Date:   Sat Dec 16 05:33:20 2017 +0000

    perform system() arg processing before fork
    
    A lot of things can happen when stringifying an argument list: side
    effects, warnings, exceptions.  In the case of system(), these effects
    should happen in the context of the parent process.  The stringification
    can also depend on which process it happens in, as in the case of
    $$, and in that case it should also happen in the parent process.
    Therefore reduce the argument scalars to strings first thing in pp_system.
    Fixes [perl #121105].

Which suggests perhaps it was the same problem as in #13561.

Is this ticket now closable?

Thank you very much.
Jim Keenan

@Grinnz
Copy link
Contributor

Grinnz commented Sep 4, 2020

It does appear that commit thoroughly fixed the issue, it even fixes stringification overloads in the argument list: https://perl.bot/p/fxsfj4

@jkeenan jkeenan removed the Closable? We might be able to close this ticket, but we need to check with the reporter label Sep 4, 2020
@jkeenan jkeenan closed this as completed Sep 4, 2020
@karenetheridge
Copy link
Member

karenetheridge commented Sep 4, 2020

This should be added to perldeltas -- both the pod/perlXXXXdelta.pod that corresponds to the version the fix was in, and also pod/perldelta.pod (for the next blead-point release) in the "Errata From Previous Releases" section.

@Grinnz
Copy link
Contributor

Grinnz commented Sep 4, 2020

This is briefly mentioned in https://perldoc.pl/perl5280delta#Selected-Bug-Fixes:

system now reduces its arguments to strings in the parent process, so any effects of stringifying them (such as overload methods being called or warnings being emitted) are visible in the way the program expects. [perl #121105]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants