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