Skip Menu |

This queue is for tickets about the Mail-Box CPAN distribution.

Report information
The Basics
Id: 58550
Status: resolved
Priority: 0/
Queue: Mail-Box

People
Owner: Nobody in particular
Requestors: skangas [...] skangas.se
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: PATCH: Do not unnecessarily add info field to mail in maildir `new' directory
Date: Mon, 21 Jun 2010 07:20:12 +0200
To: bug-Mail-Box [...] rt.cpan.org
From: Stefan Kangas <skangas [...] skangas.se>
In his write-up "Using maildir format", Daniel Bernstein states: ,---- | When you move a file from new to cur, you have to change its name from | uniq to uniq:info. Make sure to preserve the uniq string, so that | separate messages can't bump into each other. `---- Mail::Box::Maildir::Message currently appends an info field (":2,") to all maildir messages, even if they are still inside the "new" directory. Alas, some other software (notably Gnus) relies on the assumption that there is no info field until the message is moved into the "cur" directory, and naively adds another info field without checking for an old one. The result is duplicate info fields. Mutt, on the other hand, seems to have taken the middle ground, adding an info field to messages inside "new" only when there are any flags. I believe this to be a conservative approach that wins on two accounts: it never loses any information, yet for the most part plays nice with other, perhaps not as cautious software. I suggest Mail::Box::Maildir::Message should do like Mutt, and the attached patch does this change. The relevant test has also been updated. Thanks, Stefan Kangas
Subject: Re: [rt.cpan.org #58550] AutoReply: PATCH: Do not unnecessarily add info field to mail in maildir `new' directory
Date: Mon, 21 Jun 2010 07:25:43 +0200
To: bug-Mail-Box [...] rt.cpan.org
From: Stefan Kangas <skangas [...] skangas.se>
diff -Naur Mail-Box-2.094/lib//Mail/Box/Maildir/Message.pm Mail-Box-2.094p1/lib//Mail/Box/Maildir/Message.pm --- Mail-Box-2.094/lib//Mail/Box/Maildir/Message.pm 2010-04-06 11:17:24.000000000 +0200 +++ Mail-Box-2.094p1/lib//Mail/Box/Maildir/Message.pm 2010-06-21 06:02:44.000000000 +0200 @@ -99,7 +99,10 @@ $folder->modified(1) if defined $folder; } - my $new = File::Spec->catfile($folderdir, $newset, "$oldname:2,$newflags"); + my $newname = $oldname + . ($newset eq 'new' && $newflags eq '' ? '' : ":2,$newflags"); + + my $new = File::Spec->catfile($folderdir, $newset, $newname); if($new ne $old) { unless(move $old, $new) diff -Naur Mail-Box-2.094/tests//42maildir/20write.t Mail-Box-2.094p1/tests//42maildir/20write.t --- Mail-Box-2.094/tests//42maildir/20write.t 2010-04-06 11:17:24.000000000 +0200 +++ Mail-Box-2.094p1/tests//42maildir/20write.t 2010-06-21 02:18:00.000000000 +0200 @@ -110,7 +110,7 @@ ok($msg12->label('accepted'), "12 accepted"); cmp_ok($msg12->label(accepted => 0), '==', 0, 'un-accept a message'); ok(! $msg12->label('accepted')); -is($msg12->filename, 'folders/maildir.src/new/110000010.l.43:2,'); +is($msg12->filename, 'folders/maildir.src/new/110000010.l.43'); ok(!$msg12->modified); # message is not modified ok($folder->modified); # ... but the folder is modified # (which implies nothing)
Subject: Re: [rt.cpan.org #58550] PATCH: Do not unnecessarily add info field to mail in maildir `new' directory
Date: Mon, 21 Jun 2010 09:44:01 +0200
To: Stefan Kangas via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Stefan Kangas via RT (bug-Mail-Box@rt.cpan.org) [100621 05:20]: Show quoted text
> Mon Jun 21 01:20:33 2010: Request 58550 was acted upon. > Transaction: Ticket created by skangas@skangas.se > Queue: Mail-Box > Subject: PATCH: Do not unnecessarily add info field to mail in maildir `new' directory > > I suggest Mail::Box::Maildir::Message should do like Mutt, and the > attached patch does this change. The relevant test has also been > updated.
Clear. Thanks for the patch. -- MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
fixed in 2.095, to be released today