#580421 ls -l returning Bad Address on unioned symlink only inside fakechroot

#580421#5
Date:
2010-05-05 21:19:35 UTC
From:
To:
I am mounting a union filesystem into mounts/union, and fakechrooting
into there. Here's the issue:

mounts/union/usr/lib/libglib-2.0.so.0 is a symlink to the correct
version of libglib, as it is in all Linux systems. Therefore,

daniil@daniil-laptop:~/pafl/abiword$ ls -l
mounts/union/usr/lib/libgoffice-0.8.so.8
lr-xr-xr-x 1 root root 0 2010-05-04 19:48
mounts/union/usr/lib/libgoffice-0.8.so.8 -> libgoffice-0.8.so.8.0.1

Which is correct behavior. However, when I chroot into the union,

daniil@daniil-laptop:~/pafl/abiword$ USER=default HOME=/home/default
utils/fakechroot -l/home/daniil/pafl/abiword/utils/libfakechroot.so
chroot mounts/union
default@daniil-laptop:/$ ls -l /usr/lib/libgoffice-0.8.so.8
ls: cannot read symbolic link /usr/lib/libgoffice-0.8.so.8: Bad address
lr-xr-xr-x 1 0 0 0 2010-05-04 19:48 /usr/lib/libgoffice-0.8.so.8

That gives 'Bad address', as does the full path:

default@daniil-laptop:/$ ls -l
/home/daniil/pafl/abiword/mounts/union/usr/lib/libgoffice-0.8.so.8
ls: cannot read symbolic link
/home/daniil/pafl/abiword/mounts/union/usr/lib/libgoffice-0.8.so.8:
Bad address
lr-xr-xr-x 1 0 0 0 2010-05-04 19:48
/home/daniil/pafl/abiword/mounts/union/usr/lib/libgoffice-0.8.so.8

Strangely enough,

default@daniil-laptop:/$ readlink /usr/lib/libgoffice-0.8.so.8
libgoffice-0.8.so.8.0.1

readlink seems to work fine. What's going on?

By the way, I will point out that the union is between one of my
directories and /. /usr/lib/libglib works fine, because it's part of /,
but /usr/lib/libgoffice does not, and it's part of the application
directory that is unioned on top of /. However, I'll point out again
that outside the chroot, the unioned symlink works fine. It seems that
for some reason, chroot is clashing somehow with the unioned files.