Mail Archives: cygwin/2002/05/08/16:44:13
Hmmm...now that I think about it, this whole symlink issue may be a red
herring....
Charles Wilson wrote:
> 'cp -p src dest' doesn't work properly under the following conditions:
>
> 1) running as an unprivileged user
> 2) 'source' is a symlink to 'target'
> 3) 'target' is owned by root (Administrator)
The real problem is:
src = real file, owned by not-me.
I am not Administrator/root.
$ cp -p src dest
Fails on cygwin and reports an error; succeeds on linux, doesn't report
an error. In both cases, the newly created 'dest' is a real file with
the correct permissions and timestamp, and has UID/GID == me.
The fix is still the same, though: fileutils-4.1-1, src/copy.c line 40:
#define DO_CHOWN(Chown, File, New_uid, New_gid) \
(Chown (File, New_uid, New_gid) \
/* If non-root uses -p, it's ok if we can't preserve ownership. \
But root probably wants to know, e.g. if NFS disallows it, \
or if the target system doesn't support file ownership. */ \
&& ((errno != EPERM && errno != EINVAL) || x->myeuid == 0))
So, two questions:
1) on cygwin, should the 'test' value for "root/Administrator" be 0?
or 500?
2) chown is actually reporting EACCES -- so should this test also
mask EACCES in addition to EPERM and EINVAL, when user != root?
--Chuck
--
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 -