diff mbox series

[v2,2/2] package/fakeroot: fix for fchownat/fchmodat

Message ID 20200506131130.410171-3-nolange79@gmail.com
State Superseded
Headers show
Series [v2,1/2] package/fakeroot: bump version to 1.24 | expand

Commit Message

Norbert Lange May 6, 2020, 1:11 p.m. UTC
fakeroot does mask out necessary flags, instead pass through
the flags that are supported by fstatat

Upstream BR: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=959876

Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
 package/fakeroot/0003_fix_fchownat.patch | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 package/fakeroot/0003_fix_fchownat.patch
diff mbox series

Patch

diff --git a/package/fakeroot/0003_fix_fchownat.patch b/package/fakeroot/0003_fix_fchownat.patch
new file mode 100644
index 0000000000..d200654910
--- /dev/null
+++ b/package/fakeroot/0003_fix_fchownat.patch
@@ -0,0 +1,24 @@ 
+Description: fix chownat/chmodat when pathname is empty
+ this forwards all supported flags to fstatat,
+ instead of masking them out and causing errors.
+
+--- a/libfakeroot.c
++++ b/libfakeroot.c
+@@ -886,7 +886,7 @@
+   /* If AT_SYMLINK_NOFOLLOW is set in the fchownat call it should
+      be when we stat it. */
+   INT_STRUCT_STAT st;
+-  r=INT_NEXT_FSTATAT(dir_fd, path, &st, (flags & AT_SYMLINK_NOFOLLOW));
++  r=INT_NEXT_FSTATAT(dir_fd, path, &st, (flags & (AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH | AT_NO_AUTOMOUNT)));
+
+   if(r)
+     return(r);
+@@ -1023,7 +1023,7 @@
+
+   /* If AT_SYMLINK_NOFOLLOW is set in the fchownat call it should
+      be when we stat it. */
+-  r=INT_NEXT_FSTATAT(dir_fd, path, &st, flags & AT_SYMLINK_NOFOLLOW);
++  r=INT_NEXT_FSTATAT(dir_fd, path, &st, flags & (AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH | AT_NO_AUTOMOUNT));
+
+   if(r)
+     return(r);