X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_GJ X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: <201201272150.q0RLoW6A030621@fumar.sanjose.ibm.com> References: <201201272150 DOT q0RLoW6A030621 AT fumar DOT sanjose DOT ibm DOT com> Date: Sat, 28 Jan 2012 12:22:43 -0600 Message-ID: Subject: Re: Perl system() function works sometimes. From: Reini Urban To: gebarnes AT us DOT ibm DOT com, cygwin AT cygwin DOT com Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q0SINAo1008264 On Fri, Jan 27, 2012 at 3:50 PM, Gary E. Barnes wrote: > perl -e 'system ("/bin/ls -l /tmp");'                   # still works > perl -e 'system ("/bin/ls -l /tmp > /tmp/xxx");'        # no longer works > perl -e 'system ("(/bin/ls -l /tmp>");'                 # no longer works > > Perl's system() function is just the Unix system() call.  The string > argument is a command line to execute.  The same commands work in a shell > script (/bin/sh, /bin/csh, and /bin/bash). You miss the important distinction: system indirectly via sh or directly without. perldoc -f system With a string argument without certain shell-redirections or with list it calls execve directly. "/bin/ls -l /tmp > /tmp/xxx" uses an intermediate sh call to execute, and this fails with an out of memory = rebase problem. > This is a sudden change of behavior we are seeing on our machines.  We have > several XP machines, some with old Cygwin installations and some with brand > new ones.  So I would hazard a guess that it is not due to any change in > Cygwin. rebaseall > Here is a log of what happens.  The call never seems to terminate.  I've > waited up to 15 minutes.  ^C does not work.  ^Z fortunately does.  The first > message (couldn't allocate) comes out after perhaps 15 seconds.  The second > message (wait failed) takes minutes to appear. > > ------------------------------------------------------------------------------ > xp-1: perl -e ' system ( "/bin/ls -l /tmp" ); ' > total 5 > -r-xr-x---+ 1 geb Users 2222 2007-10-15 18:37 XWin.log > -r-xr-x---+ 1 geb Users    0 2007-11-27 18:16 sh-thd-1196200453 > -rw-rw-r--+ 1 geb None   177 2012-01-27 12:50 xxx > xp-2: perl -e ' system ( "/bin/ls -l /tmp > /tmp/xxx" ); ' >     22 [main] sh 5216 C:\cygwin\bin\sh.exe: *** fatal error - couldn't allocate heap, Win32 error 487, base 0x970000, top 0x9B0000, reserve_size 258048, allocsize 262144, page_const 4096 >     33 [main] sh 4312 child_info::sync: wait failed, pid 5216, Win32 error 0 >    335 [main] sh 4312 fork: child -1 - died waiting for longjmp before initialization, retry 0, exit code 0x1000000, errno 11 >     22 [main] sh 4696 C:\cygwin\bin\sh.exe: *** fatal error - couldn't allocate heap, Win32 error 487, base 0x970000, top 0x9B0000, reserve_size 258048, allocsize 262144, page_const 4096 > 311004651 [main] sh 4312 child_info::sync: wait failed, pid 4696, Win32 error 0 > 311004816 [main] sh 4312 fork: child -1 - died waiting for longjmp before initialization, retry 0, exit code 0x1000000, errno 11 >     22 [main] sh 4700 C:\cygwin\bin\sh.exe: *** fatal error - couldn't allocate heap, Win32 error 487, base 0x970000, top 0x9B0000, reserve_size 258048, allocsize 262144, page_const 4096 > ^Z -- Reini Urban http://cpanel.net/   http://www.perl-compiler.org/ -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple