public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Truncated symlink on jffs2
@ 2001-12-24 14:15 Stéphane Doyon
  2001-12-27 11:51 ` David Woodhouse
  0 siblings, 1 reply; 4+ messages in thread
From: Stéphane Doyon @ 2001-12-24 14:15 UTC (permalink / raw)
  To: linux-mtd; +Cc: Stéphane Doyon

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@videotron.ca>
http://pages.infinit.net/sdoyon/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-12-27 22:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-24 14:15 Truncated symlink on jffs2 Stéphane Doyon
2001-12-27 11:51 ` David Woodhouse
2001-12-27 22:51   ` Stéphane Doyon
2001-12-27 22:59     ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox