| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,TW_LR,TW_RW,TW_WX,TW_XR,T_TO_NO_BRKTS_FREEMAIL |
| X-Spam-Check-By: | sourceware.org |
| MIME-Version: | 1.0 |
| In-Reply-To: | <BANLkTimerprgbPRa1jMaTH4NY-F7_yz--w@mail.gmail.com> |
| References: | <BANLkTimerprgbPRa1jMaTH4NY-F7_yz--w AT mail DOT gmail DOT com> |
| Date: | Wed, 20 Apr 2011 06:15:50 +0100 |
| Message-ID: | <BANLkTi=i9crcUwkFrwnytmRtEsB0TWB0bw@mail.gmail.com> |
| Subject: | Re: 0417 snapshot: exec() fails on /proc/self/exe |
| From: | Andy Koppe <andy DOT koppe AT gmail DOT com> |
| To: | cygwin AT cygwin DOT com |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| 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 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[])
> {
> =C2=A0if (argc > 1 && !fork()) {
> =C2=A0 =C2=A0execl("/proc/self/exe", argv[0], (char *)0);
> =C2=A0 =C2=A0puts(strerror(errno));
> =C2=A0}
> =C2=A0return 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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |