mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: bug? in  musl libc failed to preserve ownership for
Date: Thu, 2 Apr 2015 22:15:16 -0400	[thread overview]
Message-ID: <20150403021516.GD6817@brightrain.aerifal.cx> (raw)
In-Reply-To: <551DEA79.70702@safe.ca>

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


      reply	other threads:[~2015-04-03  2:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02 15:53 perl native musl, ldd Jean-Marc Pigeon
2015-04-02 16:18 ` Rich Felker
2015-04-02 18:17   ` Jean-Marc Pigeon
2015-04-02 18:48     ` u-wsnj
2015-04-02 20:40       ` Jean-Marc Pigeon
2015-04-02 20:48         ` Laurent Bercot
2015-04-02 21:08         ` Nathan McSween
2015-04-02 21:09         ` u-wsnj
2015-04-02 21:26         ` Rich Felker
2015-04-02 21:34         ` Szabolcs Nagy
2015-04-03  0:57           ` Jean-Marc Pigeon
2015-04-03  1:18             ` bug? in musl libc failed to preserve ownership for Jean-Marc Pigeon
2015-04-03  2:15               ` Rich Felker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150403021516.GD6817@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).