[PATCH 0/5] Linux: lchmod and AT_SYMLINK_NOFOLLOW support for fchmodat

Andreas Schwab schwab@linux-m68k.org
Tue Aug 25 10:21:49 GMT 2020


On Jul 21 2020, Florian Weimer wrote:

> * Andreas Schwab:
>
>> On Jan 22 2020, Florian Weimer wrote:
>>
>>> These patches use the O_PATH hack to implement a fairly close
>>> approximation of fchmodat in AT_SYMLINK_NOFOLLOW mode.
>>
>> This means that cp -a now fails when /proc is not mounted.
>>
>> <https://build.opensuse.org/package/live_build_log/home:Andreas_Schwab:glibc:rebuild/installation-images:openSUSE/f/x86_64>
>>
>> running "cp -a /var/lib/ca-certificates var/lib"
>> cp: setting permissions for 'var/lib/ca-certificates/pem': Operation not supported
>> cp: setting permissions for 'var/lib/ca-certificates/openssl': Operation not supported
>>
>> newfstatat(AT_FDCWD, "/var/lib/ca-certificates/pem", {st_mode=S_IFDIR|0500, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
>> mkdir("var/lib/ca-certificates/pem", 0500) = 0
>> lstat("var/lib/ca-certificates/pem", {st_mode=S_IFDIR|0500, st_size=4096, ...}) = 0
>> openat(AT_FDCWD, "var/lib/ca-certificates/pem", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_PATH) = 3
>> newfstatat(3, "", {st_mode=S_IFDIR|0500, st_size=4096, ...}, AT_EMPTY_PATH) = 0
>> chmod("/proc/self/fd/3", 040700)        = -1 ENOENT (No such file or directory)
>> close(3)                                = 0
>> write(2, "cp: ", 4)                     = 4
>> write(2, "setting permissions for 'var/lib"..., 53) = 53
>> write(2, ": Operation not supported", 25) = 25
>> write(2, "\n", 1)                       = 1
>
> Yes, it's a known issue.
>
> I have not been able to convince the kernel developers to add the
> required system call.  Maybe you will have more luck with that?

What's the point of having lchmod if it always fails anyway?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Libc-alpha mailing list