X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Message-ID: <71078E41DDE3E541B024832F34BC3D0DDDD4@cowexc03.corp.mxtr.net> From: "Schumacher, Gordon" To: "'Eli Zaretskii'" Cc: djgpp AT delorie DOT com Subject: RE: BASH crashes upon exiting function? Date: Tue, 11 May 2004 17:33:55 -0600 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain Well, I *had* a test case, but I did something to it which caused it to not crash anymore in the same manner. But in trying to re-reproduce the crash, I've stumbled across something else fascinating (which may be the crash in another form...) I'm now running with the code in djgpp/alpha, per what Andrew Cottrell suggested, on a Windows 2000 box. When I run the attached script, my computer performs the compile (as evidenced by the appearance of a .EXE file in the directory) and then the computer goes unresponsive. Many seconds later, I get the following message: ./test.sh: xmalloc: ../variables.c:2292: cannot allocate 792674112 bytes (0 bytes allocated) This only appeared when I added the FOO=`tmp_file_name` line - before doing so, everything seemed to work properly. Interestingly, under the "old" BASH and DJDEV, it blows up with a SIGSEGV, just like I was used to seeing - again, after having compiled the executable. Here's the script - let me know what you think: -------------------------------------- #!/bin/sh # Return temp file tmp_file_name () { echo "test_$$" } func1 () { FOO=`tmp_file_name` echo "In func1('$@')" gcc "${TMPFILE}.c" -o "${TMPFILE}" return 0 } func2 () { echo "In func2" func1 "$@" return 0 } ######################## # main script code here ######################## TMPFILE=`tmp_file_name` cat >"${TMPFILE}.c" < int main() { printf("1\n"); return 0; } EOF func2 "a b c" "d" "e"