diff mbox series

[2/2] fchmodat: Ignore symlinks, don't return an error

Message ID 20240410092948.1989389-2-richard.purdie@linuxfoundation.org
State New
Headers show
Series [1/2] README: Switch to yocto-patches mailing list | expand

Commit Message

Richard Purdie April 10, 2024, 9:29 a.m. UTC
Ugrading to coreutils 9.5 pulls in:
https://git.savannah.gnu.org/cgit/coreutils.git/commit/src/chmod.c?id=07a69fc3ba717b879218592db685a1c79869cb28
which calls fchmodat with AT_SYMLINK_NOFOLLOW.

All the docs I can find say that symlinks don't have modes and are
always readable. With the error in place, we see things like:

chmod: changing permissions of 'XXX/build-appliance-image/15.0.0/rootfs/home/builder/poky/scripts/esdk-tools/runqemu-gen-tapdevs': Function not implemented

when building build-appliance-image, which uses tools from coreutils-native.
It is only a matter of time before distros start shipping those newer tools.

I believe the correct thing to do is just return success here rather
than failure. This does fix the build failure.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 ports/unix/guts/fchmodat.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/ports/unix/guts/fchmodat.c b/ports/unix/guts/fchmodat.c
index d1ac7bb..5a31151 100644
--- a/ports/unix/guts/fchmodat.c
+++ b/ports/unix/guts/fchmodat.c
@@ -28,9 +28,8 @@ 
 		return rc;
 	}
 	if (S_ISLNK(buf.st_mode)) {
-		/* we don't really support chmod of a symlink */
-		errno = ENOSYS;
-		return -1;
+		/* according to docs, "chmod on a symbolic link always succeeds and has no effect" */
+		return 0;
 	}
 	save_errno = errno;