delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/01/30/21:35:07

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_CZ
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <OFBDCA45BA.1562BC85-ON88257996.0006E2AF-88257996.0009D64B@us.ibm.com>
References: <201201272150 DOT q0RLoW6A030621 AT fumar DOT sanjose DOT ibm DOT com> <CAHiT=DH+CZAxXZn3bBF3fFnU-HNaC=jzs9VnKAtAQi+MpGwOvw AT mail DOT gmail DOT com> <OFC255D9D8 DOT B30A86FF-ON88257995 DOT 00614BDA-88257995 DOT 0061923D AT us DOT ibm DOT com> <CAHiT=DE-ja0iAxb5MdE3QZRc-Ro-RcZfaZnAEj2quAfspdJiGg AT mail DOT gmail DOT com> <OFBDCA45BA DOT 1562BC85-ON88257996 DOT 0006E2AF-88257996 DOT 0009D64B AT us DOT ibm DOT com>
Date: Mon, 30 Jan 2012 20:34:40 -0600
Message-ID: <CAHiT=DEL9v9wBGin_34BHgTt5Qz9m0RU9ShSkb9ccUMYTVakiA@mail.gmail.com>
Subject: Re: Perl system() function works sometimes.
From: Reini Urban <rurban AT x-ray DOT at>
To: Gary E Barnes <gebarnes AT us DOT ibm DOT com>
Cc: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q0V2Z0Pc025278

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

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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019