On Wed, Aug 27, 2008 at 12:49:13PM -0700, Matthew Dillon wrote: > > :On Thu, Aug 28, 2008 at 12:01:50AM +0900, YONETANI Tomokazu wrote: > :> My questions are, is checking st_size of a directory is usual on other > :> platforms/filesystems? Does anyone know of other filesystems on which > :> a directory can have st_size of zero? > : > :I don't know any filesystem where the directories have a fixed size of > :0. I don't think that should be done, it is helpful for other things. > : > :Nevertheless, it should likely check the link count... > : > :Joerg > > HAMMER directory entries are not applied to the directory's link count. > I'm not going to update the directory inode whenever a file is > created or deleted. > > A HAMMER directory has an st_size of zero. It isn't a regular file. > Each directory entry is a B-Tree record. > > I could fake it I guess, but programs really have no business making > assumptions about directories based on their st_nlinks or st_size > fields. > > -Matt > Matthew Dillon > <[EMAIL PROTECTED]>
I think that `sb.st_size == 0' is assuming mbox (or any other mailbox types whose messages are stored in a single file), and for other mailbox types it's a no-op as the side-effect that a st_size of a directory is greater than zero on most other filesystems. I'll ask mutt-dev people to change it to (S_ISREG(sb.st_mode) && sb.st_size == 0) || Thanks.
