Are you sure this is a problem?
Fakeroot cannot wrap the open syscall. As a result, it has no way
of knowing whether a file was created before or after fakeroot was
run. To compensate for that, it treats all unknown files as owned
by root.
Fakeroot-ng does wrap the open syscall, and thus does not do
that. A file will only be shown as owned by root if it was created
through fakeroot-ng. This is the intended behavior, as it more
closely matches that or running as real root.
Please verify that this is still a bug.
On 15/01/2022 17:16, Christoph Biedl
wrote:
Package: fakeroot-ng
Version: 0.18-4.1
Severity: normal
Dear maintainer,
while working on #1001961 in fakeroot, I noticed the stat() call is not
properly wrapped by fakeoot-ng, and appearently never did - I checked
back to Debian 8 ("jessie").
Reproducer: Build the program below and run under either fakeroot or
fakeroot-ng.
Expected output (observed with fakeroot):
I: UID is 0, '.' is owned by 0
I: Pass
Received output:
I: UID is 0, '.' is owned by 1000
E: UID mismatch
While I haven't checked it, this should also break the python-apt
autopkgtest if it were run using fakeroot-ng instead of fakeroot.
See the bug# mentioned above for an explanation.
To me, it seems prudent to add this to have feature parity.
Regards,
Christoph
-- System Information:
Debian Release: bookworm/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 5.10.89 (SMP w/8 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages fakeroot-ng depends on:
ii libc6 2.33-2
ii libgcc-s1 11.2.0-14
ii libstdc++6 11.2.0-14
fakeroot-ng recommends no packages.
fakeroot-ng suggests no packages.
-- no debconf information
-
#include
#include
#include
#include
#include
int main (int argc, char **argv) {
struct stat statbuf;
if (stat (".", &statbuf)) {
perror("Cannot stat '.'");
exit(1);
}
uid_t uid = getuid();
printf("I: UID is %u, '.' is owned by %u\n", uid, statbuf.st_uid);
if (uid == statbuf.st_uid) {
if (uid) {
printf("W: UID is not zero - not running under fakeroot?\n");
} else {
printf("I: Pass\n");
}
} else {
printf("E: UID mismatch\n");
}
}
-