This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: allow executing a path in backslash notation


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]