This is the mail archive of the cygwin@cygwin.com 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]

Ash ntsec woes [was: Re: Postinstall failure: file not found]


Here is how sh behaves when executing a script with strange permissions
/> cat sayhi
echo hi
/> getfacl sayhi
# file: sayhi
# owner: AdministratorS
# group: Users
user::---
user:PHumblet:rwx
group::---
mask:rwx
other:---
/> sh -c sayhi    <== OK
hi                
/> sh -c /sayhi   <== Does not realize file is executable
/sayhi: not found 
/> setfacl -s u::---,g::---,o:--- sayhi
/> sh -c sayhi    <== Goes ahead even though file is unreadable
/> echo $?
255

The reason why ash is inconsistent is that when it searches 
a command on PATH it does NOT check for executable or even
readable files.
There is code that used to do that on line 558 of exec.c,
but it is "#ifdef notdef".
On the other hand, absolute paths are checked with stat on lines
459 and 472 (partly in Cygwin specific code).

So ash is always too permissive or too strict when looking up
commands, although its builtin "test" is fine. 
The "just right" way in Cygwin is to use access(X_OK) on all
3 lines listed above.

Pierre

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]