X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Fri, 12 Mar 2010 11:11:29 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: allow executing a path in backslash notation Message-ID: <20100312101129.GK6505@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <469024 DOT 97629 DOT qm AT web88302 DOT mail DOT re4 DOT yahoo DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <469024.97629.qm@web88302.mail.re4.yahoo.com> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Mar 11 20:42, Ilguiz Latypov wrote: > > > On Mar 10 10:25, Corinna Vinschen wrote: > > execv (argv[1], args); > > > bash$ gcc -o exec exec.c > > bash$ ./exec /bin/echo > > abc > > bash$ ./exec C:\\cygwin\\bin\\echo > > abc > Thanks for trying a test case. I am attaching a new test case that > shows that the trouble was with execvp(), not exec(). Only execvp() > calls find_exec() which fails to find a file in backslash notation, > > find_exec (path, buf, "PATH=", FE_NNF) > > Another call to find_exec in spawnvpe() seems to succeed, > > find_exec (file, buf) > > So, perhaps, another way to address the issue is to call find_exec() > without the 2 extra parameters. No, that's not correct. This has been changed deliberately, otherwise the execp functions have a potential security problem. If you omit the NNF flag, the function returns the original path unchanged, instead of NULL. The result is, if you give the path "foo" to the execp function, the later call to CreateProcess will start the executable "./foo", even if "." is not in $PATH. This is unfortunate Win32 semantic, but not POSIX semantic. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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