Subject: Re: Perl system() function works sometimes.
From: Gary E Barnes <[email-masked]>
To: Reini Urban <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Mon, 30 Jan 2012 17:47:28 -0800
List-Id: <cygwin.cygwin.com>

I'm confused about what you are talking about.  In particular the "perl 
within perl" part.  I have a perl script.  It puts together shell commands 
and tries to run them using the system() call.  There is no perl calling 
perl so far as I know. 

The script has worked fine for about two years on three machines.  Now 
suddenly it doesn't work on any of them.  I'm hoping that someone has an 
idea.  It may not have anything whatsoever to do with perl as such.  That 
is just where I am seeing the problem.

"There is not enough DLL space."  Interesting, I wasn't aware it was a 
limited resource as such (modulo those inherent in 32-bit addressing).  Is 
there a way to determine what DLL space is in use at a given moment and 
what program(s) are using it?  When I'm running this script the machine is 
a completely idle as I can make it.  It is running only those things I 
have no way to turn off, like anti-virus.  Could this problem be "just" 
that I need to find even more things to halt before running the script?

My main questions are: 
  1) What could possibly have changed?  I mean on the computer.  I don't 
think all of our copies of Cygwin have changed recently.  So some other 
DLL(s) changed perhaps?  Got bigger?
  2) Is there some way to truly diagnose this problem?  How would I go 
about it?

I might be able to rearrange things so that I could call system with a 
list of strings most of the time.  However simple things like this,

      system ("scp machine:remote.file local.file");

have started failing where they've never failed before.  My "perl -e" 
examples were just minimal-failing-programs that I discovered while trying 
to diagnose the problem.  The script is no longer capable of getting to 
the more complicated stuff such as:

    system ("((tar czf - ...... ; echo $? >/tmp/status) | ssh machine 'cat 
- > remote.file) ; exit `cat /tmp/status`'");

I don't think things like that can be turned into a list of string 
arguments.  I really do need to invoke a subshell (or do a great deal of 
process piping on my own).

Would it help reduce DLL space usage if I wrote the commands out to a file 
and ran the file as a shell script underneath Perl? 

        Gary

On Mon, Jan 30, 2012 at 11:45 AM, Gary E Barnes wrote:
> I have tried perlrebase and also rebaseall.  I tried deleting cygwin 
from
> the machine and reinstalling from scratch.
> None of that fixes the problem.  If it is some sort of rebase problem 
then
> the usual tools don't fix it.
>
> And from what you said about calling execve when there are no 
interesting
> shell redirections, it would appear
> that perl calling system() simply doesn't work at all for some reason.

Yes, it failed with a rebaseall-related fork failure because you used 
system
with the system sh-wrapper. If you call it as list you wouldn't see this 
error.

Yes, Calling perl within perl within perl will lead to memory conflicts.
This a known problem we will have to live for a while unfortunately.
There's not enough DLL space. Even less the more apps are loaded.
Yes, this is fragile.

That's why I recommended not to use system with strings.
-- 
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