[go: up one dir, main page]

Menu

#1596 Perl *** couldn't commit memory for cygwin heap, Win32 error

MSYS
closed
None
Bug
out-of-date
Unknown
False
2018-12-12
2011-11-15
ozhiker
No

Hi

MinGW Perl seems to have a dependence on "sh" rather than "sh.exe" when executing external programs. This means that if the path contains both a windows "sh.exe" and a linux "sh", perl will attempt to execute the wrong one. This is a problem if, as I am you are attempting to make a toolchain that works both in windows and linux.

To recreate the problem:
* obtain http://ozhiker.com/mingw/test.zip
* unzip
* cd <unzip-dir>\test\bin\
* perl test.pl
-> Error message: <unzip-dir>\test\bin\perl.exe: *** couldn't commit memory for cygwin heap, Win32 error 0
* delete "test\bin\sh"
* perl test.pl
-> works as expected

Test system : Windows 7 - files from latest MinGW release

Discussion

  • Earnie Boyd

    Earnie Boyd - 2011-11-15

    I'm leaning toward won't fix but I'll give Chuck a chance to weigh in on the issue. It is expected that PATH is set such that it doesn't contain such a trap and the users environment is under the users control which isn't an issue for MinGW developers. We deliver MSYS such that the paths are set by the MSYS environment and if a user modifies his environment then it is the users responsibility to ensure that the added paths do not interfere with the working environment. We have no control over the PATH beyond what is delivered by default.

     
  • Earnie Boyd

    Earnie Boyd - 2011-11-15
    • assigned_to: nobody --> cwilso11
     
  • ozhiker

    ozhiker - 2011-11-16

    This is a new behaviour - I had a previous version of MinGW perl.exe from about a year ago which did not have this problem.

     
  • Earnie Boyd

    Earnie Boyd - 2011-11-16

    I am going to assume you mean that the "new behavior" is the "couldn't commit memory for cygwin heap, Win32 error 0" message. Certainly not the fact that an executable script coming first in the PATH will be executed, that is not "new behavior". If what I say is true then you need to correct your bug report Summary.

     
  • ozhiker

    ozhiker - 2011-11-17

    Yes - Using the older version of perl.exe, the "sh" file was ignored and the perl program executed normally using "sh.exe".
    Using the latest perl.exe, the "sh" file is not ignored and causes the error message.

     
  • Earnie Boyd

    Earnie Boyd - 2011-11-18

    <blockquote>Yes - Using the older version of perl.exe, the "sh" file was ignored and
    the perl program executed normally using "sh.exe".</blockquote>

    Maybe it did, but the issue is still a user issue. The user could just as easily have another sh.exe in the PATH before /bin. We cannot guard against stupidity on the users part.

    I'm leaving this open because of the "cygwin heap" issue. I've modified the Summary to match the open issue.

     
  • Earnie Boyd

    Earnie Boyd - 2011-11-18
    • summary: Perl incorrect dependence on "sh" rather than "sh.exe" --> Perl *** couldn't commit memory for cygwin heap, Win32 error
     
  • Earnie Boyd

    Earnie Boyd - 2013-02-08
    • labels: MSYS -->
    • milestone: --> MSYS
    • type: --> Bug
    • resolution: --> none
    • category: --> Unknown
    • patch_attached: --> False
     
  • Keith Marshall

    Keith Marshall - 2018-12-12
    • assigned_to: Charles Wilson --> Earnie Boyd
     
  • Keith Marshall

    Keith Marshall - 2018-12-12

    I'm sorely tempted to just close this, as "invalid". The "cannot commit memory for cygwin heap" is often a symptom of misuse: attempting to start MSYS utilities directly from cmd.exe, which is unsupported, instead of from a properly initiated MSYS shell session, as they should be used; the OP's use of backslashes in example path names strongly hints that he (or she) is engaged in precisely such improper usage.

    Other than that, I completely agree with you, Earnie, that there absolutely should not be an executable sh anywhere where perl.exe can find it — executables on Windows need a .exe extension, (unless they are shell scripts, intended to be invoked from a properly initiated MSYS, or equivalent, shell session); the MSYS execlp(), (or spawnlp(), or whatever else MSYS' perl.exe may call to invoke a sub-shell process), shouldn't even consider any file for execution, if it does not have a valid executable extension.

    Feel free to pass this on to Cesar, for further comment, but I see no reason why this should be deemed as anything other than inappropriate usage by the OP; I vote for immediate dismissal.

     
  • Earnie Boyd

    Earnie Boyd - 2018-12-12
    • status: open --> closed
    • Resolution: none --> out-of-date
     
  • Earnie Boyd

    Earnie Boyd - 2018-12-12

    Closing because of age. If you think this needs further work open a new ticket on OSDN.