This is the mail archive of the
mailing list for the Cygwin project.
Re: ACL or file locking issue?
- From: Igor Pechtchanski <pechtcha at cs dot nyu dot edu>
- To: msg <michael dot grigoni at cybertheque dot org>
- Cc: cygwin at cygwin dot com
- Date: Wed, 23 Jul 2003 14:40:01 -0400 (EDT)
- Subject: Re: ACL or file locking issue?
- Reply-to: cygwin at cygwin dot com
On Wed, 16 Jul 2003, msg wrote:
> Is this an ACL or file locking issue?
> Trying to copy a registry file in a 'bash' shell
> as a privileged user (whoami /priv appears below) yields:
> (root's prompt is '#')
> # cd /cygdrive/c/winnt/system32/config
> # cp SAM /var/tmp
> cp:'SAM.exe' and '/var/tmp/SAM' are the same file
> I can reproduce this behavior on a plain file, eg:
> # cd /var/tmp
> # echo "testing" > foo
> # chmod 770 foo
> # chown Administrator foo
> # chgrp SYSTEM foo
> # cp foo bar
> cp: 'foo.exe' and 'bar' are the same file
> File must be mode=(at least)440,uid=Administrator,gid=SYSTEM to see
> Changing file modes, user and/or group ownership on SAM however doesn't
> allow access.
> All replies much appreciated.
> Michael Grigoni
It looks like the "foo = foo.exe" hack in cp is misfiring here.
Basically, cp tries to open the file, fails, and assumes that the name
it's been given should have a ".exe" appended to it. Since the file
"foo.exe" really doesn't exist, cp produces the wrong error message ("are
the same file" instead of "cannot open foo for reading"). The main
problem with the hack is that it doesn't check *why* it failed to open the
file, and simply assumes that if "open()" returns a negative value, the
file doesn't exist. Checking to make sure "errno == ENOENT" before
attempting to access the ".exe" would probably fix it, but I'm not in a
position right now to submit a patch.
FWIW, CGF planned to redo this "properly" for coreutils (whenever that
comes out as a package).
> Output of 'whoami /priv':
> (O) SeTcbPrivilege = Act as part of the operating system
Hmm, which "whoami" is that? Not the one that comes with Cygwin,
|\ _,,,---,,_ firstname.lastname@example.org
ZZZzz /,`.-'`' -. ;-;;,_ email@example.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster." -- Patrick Naughton
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html