mh and mairix and numerically named folders

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

mh and mairix and numerically named folders

Paul Fox-3
yesterday i had reason to create a folder with an all-numeric name.  i
hesitated, but decided it would probably be just fine, and it did seem
to work.  nmh has no problems with it that i can see.

but when mairix ran overnight, to update the mairix database, i got
this error:
    Cannot add '/home/pgf/Mail/./8020' to database; stat() failed

as far as i can tell, by skimming the mairix source, mairix is
assuming that since the name is numeric that it must be a message
file, and the (erroneous) error message isn't because the stat()
failed, but because the referenced path isn't a regular file.

so my question, before i report this as a limitation with mairix:  is
there any reason that an MH folder shouldn't have an all-numeric name?
i did grep the man pages a bit, but didn't find a specification for
folder names

paul
=----------------------
 paul fox, [hidden email] (arlington, ma, where it's 53.4 degrees)


_______________________________________________
Nmh-workers mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: mh and mairix and numerically named folders

Conrad Hughes
Paul> so my question, before i report this as a limitation with mairix:
Paul> is there any reason that an MH folder shouldn't have an
Paul> all-numeric name?

It caused all kinds of trouble when I last tried it: you can imagine
what happens to things like sortm and 'folder -pack' on the containing
folder...

You might be able to get away with it so long as there are never any
other messages in the containing folder, but I'd expect breakage.

Conrad

_______________________________________________
Nmh-workers mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: mh and mairix and numerically named folders

Ken Hornstein-2
In reply to this post by Paul Fox-3
>so my question, before i report this as a limitation with mairix:  is
>there any reason that an MH folder shouldn't have an all-numeric name?
>i did grep the man pages a bit, but didn't find a specification for
>folder names

So, the answer is ... you should not have a folder with an all-numeric name.

I looked at folder_read(), the main function that nmh uses to scan a
folder and create the folder structure (which contains an index of all
valid messages).  It calls readdir() on a directory and checks to see if
atoi() works on the filename; if it succeeds then it assumes that it's a
message.  It does NOT check if the file is a directory or not (normally
stat() is not called on every message as that would be too expensive).
In theory you could use d_type that's part of struct dirent to see if
it's a file or not, but not all operating systems or filesystems support
that and I am reluctant to change long-standing practice for what is
admittedly an edge case.

While it may 'work' in the short term, I think like Conrad said you'll
run into problems in the long run.

--Ken

_______________________________________________
Nmh-workers mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: mh and mairix and numerically named folders

Ralph Corderoy
Hi Ken,

> While it may 'work' in the short term, I think like Conrad said you'll
> run into problems in the long run.

So things like refile(1) that create a folder need to reject +42, if
they don't already?  But allow 42 in +/foo/42/bar?

Cheers, Ralph.

_______________________________________________
Nmh-workers mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: mh and mairix and numerically named folders

Norman Shapiro-3
In reply to this post by Ken Hornstein-2
Ken Hornstein <[hidden email]> writes:

>>so my question, before i report this as a limitation with mairix:  is
>>there any reason that an MH folder shouldn't have an all-numeric name?
>>i did grep the man pages a bit, but didn't find a specification for
>>folder names
>
>So, the answer is ... you should not have a folder with an all-numeric name.
>
>I looked at folder_read(), the main function that nmh uses to scan a
>folder and create the folder structure (which contains an index of all
>valid messages).  It calls readdir() on a directory and checks to see if
>atoi() works on the filename; if it succeeds then it assumes that it's a
>message.  It does NOT check if the file is a directory or not (normally
>stat() is not called on every message as that would be too expensive).
>In theory you could use d_type that's part of struct dirent to see if
>it's a file or not, but not all operating systems or filesystems support
>that and I am reluctant to change long-standing practice for what is
>admittedly an edge case.
>
>While it may 'work' in the short term, I think like Conrad said you'll
>run into problems in the long run.

It is interesting that, to the best of my memory, we never considered the
possibility that an MH directory could have a numeric name. Though, that
might be more a function of my memory than of history.

We certainly did consider and extensively discuss possible message names
before deciding that they were to be numeric.


    Norman Shapiro

_______________________________________________
Nmh-workers mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: mh and mairix and numerically named folders

Paul Fox-3
In reply to this post by Ken Hornstein-2
ken wrote:
 > >so my question, before i report this as a limitation with mairix:  is
 > >there any reason that an MH folder shouldn't have an all-numeric name?
 > >i did grep the man pages a bit, but didn't find a specification for
 > >folder names
 >
 > So, the answer is ... you should not have a folder with an all-numeric name.

okay.  i can live with that.

i don't think the behavior needs to change, although perhaps it
shouldn't have been so easy to create the folder in the first place.
    $ refile +1234
    Create folder "/home/pgf/Mail/1234"?

a quick look says that create_folder() and rcvstore.c:main() might be
candidates for an error check.  there's also make_intermediates(), but
it's a utility function, and i don't think that it's ever used to
create a folder.

in the meantime, any objections if i add this new section to
mh-folders.man, or something like it?
    Naming
        nmh folders can be given arbitrary names, with one exception:
        folders should not be given all-numeric names.  This
        limitation results from nmh messages themselves being stored
        in numerically named files -- allowing folders to be named
        similarly would make nmh slower, and introduce usage ambiguities.

paul

 > I looked at folder_read(), the main function that nmh uses to scan a
 > folder and create the folder structure (which contains an index of all
 > valid messages).  It calls readdir() on a directory and checks to see if
 > atoi() works on the filename; if it succeeds then it assumes that it's a
 > message.  It does NOT check if the file is a directory or not (normally
 > stat() is not called on every message as that would be too expensive).
 > In theory you could use d_type that's part of struct dirent to see if
 > it's a file or not, but not all operating systems or filesystems support
 > that and I am reluctant to change long-standing practice for what is
 > admittedly an edge case.
 >
 > While it may 'work' in the short term, I think like Conrad said you'll
 > run into problems in the long run.
 >
 > --Ken
 >
 > _______________________________________________
 > Nmh-workers mailing list
 > [hidden email]
 > https://lists.nongnu.org/mailman/listinfo/nmh-workers


=----------------------
 paul fox, [hidden email] (arlington, ma, where it's 53.2 degrees)

_______________________________________________
Nmh-workers mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: mh and mairix and numerically named folders

Ken Hornstein-2
>i don't think the behavior needs to change, although perhaps it
>shouldn't have been so easy to create the folder in the first place.
>    $ refile +1234
>    Create folder "/home/pgf/Mail/1234"?

Ralph made a similar point; yeah, I'm fine with rejecting those folder
names as invalid in create_folder().  I'm a rcvstore ... hm.  It's designed
to not have any user interaction, but as long as you return with the
right exit code so mail is temporarily rejected I think it would be
fine.

>in the meantime, any objections if i add this new section to
>mh-folders.man, or something like it?
>    Naming
> nmh folders can be given arbitrary names, with one exception:
> folders should not be given all-numeric names.  This
> limitation results from nmh messages themselves being stored
> in numerically named files -- allowing folders to be named
> similarly would make nmh slower, and introduce usage ambiguities.

That looks fine to me.

--Ken

_______________________________________________
Nmh-workers mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: mh and mairix and numerically named folders

David Levine-3
In reply to this post by Paul Fox-3
Paul F. writes:

> in the meantime, any objections if i add this new section to
> mh-folders.man, or something like it?
>     Naming
> nmh folders can be given arbitrary names, with one exception:
> folders should not be given all-numeric names. This limitation
> results from nmh messages themselves being stored in numerically
> named files -- allowing folders to be named similarly would make
> nmh slower, and introduce usage ambiguities.

Nice.

There's some old discussion of this starting with http://lists.nongnu.org/archive/html/nmh-workers/2007-02/msg00003.html.

David

_______________________________________________
Nmh-workers mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/nmh-workers