From: "Mark E." To: Eli Zaretskii , djgpp-workers AT delorie DOT com Date: Tue, 4 Jul 2000 11:43:49 -0400 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: DJGPP problem executing a script Message-ID: <3961CDF5.18859.1F145B@localhost> In-reply-to: <200007041456.RAA10263@mailgw1.netvision.net.il> References: <3961AE48 DOT 6825 DOT 87F40 AT localhost> (snowball3 AT bigfoot DOT com) X-mailer: Pegasus Mail for Win32 (v3.12c) Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > If it's __dosexec_find_on_path that's linked into Bash, it should have > seen forward slashes in PATH, since stock djgpp.env arranges for that. Not in this case, because it's searching the PATH in the environment to be exported to the new process/child/whatever which must use backslashes. BTW, this problem doesn't happen with Bash 2.03 because it uses it's own custom routines rather than use spawn* probably because he found that it didn't work quite right like I've had to find out. > I think if we need to solve a local problem with scripts, it's > sufficient to solve it locally in script_exec. Fair enough. Here's a patch that fixes the problem when used with Bash: Index: djgpp/src/libc/dos/process/dosexec.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/dos/process/dosexec.c,v retrieving revision 1.7 diff -c -p -r1.7 dosexec.c *** dosexec.c 2000/06/14 14:23:44 1.7 --- dosexec.c 2000/07/04 15:38:24 *************** *** 1,3 **** --- 1,4 ---- + /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ *************** static int script_exec(const char *progr *** 886,891 **** --- 887,902 ---- else return -1; + /* pinterp may contain backslashes because of __dosexec_find_on_path. + Convert them to slashes so Unix shell scripts can run without editing. */ + p = pinterp; + while (*p) + { + if ((*p) == '\\') + *p = '/'; + ++p; + } + i = (*spawnfunc)(P_WAIT, pinterp, newargs, envp); return i; }