From: Bruno Haible <bruno@clisp.org>
To: Po Lu <luangruo@yahoo.com>, Eli Zaretskii <eliz@gnu.org>,
Paul Eggert <eggert@cs.ucla.edu>
Cc: emacs-devel@gnu.org, bug-gnulib@gnu.org
Subject: Re: errors from fchownat copying directories
Date: Sat, 26 Aug 2023 18:40:20 +0200 [thread overview]
Message-ID: <13334762.uLZWGnKmhe@nimes> (raw)
In-Reply-To: <c79dc7cb-7ef3-5755-8253-4d87d0bd2a00@cs.ucla.edu>
Paul Eggert wrote:
> https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=349798a9b81fb4f7f8e1e1963ea9039a4a68a471
Isn't there something missing in this function 'copy-directory',
around emacs/lisp/files.el line 6624? I see code for preserving the modes
and the times, but not for preserving the owner.
For comparison, 'mv' from GNU coreutils 9.3.147-d553ab contains also code
for preserving the owner, and this code sometimes gives diagnostics that
are ignored, in the sense that 'mv' terminates with exit code 0.
See:
$ ldd mv
linux-vdso.so.1 (0x00007fff51f73000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f856994a000)
libacl.so.1 => /lib/x86_64-linux-gnu/libacl.so.1 (0x00007f8569940000)
libattr.so.1 => /lib/x86_64-linux-gnu/libattr.so.1 (0x00007f8569938000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8569710000)
libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f8569679000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8569998000)
$ mkdir dir1
$ echo foo > dir1/file1
$ mv dir1 /media/nas/bruno/dir1
mv: failed to preserve ownership for '/media/nas/bruno/dir1': Permission denied
$ echo $?
0
Here /media/nas/bruno/dir1 is on a CIFS version 1 file system, and the
'strace' log from the 'mv' command shows the essential syscalls:
utimensat(AT_FDCWD, "/media/nas/bruno/dir1", [{tv_sec=1693067148, tv_nsec=145342620} /* 2023-08-26T18:25:48.145342620+0200 */, {tv_sec=1693067154, tv_nsec=717388257} /* 2023-08-26T18:25:54.717388257+0200 */], 0) = 0
fchownat(AT_FDCWD, "/media/nas/bruno/dir1", 1000, 1000, AT_SYMLINK_NOFOLLOW) = -1 EACCES (Permission denied)
Note: In earlier versions of coreutils 'mv', instead of an fchownat call, we
saw an equivalent lchown call:
lchown("/media/nas/bruno/dir1", 1000, 1000) = -1 EACCES (Permission denied)
Bruno
next prev parent reply other threads:[~2023-08-26 16:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-26 7:38 master 349798a9b8: Demote errors from utimensat copying directories Eli Zaretskii
2023-08-26 8:22 ` Po Lu
2023-08-26 9:07 ` Eli Zaretskii
2023-08-26 9:33 ` Po Lu
2023-08-26 16:12 ` Paul Eggert
2023-08-26 16:40 ` Bruno Haible [this message]
2023-08-26 16:57 ` errors from fchownat " Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=13334762.uLZWGnKmhe@nimes \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=luangruo@yahoo.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.savannah.gnu.org/cgit/emacs.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).