Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symbolic link resolution fails and files outside fakechroot can be accessed #3

Closed
josch opened this issue Mar 14, 2012 · 0 comments
Closed

Comments

@josch
Copy link

josch commented Mar 14, 2012

Following test setup:

sudo debootstrap --variant=minbase sid /tmp/test-chroot
echo foo > /tmp/foo
echo bar > /tmp/test-chroot/tmp/bar
ln -s /tmp/bar /tmp/test-chroot/link1
ln -s /tmp/foo /tmp/test-chroot/link2
ln -s /tmp/test-chroot/tmp/bar /tmp/test-chroot/link3

First test: readlink

$ fakeroot fakechroot chroot /tmp/test-chroot/ readlink /link1
/tmp/bar
$ fakeroot fakechroot chroot /tmp/test-chroot/ readlink /link2
/tmp/foo
$ fakeroot fakechroot chroot /tmp/test-chroot/ readlink /link3
/tmp/bar

The third link should read /tmp/test-chroot/tmp/bar as it was created
like that. To check:

$ sudo chroot /tmp/test-chroot/ readlink /link1
/tmp/bar
$ sudo chroot /tmp/test-chroot/ readlink /link2
/tmp/foo
$ sudo chroot /tmp/test-chroot/ readlink /link3
/tmp/test-chroot/tmp/bar

Second test: cat links

$ fakeroot fakechroot chroot /tmp/test-chroot/ cat /link1
cat: /link1: No such file or directory
$ fakeroot fakechroot chroot /tmp/test-chroot/ cat /link2
foo
$ fakeroot fakechroot chroot /tmp/test-chroot/ cat /link3
bar

/link1 should've been resolved correctly, because /tmp/bar exists in
/tmp/test-chroot. /link2 should not have resolved because /tmp/foo only
exists outside the chroot. /link3 should not have been resolved either
because /tmp/test-chroot/tmp/bar is only visible like that from outside
the chroot. To check:

$ sudo chroot /tmp/test-chroot/ cat /link1
bar
$ sudo chroot /tmp/test-chroot/ cat /link2
cat: /link2: No such file or directory
$ sudo chroot /tmp/test-chroot/ cat /link3
cat: /link3: No such file or directory

Third test: cat files

$ fakeroot fakechroot chroot /tmp/test-chroot/ cat /tmp/bar
bar
$ fakeroot fakechroot chroot /tmp/test-chroot/ cat /tmp/foo
cat: /tmp/foo: No such file or directory
$ fakeroot fakechroot chroot /tmp/test-chroot/ cat /tmp/test-chroot/tmp/bar
cat: /tmp/test-chroot/tmp/bar: No such file or directory

all works as expected

$ sudo chroot /tmp/test-chroot/ cat /tmp/bar
bar
$ sudo chroot /tmp/test-chroot/ cat /tmp/foo
cat: /tmp/foo: No such file or directory
$ sudo chroot /tmp/test-chroot/ cat /tmp/test-chroot/tmp/bar
cat: /tmp/test-chroot/tmp/bar: No such file or directory

As a result I suspect there is something wrong with readlink and open?

Hope all this helps a bit to fix the issue.

cheers, josch

@dex4er dex4er closed this as completed Nov 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants