public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: Postinstall failure: file not found
       [not found] <F84TDnJkHHFvhsl5AsK000144fd@hotmail.com>
@ 2003-04-04 15:37 ` Pierre A. Humblet
  2003-04-04 15:43   ` Pierre A. Humblet
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre A. Humblet @ 2003-04-04 15:37 UTC (permalink / raw)
  To: Rudiyanto Gunawan, cygwin

OK, I've got it:

/> sh -c sayhi
hi
/> sh -c /sayhi
/sayhi: not found

With strace I saw that sh uses stat (which won't show rxw rights
in this case) and it behaves differently for absolute paths.

Possible fixes:
1) cd to /etc/postinstall before running the scripts and use relative paths
2) Put my 2nd ntsec patch in setup (I have asked Rudiyanto to test it)
3) Run the postinstall scripts with CYGWIN=nontsec, for boostrap.
   Note that scripts that rely on ntsec (chmod or chown) will need to turn 
   ntsec on.
4) patch sh.exe
5) ???

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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Postinstall failure: file not found
  2003-04-04 15:37 ` Postinstall failure: file not found Pierre A. Humblet
@ 2003-04-04 15:43   ` Pierre A. Humblet
  2003-04-04 16:02     ` Pierre A. Humblet
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre A. Humblet @ 2003-04-04 15:43 UTC (permalink / raw)
  To: cygwin

On Fri, Apr 04, 2003 at 10:18:40AM -0500, Pierre A. Humblet wrote:
> OK, I've got it:
> 
> /> sh -c sayhi
> hi
> /> sh -c /sayhi
> /sayhi: not found
> 
> With strace I saw that sh uses stat (which won't show rxw rights
> in this case) and it behaves differently for absolute paths.
> 
> Possible fixes:
> 1) cd to /etc/postinstall before running the scripts and use relative paths
> 2) Put my 2nd ntsec patch in setup (I have asked Rudiyanto to test it)
> 3) Run the postinstall scripts with CYGWIN=nontsec, for boostrap.
>    Note that scripts that rely on ntsec (chmod or chown) will need to turn 
>    ntsec on.
> 4) patch sh.exe
> 5) ???
Use bash
/> bash -c /sayhi
hi
/> bash -c sayhi
hi
6) ???

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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Postinstall failure: file not found
  2003-04-04 15:43   ` Pierre A. Humblet
@ 2003-04-04 16:02     ` Pierre A. Humblet
  2003-04-05  4:53       ` Ash ntsec woes [was: Re: Postinstall failure: file not found] Pierre A. Humblet
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre A. Humblet @ 2003-04-04 16:02 UTC (permalink / raw)
  To: cygwin

On Fri, Apr 04, 2003 at 10:17:41AM -0500, Pierre A. Humblet wrote:
> > Possible fixes:
> > 1) cd to /etc/postinstall before running the scripts and use relative paths
> > 2) Put my 2nd ntsec patch in setup (I have asked Rudiyanto to test it)
> > 3) Run the postinstall scripts with CYGWIN=nontsec, for boostrap.
> >    Note that scripts that rely on ntsec (chmod or chown) will need to turn 
> >    ntsec on.
> > 4) patch sh.exe
> > 5) ???
> Use bash
> /> bash -c /sayhi
> hi
> /> bash -c sayhi
> hi
> 6) ???
Don't use -c
/> sh -c /sayhi
/sayhi: not found
/> sh /sayhi
hi
7) ???

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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Ash ntsec woes [was: Re: Postinstall failure: file not found]
  2003-04-04 16:02     ` Pierre A. Humblet
@ 2003-04-05  4:53       ` Pierre A. Humblet
  0 siblings, 0 replies; 4+ messages in thread
From: Pierre A. Humblet @ 2003-04-05  4:53 UTC (permalink / raw)
  To: cygwin

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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-04-04 23:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <F84TDnJkHHFvhsl5AsK000144fd@hotmail.com>
2003-04-04 15:37 ` Postinstall failure: file not found Pierre A. Humblet
2003-04-04 15:43   ` Pierre A. Humblet
2003-04-04 16:02     ` Pierre A. Humblet
2003-04-05  4:53       ` Ash ntsec woes [was: Re: Postinstall failure: file not found] Pierre A. Humblet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).