bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug] tmpfs assert failure


From: Marcus Brinkmann
Subject: Re: [bug] tmpfs assert failure
Date: Sun, 3 Aug 2003 16:53:04 +0200
User-agent: Mutt/1.5.4i

On Sun, Aug 03, 2003 at 12:51:27PM +0200, Alfred M. Szmidt wrote:
> Hi,
> 
> The following problem exists with tmpfs:
> 
> $ settrans -ac tmp /hurd/tmpfs 10MB
> $ cd tmp
> $ ls
> tmpfs: /src-cvs/hurd/tmpfs/dir.c:62: diskfs_gets_directs: Assertion 
> `((size_t) &((struct tmpfs_dirent *)0)->name) >= ((size_t) &((struct dirent 
> *)0)->d_name' failed.
> ls: reading directory .: Computer bought the farm
> $

This code is kinda stupid.  The problem is making a guess at the buffer size
you need to store all directory entries.  Roland's idea was that the tmpfs
internal structure is always at least as big as the dirent structure, so you
can just take the directory size, plus the size for two entries with up to
three bytes for the name each (ie '.', '.', '\0').  That's what the
assertion is for.  With the change to 64 bit types in dirent this is not
true anymore.

Just adding some padding to struct tmpfs_dirent.  Can you try this in
tmpfs.h:

 struct tmpfs_dirent
 {
   struct tmpfs_dirent *next;
+  char _pad1[4];
   struct disknode *dn;
+  char _pad2[4];
   uint8_t namelen;
   char name[0];
 };

This is of course rather stupid, but should work.  Roland might have a
better idea about how to fix it, though ;)

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' GNU      http://www.gnu.org    marcus@gnu.org
Marcus Brinkmann              The Hurd http://www.gnu.org/software/hurd/
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]