Truncated symlink on jffs2

Stéphane Doyon s.doyon at videotron.ca
Thu Dec 27 17:51:49 EST 2001


On Thu, 27 Dec 2001, David Woodhouse wrote:

> 
> s.doyon at videotron.ca said:
> >  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? 
> 
> Bug. Thanks for pointing it out. We should be setting i_size. Something like
> this ought to do it for _new_ symlinks, although we should probably contrive
> a hack for jffs2_read_inode() to make it dtrt on older filesystems too:
> 
> ===================================================================
> RCS file: /home/cvs/mtd/fs/jffs2/dir.c,v
> retrieving revision 1.44
> diff -u -r1.44 dir.c
> --- fs/jffs2/dir.c	2001/11/06 17:58:41	1.44
> +++ fs/jffs2/dir.c	2001/12/27 11:50:08
> @@ -542,7 +542,7 @@
>  
>  	f = JFFS2_INODE_INFO(inode);
>  
> -	ri->dsize = ri->csize = strlen(target);
> +	ri->isize = ri->dsize = ri->csize = strlen(target);
>  	ri->totlen = sizeof(*ri) + ri->dsize;
>  	ri->hdr_crc = crc32(0, ri, sizeof(struct jffs2_unknown_node)-4);
>  
> 
> 
> 
> --
> dwmw2
> 
> 
> 

OK. Well unless I'm doing something wrong, it doesn't seem to fix it for 
me: modified my kernel, made a new symlink using ln, lstat'ed it: still 
says st_size is 0.

Is the fix correct, and will it work on a 2.4.16-rmk1-hh5 kernel?

Thanks

-- 
Stéphane Doyon
<s.doyon at videotron.ca>
http://pages.infinit.net/sdoyon/





More information about the linux-mtd mailing list