Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Feb 2001 22:10:02 -0800 (PST)
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/25017: cp -pRP does not preserve symlink ownership
Message-ID:  <200102120610.f1C6A2512297@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/25017; it has been noted by GNATS.

From: Bruce Evans <bde@zeta.org.au>
To: mkamm@gmx.net
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/25017: cp -pRP does not preserve symlink ownership
Date: Mon, 12 Feb 2001 17:00:13 +1100 (EST)

 On Sun, 11 Feb 2001 mkamm@gmx.net wrote:
 
 > >Description:
 > 
 > I quote "man cp":
 > 
 >      -p    Cause cp to preserve in the copy as many of the modification time,
 >            access time, file flags, file mode, user ID, and group ID as al-
 >            lowed by permissions.
 > 
 > However no attempt is made by cp(1) to preserve ownership of copied symlinks.
 
 > >Fix:
 > 
 > Index: utils.c
 > ===================================================================
 > RCS file: /home/ncvs/src/bin/cp/utils.c,v
 > retrieving revision 1.28
 > diff -u -r1.28 utils.c
 > --- utils.c	2000/10/10 01:48:18	1.28
 > +++ utils.c	2001/02/11 00:52:13
 > @@ -224,7 +224,7 @@
 >  		warn("symlink: %s", link);
 >  		return (1);
 >  	}
 > -	return (0);
 > +	return (pflag ? setlink(p->fts_statp) : 0);
 >  }
 
 This should use a slightly modified version of setfile() (replace
 `chown(...)' by `(S_ISLINK(...) ? chown : lchown)(...)', etc.  This
 will also fix the non-preservation of modes and times for symlinks.
 
 Bruce
 
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102120610.f1C6A2512297>