bug#65599: mv and cp give a pointless warning when moving/copying a directory

2023-09-02 Thread Paul Eggert
On 2023-09-02 04:18, Bruno Haible wrote: chmod fails with EACCES, hence per POSIX it's buggy. Thanks, I reported the bug with chmod, chown, etc. to the linux-cifs mailing list, here:

bug#65599: mv and cp give a pointless warning when moving/copying a directory

2023-09-02 Thread Bruno Haible
Paul Eggert wrote: > Yes please. If chmod also does not work coreutils might need more > workarounds. > > Just to be clear; please try it on a file where chmod should fail > because you don't own the file and you're not root. chmod should fail > with EPERM in this case; it it fails with EACCES

bug#65599: mv and cp give a pointless warning when moving/copying a directory

2023-09-01 Thread Paul Eggert
On 2023-09-01 19:52, Paul Eggert wrote: Yes please. If chmod also does not work coreutils might need more workarounds. Just to be clear; please try it on a file where chmod should fail because you don't own the file and you're not root. chmod should fail with EPERM in this case; it it fails

bug#65599: mv and cp give a pointless warning when moving/copying a directory

2023-09-01 Thread Paul Eggert
On 2023-09-01 16:12, Bruno Haible wrote: Well, you asked me to try it on / but / is an ext4 FS, not a CIFS FS on my system. Should I try it also on a directory inside the CIFS mount? Yes please. If chmod also does not work coreutils might need more workarounds.

bug#65599: mv and cp give a pointless warning when moving/copying a directory

2023-09-01 Thread Bruno Haible
Paul Eggert wrote: > Good, thanks for confirming that the chmod family does not have a > similar bug. Well, you asked me to try it on / but / is an ext4 FS, not a CIFS FS on my system. Should I try it also on a directory inside the CIFS mount? > I installed the attached workaround into

bug#65599: mv and cp give a pointless warning when moving/copying a directory

2023-09-01 Thread Bruno Haible
Paul Eggert wrote: > > If you compile and run the attached > > program on a file that you don't own (e.g., './a.out /'), does it > > incorrectly issue "Permission denied" instead of "Operation not > > permitted" diagnostics? and I replied: > In this case, the diagnostic is "Operation not

bug#65599: mv and cp give a pointless warning when moving/copying a directory

2023-09-01 Thread Paul Eggert
Good, thanks for confirming that the chmod family does not have a similar bug. I installed the attached workaround into coreutils master on Savannah. Please give it a try.From 5f971361608749e1245c5eb12096de2acd32bf83 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 1 Sep 2023 15:05:21

bug#65599: mv and cp give a pointless warning when moving/copying a directory

2023-09-01 Thread Bruno Haible
Paul Eggert wrote: > If you compile and run the attached > program on a file that you don't own (e.g., './a.out /'), does it > incorrectly issue "Permission denied" instead of "Operation not > permitted" diagnostics? In this case, the diagnostic is "Operation not permitted" (from EPERM): $

bug#65599: mv and cp give a pointless warning when moving/copying a directory

2023-09-01 Thread Paul Eggert
On 2023-09-01 08:09, Bruno Haible wrote: It applies to all 4 variants, as can be seen from applying it to a directory: $ ./a.out /media/nas/bruno/dir1 lchown: Permission denied fchownat: Permission denied chown: Permission denied fchown: Permission denied Thanks, for coreutils it'd be helpful

bug#65599: mv and cp give a pointless warning when moving/copying a directory

2023-09-01 Thread Bruno Haible
Paul Eggert wrote: > it'd be helpful to know whether the bug is limited to fchownat or > (as I suspect) applies also to the other chown variants. Could you try > running the attached program on your platform, to see whether the bug > affects these other variants? It applies to all 4 variants,

bug#65599: mv and cp give a pointless warning when moving/copying a directory

2023-09-01 Thread Paul Eggert
Thanks for the followup. I looked into fixing it in Gnulib and it appears that this would require an extra syscall (or maybe even two) per file when copying to a CIFS filesystem, which I'd rather avoid. So I'm leaning more towards working around the bug in coreutils. Before doing that, it'd be

bug#65599: mv and cp give a pointless warning when moving/copying a directory

2023-08-31 Thread Bruno Haible
Thanks for looking into this, Paul. But there's a big misunderstanding. This is not on Android. It's on Linux with glibc (Ubuntu 22.04, to be precise), as can be seen from the log file: openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 and from the fact that I could

bug#65599: mv and cp give a pointless warning when moving/copying a directory

2023-08-30 Thread Paul Eggert
On 2023-08-29 11:20, Bruno Haible wrote: People say that "chown only works for root anyway" [1] I don't think that is the issue here. fchownat is failing with EACCES, which is supposed to mean that search permission is denied on a component of the path prefix, but in Android I guess EACCES

bug#65599: mv and cp give a pointless warning when moving/copying a directory

2023-08-29 Thread Bruno Haible
When I move a directory from an ext4 file system to a CIFS v1 file system, I get a diagnostic mv: failed to preserve ownership for '...': Permission denied although the owner and group of the directory after and before the move are the same. So, there is actually nothing to warn about. $ mv