When the directory $PWD does not exist inside the guest rootfs:
-r will print a warning and chdir() to /-R fails to print a warning and fails to chdir()-S fails just like -R
Steps to Reproduce the Problem
I am running in this directory.
$ pwd
/home/hack/20211018_ubuntu_rootfs
$ ls
proot-v5.2.0-x86_64-static squashfs-root
squashfs-root is an Ubuntu 21.04 userland extracted from the official Ubuntu 21.04 installation .iso file. However, you should be able to reproduce this problem with just about any userland.
We now make sure that $PWD does not exist inside squashfs-root:
Now we can reproduce the difference between -r and -R:
$ ./proot-v5.2.0-x86_64-static -r squashfs-root/ pwd
proot warning: can't chdir("/home/hack/20211018_ubuntu_rootfs/./.") in the guest rootfs: No such file or directory
proot info: default working directory is now "/"
/
$ ./proot-v5.2.0-x86_64-static -R squashfs-root/ pwd
/home/hack/20211018_ubuntu_rootfs
$ ./proot-v5.2.0-x86_64-static -r squashfs-root/ ls
proot warning: can't chdir("/home/hack/20211018_ubuntu_rootfs/./.") in the guest rootfs: No such file or directory
proot info: default working directory is now "/"
bin dev home lib32 libx32 mnt proc run snap sys usr
boot etc lib lib64 media opt root sbin srv tmp var
$ ./proot-v5.2.0-x86_64-static -R squashfs-root/ ls
proot-v5.2.0-x86_64-static squashfs-root
Note that -R fails to print the warning that $PWD does not exist.
Note that -R runs the pwd and ls commands in the host's file-system, rather than in the guest's file-system. IMO, this is a bug.
Specifications
Proot/Care version: Proot is v5.2.0. I don't know the Care version.
Kernel version: Linux 5.4.0-80-generic #90-Ubuntu
Host distribution: Ubuntu 20.04.3 LTS
Guest distribution: Ubuntu 21.04
Command Output
The command output is listed above in the steps-to-reproduce section.
Expected Behavior
I expect
-r
and-R
(and-S
) to behave similarly.Actual Behavior
When the directory
$PWD
does not exist inside the guest rootfs:-r
will print a warning andchdir()
to/
-R
fails to print a warning and fails tochdir()
-S
fails just like-R
Steps to Reproduce the Problem
I am running in this directory.
squashfs-root
is an Ubuntu 21.04 userland extracted from the official Ubuntu 21.04 installation.iso
file. However, you should be able to reproduce this problem with just about any userland.We now make sure that
$PWD
does not exist insidesquashfs-root
:Now we can reproduce the difference between
-r
and-R
:Note that
-R
fails to print the warning that$PWD
does not exist.Note that
-R
runs thepwd
andls
commands in the host's file-system, rather than in the guest's file-system. IMO, this is a bug.Specifications
Linux 5.4.0-80-generic #90-Ubuntu
Command Output
The command output is listed above in the steps-to-reproduce section.