Mail Archives: cygwin/2002/07/30/09:41:33
--Boundary_(ID_2oXi9YfIVNOYreVL/bIjkg)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline
The attached patch, loosely inspired by a Cygwin specific patch to cp,
solves the following problem:
$ ls -ld foo*
drwxr-xr-x 2 jt Domain U 0 Jul 30 09:15 foo
-rwxr-xr-x 1 jt Domain U 17924 Jul 26 15:10 foo.exe
$ sh -c ./foo
./foo: not found
Note that bash does not have this problem:
$ bash -c ./foo
hello
After studying the source for ash, bash, and cygwin. I understand why
it works for bash but not for ash. Unfortunately, AFAICT, this problem
cannot be solved in the Cygwin DLL. So, I decided to develop a ash
workaround. With this patch, ash now behaves like bash for the above
test case:
$ sh -c ./foo
hello
Is the ash maintainer willing to accept this patch?
Thanks,
Jason
--Boundary_(ID_2oXi9YfIVNOYreVL/bIjkg)
Content-type: text/plain; charset=us-ascii; NAME=exec.c.diff
Content-transfer-encoding: 7BIT
Content-disposition: attachment; filename=exec.c.diff
--- exec.c.orig 2002-07-29 16:00:41.000000000 -0400
+++ exec.c 2002-07-29 16:07:44.000000000 -0400
@@ -459,7 +459,22 @@ find_command(name, entry, printerr, path
(statb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)))
entry->cmdtype = CMDNORMAL;
else
+#ifndef __CYGWIN__
entry->cmdtype = CMDUNKNOWN;
+#else
+ {
+ char *name_exe = 0;
+ name_exe = alloca(strlen(name) + 5);
+ strcpy(name_exe, name);
+ strcat(name_exe, ".exe");
+ if (stat(name_exe, &statb) == 0 &&
+ S_ISREG(statb.st_mode) &&
+ (statb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)))
+ entry->cmdtype = CMDNORMAL;
+ else
+ entry->cmdtype = CMDUNKNOWN;
+ }
+#endif /* !__CYGWIN__ */
entry->u.index = -1;
return;
}
--Boundary_(ID_2oXi9YfIVNOYreVL/bIjkg)
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
--Boundary_(ID_2oXi9YfIVNOYreVL/bIjkg)--
- Raw text -