Package: fakeroot
Version: 1.23-1 and earlier

The whole family of chown syscalls fail on a NFS mounted export, with option 
all_squash.
This, for example, prevents normal execution of most debhelpers (mostly from 
the dh_installXXX family).

Here's a worklog demonstrating the problem:

-----------------------------------------------------

root@astra# mount | grep /home/zap/host
192.168.122.1:/home/zap on /home/zap/host type nfs4 
(rw,nosuid,nodev,relatime,vers=4,rsize=1048576,wsize=1048576,namlen=
255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.122.189,minorversion=0,local_lock=none,addr=192
.168.122.1,user=zap)

root@astra# pwd
/home/zap/host

root@astra# mkdir test
root@astra# ls -land test
drwxr-xr-x 2 1000 100 4096 Сен 27 13:53 test

root@astra# chown 0:0 test
chown: changing ownership of `test': Invalid argument

root@astra# fakeroot chown 0:0 test
chown: changing ownership of `test': Invalid argument

root@astra# dpkg -l fakeroot
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  fakeroot       1.23-1         tool for simulating superuser privileges

-----------------------------------------------------

Note the non-fakerooted chown saying "Invalid argument" (EINVAL), nor 
"Permission denied" (EPERM).
The fakerooted chown says the same, because it does not fake chowns that return 
EINVAL.

The core of the problem lies in libfakeroot.c, in every syscall of the chown 
family there's code like this:

-----------------------------------------------------
if(!dont_try_chown())
    r=next_fchown(fd,owner,group);
  else
    r=0;

  if(r&&(errno==EPERM))
    r=0;
-----------------------------------------------------

So, as can be seen above, only EPERM is handled, but not EINVAL.

As a workaround, the FAKEROOTDONTTRYCHOWN environment variable can be set, in 
which case
the original chown syscall is not invoked at all.

Reply via email to