Quoting Johannes Schauer Marin Rodrigues (2026-07-09 16:26:10)
> Quoting Johannes Schauer Marin Rodrigues (2026-07-09 11:10:22)
> > I observed that the command which fails (for both ucf as well as openssh
> > postinst) is a cp carrying the -Z argument.
> > 
> > If you happen to have a hunch which commit between 2.0-1 and 2.1.1-1 
> > could've
> > broken cp with SELinux I could try reverting that commit and see if that 
> > fixes
> > it.
> 
> looking at the differences between 2.0-1 and 2.1.1-1 I found that this patch
> makes the issue go away:
> 
> --- a/libfakeroot.c
> +++ b/libfakeroot.c
> @@ -2038,8 +2038,8 @@ ssize_t flistxattr(int fd, char *list, size_t size)
>  
>    r = next_flistxattr(fd, list, size);
>    if (fakeroot_disabled
> -      || r > 0
> -      || (r < 0 && errno != EPERM && errno != EOPNOTSUPP))
> +      || r >= 0
> +      || (errno != EPERM && errno != EOPNOTSUPP))
>      return r;
>    errno = 0;

the patch can be made a bit smaller even:

--- a/libfakeroot.c
+++ b/libfakeroot.c
@@ -2038,7 +2038,7 @@ ssize_t flistxattr(int fd, char *list, size_t size)
 
   r = next_flistxattr(fd, list, size);
   if (fakeroot_disabled
-      || r > 0
+      || r >= 0
       || (r < 0 && errno != EPERM && errno != EOPNOTSUPP))
     return r;
   errno = 0;
 

You might also want to disregard the conditions necessary for the bug to appear
because it's flaky. While testing this I saw that sometimes the same error
would get triggered even without a foreign arch being involved. It just seems
to be reproducible more reliably when a foreign arch is involved for some
reason.

Just to make sure: I have no idea what I'm doing and hope that you can make
some sense out of this. I'm testing the patch in the dpkg-root-demo salsa CI
pipeline of this MR:

https://salsa.debian.org/helmutg/dpkg-root-demo/-/merge_requests/15

Thanks!

cheers, josch

Attachment: signature.asc
Description: signature

Reply via email to