Mailfs Bugs/Patches



Hi,

With the current mailfs implementation, I ran into some problems:

1.) By definition (see e.g. http://www.qmail.org/man/man5/mbox.html),
    in a Berkeley MBox File,the beginning of a message is marked by a line
    starting with "From " (_exactly_ like this)
    at the beginning of the file or after an empty line.
    So the regex "/^from\s+\w+(\.\w+)*@/i" currently used is just wrong, because
    - any other capitalization of "from" does _not_ introduce a new message
    - anything else following afterwards is optional
2.) malformed date headers currently will produce a warning

Regards,
                             Peter
--- mailfs.mc_dist	2009-01-25 13:36:48.000000000 +0100
+++ mailfs	2009-06-17 10:25:39.000000000 +0200
@@ -15,7 +15,7 @@
     import Date::Parse;
     $parse_date=
 	sub {
-	    local $ftime = str2time($_[0],$TZ);
+	    local $ftime = str2time($_[0],$TZ) || return $fallback;
 	    $_ = localtime($ftime);
 	    /^(...) (...) ([ \d]\d) (\d\d:\d\d):\d\d (\d\d\d\d)$/;
 	    if ($ftime + 6 * 30 * 24 * 60 * 60 < $now ||
@@ -135,7 +135,7 @@
 
     while(<IN>) {
 	s/\r$//;
-	if($blank && /^from\s+\w+(\.\w+)*@/i) { # Start of header
+	if($blank && /^From /) { # Start of header
 	    print_dir_line unless (!$msg_nr);
 	    $size=length;
 	    $msg_nr++;
@@ -160,7 +160,7 @@
     my $blank = 1;
     while(<IN>) {
 	s/\r$//;
-	if($blank && /^from\s+\w+(\.\w+)*@/i) {
+        if($blank && /^From /) {
 	    $msg_nr++;
 	    exit(0) if ($msg_nr > $nr);
 	    $blank= 0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]