This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Perl system() function works sometimes.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]