delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/05/08/16:44:13

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3CD98CF0.6050007@ece.gatech.edu>
Date: Wed, 08 May 2002 16:39:12 -0400
From: Charles Wilson <cwilson AT ece DOT gatech DOT edu>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2
X-Accept-Language: en-us
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: cp.ese bug report -- possible fix?
References: <3CD989CB DOT 4060806 AT ece DOT gatech DOT edu>

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019