Mail Archives: cygwin/2003/01/29/12:20:31
On Wed, 29 Jan 2003, Harald Kierer wrote:
> > Found the problem: I had a file named `rm':
> >
> > D:\acl62\src\cl\src>ls -l rm
> > -rw-r--r-- 1 layer None 0 Jan 28 15:47 rm
> > D:\acl62\src\cl\src>getfacl rm
> > # file: rm
> > # owner: layer
> > # group: None
> > user::rw-
> > group::r--
> > other:r--
> > mask:rwx
> >
> > D:\acl62\src\cl\src>
> >
> > Now, it seems odd that `sh' (but not `bash' nor `sh' on Solaris) would
> > try and execute this.
>
> My guess: When you start bash your pwd gets changed. Check your last line in
> /etc/profile. So your "faulty" 0-byte rm is not found.
> sh doesnt change the pwd, so it uses the 0-byte rm.
> Bye,
> Harry
Nope, bash doesn't change pwd unless a --login flag is given (and if it
did, it wouldn't be able to find the file in the current directory to
remove, would it?).
Bash is apparently using Cygwin's permission bits to determine whether
something is executable, while sh uses some other mechanism (it could be
as simple as where the stat routine is called from -- can't say more
without looking at the source). A simple test shows that (this behavior
presupposes that "." is in the front of the PATH, as it usually is on
Windows):
====================================================================
C:\cygwin\tmp\pathtest>ls -l
total 1
-rw-r--r-- 1 igor None 0 Jan 29 11:58 aaa
-rw-r--r-- 1 igor None 27 Jan 29 11:56 rm
C:\cygwin\tmp\pathtest>cat rm
echo Running '"'rm "$@"'"'
C:\cygwin\tmp\pathtest>getfacl rm
# file: rm
# owner: igor
# group: None
user::---
group::---
other::---
mask::rwx
C:\cygwin\tmp\pathtest>sh -c "type rm"
rm is ./rm
C:\cygwin\tmp\pathtest>sh -c "rm -i aaa"
Running "rm -i aaa"
C:\cygwin\tmp\pathtest>bash -c "type rm"
rm is /usr/bin/rm
C:\cygwin\tmp\pathtest>bash -c "rm -i aaa"
rm: remove `aaa'? n
====================================================================
Oh, and by the way, some more data points:
====================================================================
C:\cygwin\tmp\pathtest>ksh -c "type rm"
rm is a tracked alias for /usr/bin/rm
C:\cygwin\tmp\pathtest>ksh -c "rm -i aaa"
rm: remove `aaa'? n
C:\cygwin\tmp\pathtest>C:\cygwin\tmp\pathtest>which rm
/usr/bin/rm
====================================================================
so ksh and "which" apparently uses the same mechanism as bash...
FYI,
C:\cygwin\tmp\pathtest>cygcheck -c bash ash
Cygwin Package Information
Package Version
ash 20020731-1
bash 2.05b-8
C:\cygwin\tmp\pathtest>ksh -c "echo $KSH_VERSION"
@(#)PD KSH v5.2.14 99/07/13.2
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
-- /usr/games/fortune
--
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/
- Raw text -