On Tue, 13 Nov 2007 03:25:27 -0500, Mark Overmeer via RT wrote:
Show quoted text> Somehow, your remarks got lost, and therefore ignored. Let's
> get back in the debate.
No problem, and thanks for digging up the lost mail!
Show quoted text> > Celejar has found out that auto-detecting works if the folder
> > contains a file named "1", and I've found at least to lines in the
> > code (in lib/Mail/Box/MH.pm and in lib/Mail/Box/Mbox.pm) where you
> > explicitly test for the existence of $directory/1 or $filename/1.
> In the MH case, the "1" is used as first fast attempt to detect it,
> if fails, a slower approach is taken. This seems sound.
Ok.
Show quoted text> On the other hand, the mbox auto-detect which is tried before the
> MH is called is too lazy. I have improved it from
>
> if(-d $filename) # fake empty folder, with sub-folders
> { return 1 unless -f File::Spec->catfile($filename, '1') # MH
> || -d File::Spec->catdir($filename, 'cur'); # Maildir
> }
>
> into
>
> if(-d $filename) # fake empty folder, with sub-folders
> { return 0 if -d File::Spec->catdir($filename, 'cur'); # Maildir
> local *DIR;
> if(opendir DIR, $filename)
> { my @f = grep !/^\.\.?$/, readdir DIR;
> return 0 if @f && ! grep /\D/, @f; # MH
> closedir DIR;
> }
> return 1;
> }
>
> [untested, but looks healthy]
It looks indeed good; a short test (with the original submitters test
folder from sylpheed) shows another problem:
$ find inbox/
inbox/
inbox/new
inbox/new/.sylpheed_mark
inbox/new/.sylpheed_cache
inbox/2
inbox/1
inbox/3
inbox/6
inbox/.sylpheed_mark
inbox/4
inbox/.sylpheed_cache
inbox/5
"inbox" is not detected as an MH folder because of new and .syl*
Changing the above line to
return 0 if @f && grep /^\d+$/, @f; # MH
catches this case but obviously leads to false positives in other
cases (mbox files with only-digits-filenames).
I don't know if there is a solution that fits all cases ...
Show quoted text> Please keep in mind that auto-detection can not always distinguish
> the folder-types, although comflicts are rare.
Right.
Show quoted text> Thanks for your effort, sorry for the delay.
Thank you!
Cheers,
gregor
--
.''`.
http://info.comodo.priv.at/ | gpg key ID: 0x00F3CFE4
: :' : debian: the universal operating system -
http://www.debian.org/
`. `' member of
https://www.vibe.at/ | how to reply:
http://got.to/quote/
`-