From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7331 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: bug? in musl libc failed to preserve ownership for Date: Thu, 2 Apr 2015 22:15:16 -0400 Message-ID: <20150403021516.GD6817@brightrain.aerifal.cx> References: <551D65EF.9030802@safe.ca> <20150402161837.GA6817@brightrain.aerifal.cx> <551D87C0.4010409@safe.ca> <20150402184810.GF4456@example.net> <551DA936.2070302@safe.ca> <20150402213448.GD27899@port70.net> <551DE58A.6070707@safe.ca> <551DEA79.70702@safe.ca> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1428027332 5483 80.91.229.3 (3 Apr 2015 02:15:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 3 Apr 2015 02:15:32 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7344-gllmg-musl=m.gmane.org@lists.openwall.com Fri Apr 03 04:15:31 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Ydr8s-000255-RS for gllmg-musl@m.gmane.org; Fri, 03 Apr 2015 04:15:30 +0200 Original-Received: (qmail 3518 invoked by uid 550); 3 Apr 2015 02:15:28 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 3497 invoked from network); 3 Apr 2015 02:15:28 -0000 Content-Disposition: inline In-Reply-To: <551DEA79.70702@safe.ca> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:7331 Archived-At: On Thu, Apr 02, 2015 at 09:18:49PM -0400, Jean-Marc Pigeon wrote: > Hello. > > Using cp (from native musl coreutils compilation, not busybox) I am > getting a strange result when doing a copy > (using musls-1.1.8) > > test (user:group, no privilege 301:300, doing this as root is no problem): > ;------------------------------------------------------------- > mkdir d1 > cd d1 > touch p1 > ln -s p1 lp1 > cd .. > cp -a d1 d2 > cp: failed to preserve ownership for d2/lp1: Not supported > ;-------------------------------------------------------------- > Note: same cp from coreutils glibc working fine. > > strace extract > > getdents64(3, /* 4 entries */, 2048) = 96 > getdents64(3, /* 0 entries */, 2048) = 0 > close(3) = 0 > lstat("d1/lp1", {st_mode=S_IFLNK|0777, st_size=2, ...}) = 0 > readlink("d1/lp1", "p1", 3) = 2 > symlink("p1", "d2/lp1") = 0 > lstat("d2/lp1", {st_mode=S_IFLNK|0777, st_size=2, ...}) = 0 > lchown("d2/lp1", 301, 300) = 0 > newfstatat(AT_FDCWD, "d2/lp1", {st_mode=S_IFLNK|0777, st_size=2, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fcntl(1, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE) > writev(2, [{"cp: ", 4}, {NULL, 0}], 2cp: ) = 4 > writev(2, [{"", 0}, {"failed to preserve ownership for"..., 39}], > 2failed to preserve ownership for d2/lp1) = 39 > writev(2, [{": Not supported", 15}, {NULL, 0}], 2: Not supported) = 15 > writev(2, [{"", 0}, {"\n", 1}], 2 > ) = 1 > lstat("d1/p1", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 > open("d1/p1", O_RDONLY|O_NOFOLLOW) = 3 > ;---------------------------------------------------------------------- > > My understanding/feeling, could be within fcntl not > reading symlink file status properly. possible? fcntl is unrelated; it's not acting on the symlink. I've tried to make sense of the above strace but I don't see anything in the source that would be causing the newfstatat syscall. The only code paths I can find in the source that print that message just check for failure of lchown, and lchown is not failing. I checked current git master and 8.19 which I had lying around. What specific version are you using? Rich