-
Notifications
You must be signed in to change notification settings - Fork 561
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
system() does not return -1 in low-memory situations #15890
Comments
From srezic@cpan.orgThis is a bug report for perl from srezic@cpan.org, If system() fails because there's not enough memory, then the This can be reproduced with the following script (call with #!/usr/bin/perl use strict; my $alloc_gb = shift || 4; my $mb = " " x 1024**2; system 'echo', 'system() was successful'; __END__ The problem can be reproduced on travis-ci instances. See the Regards, Flags: Site configuration information for perl 5.22.2: Configured by slaven.rezic at Fri May 13 10:07:27 CEST 2016. Summary of my perl5 (revision 5 version 22 subversion 2) configuration: @INC for perl 5.22.2: Environment for perl 5.22.2: |
From @tonycozOn Fri, 24 Feb 2017 08:26:03 -0800, srezic@cpan.org wrote:
I'm not really set up to test this, but the attached sets $? on the path where Tony |
From @tonycoz0001-perl-130853-ensure-system-sets-even-if-fork-fails.patchFrom f4c92c68052e313ebfb6c7bc48081ece7492ffdf Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 27 Feb 2017 14:23:34 +1100
Subject: (perl #130853) ensure system() sets $? even if fork() fails
The documentation implies $? is always set.
---
pp_sys.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/pp_sys.c b/pp_sys.c
index 7a57035..6ccaad7 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -4397,6 +4397,7 @@ PP(pp_system)
PerlLIO_close(pp[0]);
PerlLIO_close(pp[1]);
}
+ STATUS_NATIVE_CHILD_SET(value);
#ifdef HAS_SIGPROCMASK
sigprocmask(SIG_SETMASK, &oldset, NULL);
#endif
--
2.1.4
|
The RT System itself - Status changed from 'new' to 'open' |
From @eserteDana Sun, 26 Feb 2017 19:26:14 -0800, tonyc reče:
Yes, this fixes the problem. Unpatched perl: $ perl5.25.9 /tmp/mem.pl 8 Patched on top of fe7d7ed: $ ./perl -Ilib /tmp/mem.pl 8 |
Migrated from rt.perl.org#130853 (status was 'open')
Searchable as RT130853$
The text was updated successfully, but these errors were encountered: