delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/02/09/15:55:04

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=q0kSiXSDitWZX7aXdU7gh4whs/k1QZEg9uRJshcWYmp
H3FpghEGxOambYie3Zv+tzmO1i5WmYbsYfcOcZayG5wDQvAHavB4KsMEoO2euT9j
wwXg9GO2nAmtb2vy7Me+1vDSkFH8jf79Q9TTR66bwoWhP24O/pPlKp1PKfxdk83U
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=w4JdfF69hvAP6ZXZCO5vSbdoln0=; b=pYrcmbNbym9DeH7Ph
STv6VzEYKqu2gEVJNBmmFAiA8qweM5B5d8153nx5DwAryKCrzsxJB5nR4w+Aarn+
aEkpnq5bxKFBIicDG7tU70LcOZco5B0jybsjv2x+m7HbOC5i6AfjVmJS7nmcrrDD
YfLhXJSYmKMBoySX5TdxR/myQE=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2
X-HELO: mout.kundenserver.de
Message-ID: <54D91D54.5000705@towo.net>
Date: Mon, 09 Feb 2015 21:49:24 +0100
From: Thomas Wolff <towo AT towo DOT net>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: execlp/execvp needs case-correct PATH
References: <54D7EB8E DOT 8070308 AT towo DOT net> <20150209101747 DOT GA12131 AT calimero DOT vinschen DOT de>
In-Reply-To: <20150209101747.GA12131@calimero.vinschen.de>
X-TagToolbar-Keys: D20150209214924810
X-UI-Out-Filterresults: notjunk:1;
X-IsSubscribed: yes

Am 09.02.2015 um 11:17 schrieb Corinna Vinschen:
> On Feb  9 00:04, Thomas Wolff wrote:
>> With a Windows case sensitive file system (and according mount flags
>> for /cygdrive), the PATH does not properly reflect casing of the actual
>> directories (e.g. C:\WINDOWS vs. C:\Windows, thanks MS...).
>> However, the shell finds programs anyway, like e.g. notepad.
>> The exec*p system calls, on the other hand, do not find a program in this
>> case as demonstrated by the attached test program.
>> This is in contrast to the Linux (and POSIX?) manual page which claims
>> „The execlp(), execvp(), and execvpe() functions duplicate the actions
>> of the shell in searching for an executable file …“
> I can't reproduce this.  If I change my cygdrive mounts to
> case-sensitive, my shell doesn't start notepad anymore:
>
>    $ cat /etc/fstab
>    none /mnt cygdrive binary,posix=1,user 0 0
>    $ echo $SHELL
>    /bin/tcsh
>    $ echo $path
>    /usr/bin /mnt/c/WINDOWS/system32 /mnt/c/WINDOWS /mnt/c/WINDOWS/System32/Wbem /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0 /usr/lib/lapack
>    $ notepad
>    notepad: Command not found.
>    $ /mnt/c/Windows/notepad
>    <works>
>    $
Sorry, I forgot one detail: I added /cygdrive/c/Windows/System32 to my path
so the shell will find it, but yet execlp does not find it.

#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
int main (int argc, char * * argv)
{
         char * prog = argc > 1 ? argv [1] : "notepad";
         int res;
         printf ("Calling exec %s\n", prog);

         res = execlp (prog, "-", 0);
         if (res < 0) {
                 fprintf (stderr, "errno %d - ", errno);
                 perror ("exec");
         }
}


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019