Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: gwolf [...] debian.org
Cc:
AdminCc:

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



Subject: Mail::Message::Head::Complete::guessTimestamp complains for mails with no 'date' or 'received' headers
I got this report against Mail::Box in Debian - The submitter didn't include the version information. This bug is quite dated, though, but you can look at the original bug report at: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=257162 ------------------ sub guessTimestamp() { my $self = shift; return $self->{MMH_timestamp} if exists $self->{MMH_timestamp}; my $stamp; if(my $date = $self->get('date')) { $stamp = Mail::Message::Field->dateToTimestamp($date); } unless($stamp) { foreach (reverse $self->get('received')) { $stamp = Mail::Message::Field->dateToTimestamp($_->comment); last if $stamp; } } $self->{MMH_timestamp} = $stamp > 0 ? $stamp : undef; } If neither header is present, $stamp is undef, so you get a warning on '$stamp > 0'.
This is a bit weird, and the suggestion is not the solution: the method should always return a valid value. If a message is created using the provided MailBox methods, like build(), it willo have a Date field. If it is an incoming message, the mail-delivery agent will add received lines. So: the question is: why aren't we in either case? Is a different line added? The only good fix is to produce a time-stamp based on some other fact. Which fact?
From: ntyni [...] iki.fi
Show quoted text
> If a message is created using the provided MailBox methods, like > build(), it willo have a Date field. If it is an incoming message, > the > mail-delivery agent will add received lines. So: the question is: why > aren't we in either case? Is a different line added?
Hi, FWIW, I forwarded this question to the original bug reporter, Andrew Suffield. He doesn't remember any more how he ended up with such a message. His guess is that it was acquired with Mail::Message->read() from an external, probably "not strictly valid" source. The reply can be found in the Debian bug report, http://bugs.debian.org/257162 I could think of a MUA appending an outgoing message into a 'Sent' folder, without including 'Date:'. This is a bit far-fetched, of course, and such a MUA should obviously be fixed. Show quoted text
> The only good fix is to produce a time-stamp based on some other fact. > Which fact?
A sensible last resort could be the current time, IMO. Some other (but maybe overkill) ideas might be the average of the time stamps of the previous and the next message in the folder, if available, or the mtime of the message file, for Maildir-type folders. Or the date from the '^From ' line in Mbox-type folders. Andrew Suffield suggests that it might not be unreasonable even to bail out and throw an exception, although something more permissive would be nice. Cheers, -- Niko Tyni (on behalf of the Debian Perl Group) ntyni@iki.fi
Show quoted text
> I could think of a MUA appending an outgoing message into a 'Sent' > folder, without including 'Date:'. This is a bit far-fetched, of > course and such a MUA should obviously be fixed.
But... before MailBox sends the message, it will always be translated to a Mail::Message object, which will always automatically get a MessageID and a Date field it it hasn't already.... Show quoted text
> A sensible last resort could be the current time, IMO. Some other (but > maybe overkill) ideas might be the average of the time stamps of the > previous and the next message in the folder, if available, or the > mtime > of the message file, for Maildir-type folders. Or the date from the > '^From ' line in Mbox-type folders.
These time-stamps are made by the same MTA which adds 'received' headers to the message. And those are apparently not present. To me it seems useless to spend more time hunting down bugs based on a bug-report which doesn't provide sufficient information. Can we close this, please.
From: Gunnar Wolf
Show quoted text
> (...) > To me it seems useless to spend more time hunting down bugs based on a > bug-report which doesn't provide sufficient information. Can we close > this, please.
I completely agree on this. The original bug report in Debian (which I re-reported here) has been already closed (Thanks, Niko!)