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 Mon, Jan 30, 2012 at 7:47 PM, Gary E Barnes wrote:
> 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.

Right. Sorry, I mixed that up.
system("scp machine:remote.file local.file"); calls
/bin/sh -c scp machine:remote.file local.file

system(qw(scp machine:remote.file local.file));
skips the /bin/sh part and executes scp directly.

> 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.

Because some DLL's use more memory and the perl DLL's have less room.

> "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?

perlrebase tells you the last perl dll base, and rebaseall tells you
the cygwin base.
They should not overlap, and there should be room below perl, or you
might have to kill apps taking this space or perlrebase with a higher
If you have no CPAN XS installations, rebaseall alone without
perlrebase is better.

BTW: With the new rebase package we keep a central database so there will be no
perl vs cygwin overlap. But I haven't finished the new perl package
yet which uses

> 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?

1. The OS got bigger. Esp. Win7 compared to XP.
2. You might be running more programs.
3. New services running?

> ?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).

Yes, that would be a lot of perl work to do that manually.
I prefer the shell to do that.

> 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?

This is what system(string) does already.
But you can try to put more into a shell script, so perl has less work.
I always prefer shell scripts over perl scripts, but sometimes one has
to bite the bullet and switch over.

> 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 ?

Problem reports:
Unsubscribe info:

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