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: 0417 snapshot: exec() fails on /proc/self/exe


On 19 April 2011 21:16, Andy Koppe wrote:
> With the latest snapshot, exec() fails on /proc/self/exe:
>
> $ cat test.c
> #include <stdio.h>
> #include <stdlib.h>
> #include <errno.h>
> #include <unistd.h>
> #include <string.h>
>
> int main(int argc, char *argv[])
> {
> Âif (argc > 1 && !fork()) {
> Â Âexecl("/proc/self/exe", argv[0], (char *)0);
> Â Âputs(strerror(errno));
> Â}
> Âreturn 0;
> }
>
> $ cc test.c
>
> $ ./a bla
> Bad file descriptor
>
> With 1.7.9, it prints nothing, which is the expected behaviour.
> Looking at POSIX, EBADF is not a valid errno for exec().

No need for that test case actually. Symbolic links within /proc just
seem to be broken:

$ ls -l /proc/self/exe
ls: cannot read symbolic link /proc/self/exe: Invalid argument
lrwxrwxrwx 1 Andy None 0 Apr 20 06:15 /proc/self/exe

$ ls -l /proc/3372
ls: cannot read symbolic link /proc/3372/cwd: Invalid argument
ls: cannot read symbolic link /proc/3372/exe: Invalid argument
ls: cannot read symbolic link /proc/3372/root: Invalid argument
total 0
-r--r--r-- 1 Andy None 0 Apr 20 06:14 cmdline
-r--r--r-- 1 Andy None 0 Apr 20 06:14 ctty
lrwxrwxrwx 1 Andy None 0 Apr 20 06:14 cwd
lrwxrwxrwx 1 Andy None 0 Apr 20 06:14 exe
-r--r--r-- 1 Andy None 0 Apr 20 06:14 exename
...

Andy

--
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]