Truncated symlink on jffs2
Stéphane Doyon
s.doyon at videotron.ca
Mon Dec 24 09:15:22 EST 2001
Hi,
I'm not subscribed, so please Cc me.
I must be missing something, I find it hard to believe that no one would
have noticed this before... but I couldn't find any reference to this.
I wanted to backup my Compaq iPaq's flash. Using kernel 2.4.16-rmk1-hh5,
but also happens on earlier versions. I used tar version 1.13.19 to backup to
NFS.
Many (but not all) of my symlinks ended up with the target truncated to
one character. For instance the symlinks in /lib would all point to "l".
Absolute symlinks would point to "/".
It seems this happens only with symlinks I created on the iPaq using ln,
while those that were created by mkfs.jffs2 are OK.
Calling readlink on the link yields the correct response. Using cp -a does
the right thing.
Strac'ing tar, I see that it does an lstat of the symlink, and gets an
st_size of 0. It then calls readlink with a buffer of size 1.
I was able to reproduce this on x86, kernel 2.4.17, with mtdram:
modprobe mtdram
modprobe mtdblock
mount -t jffs2 /dev/mtdblock0 /mnt
cd /mnt
ln -s abcdef ghi
/home/some_user/lstat ghi
where lstat is a tiny program that does lstat(argv[1], &st) and
printf("size: %lu\n", st.st_size);. It outputs 0, but it should say 6
(which it does on a symlink created on another fs).
Is this a bug or a known limitation? The fact that tar relies on lstat was
a problem for me as I had to recreate tens of symlinks before my backup
worked again.
Thanks for any explanation!
--
Stéphane Doyon
<s.doyon at videotron.ca>
http://pages.infinit.net/sdoyon/
More information about the linux-mtd
mailing list