Re: mutt's buffy-list

2008-08-29 Thread Matthew Dillon

:On Wed, Aug 27, 2008 at 12:49:13PM -0700, Matthew Dillon wrote:
:> 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.
:
:At least nlinks == 2 is a hard-coded assumption for leaf directories in
:various programs like find(1). You don't have to change the link count
:for every file create/destroy, only directories.
:
:Joerg

It's reasonable and doable within the current design, I'll put it on
the TODO list but cannot make any promises for 2.2.  I have to see how
the other features are going to shape up.

-Matt
Matthew Dillon 
<[EMAIL PROTECTED]>


Re: mutt's buffy-list

2008-08-28 Thread YONETANI Tomokazu
On Wed, Aug 27, 2008 at 07:18:42PM +0200, Joerg Sonnenberger 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.

But I couldn't think of a situation where it's really helpful when
directories always have non-zero size.

Cheers.


Re: mutt's buffy-list

2008-08-28 Thread Joerg Sonnenberger
On Wed, Aug 27, 2008 at 12:49:13PM -0700, Matthew Dillon wrote:
> 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.

At least nlinks == 2 is a hard-coded assumption for leaf directories in
various programs like find(1). You don't have to change the link count
for every file create/destroy, only directories.

Joerg


Re: mutt's buffy-list

2008-08-27 Thread YONETANI Tomokazu
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.


Re: mutt's buffy-list

2008-08-27 Thread Matthew Dillon

: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]>


Re: mutt's buffy-list

2008-08-27 Thread Joerg Sonnenberger
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


Re: mutt's buffy-list

2008-08-27 Thread Simon 'corecode' Schubert
On Wed, August 27, 2008 17:01, YONETANI Tomokazu wrote:
> Hello.
> Since I have switched /home to a HAMMER PFS, mutt stopped reporting
> mailboxes with new messages.  Digging mutt source code, I found something
> relavant:
>
>
> mutt_buffy_check:
>
>
> if (stat (tmp->path, &sb) != 0 || sb.st_size == 0 || (!tmp->magic &&
> (tmp->magic = mx_get_magic (tmp->path)) <= 0))
> {
> /* if the mailbox still doesn't exist, set the newly created flag to
> * be ready for when it does. */
> tmp->newly_created = 1; tmp->magic = 0; tmp->size = 0; continue; }
>
>
> As HAMMER always reports st_size of directories to be 0, mutt thinks
> that the mailbox is specified in $mailboxes but doesn't exist(yet). 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?

SUSv3 says:

off_t st_sizeFor regular files, the file size in bytes.
 For symbolic links, the length in bytes of the
 pathname contained in the symbolic link.
[SHM]
 For a shared memory object, the length in bytes.

[TYM]
 For a typed memory object, the length in bytes.

 For other file types, the use of this field is
 unspecified.

Doesn't say anything about directories, so I guess mutt is wrong.

cheers
  simon



mutt's buffy-list

2008-08-27 Thread YONETANI Tomokazu
Hello.
Since I have switched /home to a HAMMER PFS, mutt stopped reporting
mailboxes with new messages.  Digging mutt source code, I found something
relavant:

mutt_buffy_check:

if (stat (tmp->path, &sb) != 0 || sb.st_size == 0 ||
(!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0))
{
  /* if the mailbox still doesn't exist, set the newly created flag to
   * be ready for when it does. */
  tmp->newly_created = 1;
  tmp->magic = 0;
  tmp->size = 0;
  continue;
}

As HAMMER always reports st_size of directories to be 0, mutt thinks
that the mailbox is specified in $mailboxes but doesn't exist(yet).
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?

Cheers.