This is the mail archive of the 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]

Re: ACL or file locking issue?

On Wed, 16 Jul 2003, msg wrote:

> Greetings:
> 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
> this.
> 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
> [snip]

Hmm, which "whoami" is that?  Not the one that comes with Cygwin,
      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,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:
Problem reports:

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