package mailagent
forwarded 652740 [email protected]
thanks

On Thu, Dec 22, 2011 at 09:25:34PM +0100, Rafael Laboissiere wrote:
> package mailagent
> severity 652740 grave
> notfound 652740 1:3.1-65-2
> found 652740 1:3.1-72-0.1
> thanks
> 
> I can confirm the bug reported below.  I am hereby setting the
> severity level to "grave" because this version of the pacakge causes
> data loss.  I just got a couple of email messages being silently
> deleted from my mailbox due to this bug.
> 
> Here is a description of what happened.  After upgrading mailagent to
> version 3.1-72-0.1, new messages were added to my mailbox by mailagent
> with the wrong From header (as described in the bug report below). 
> Those messages were not recognized by mutt and did not appear in the
> index page.  However, they seem to be considered by mutt as part of
> the last valid message in the mailbox, even though they were not shown
> anywhere.  I then deleted the last message of my mailbox and all the
> new messages added by mailagent with the wrong header silently
> disappeared.
> 
> Best regards,
> 
> Rafael Laboissiere
> 
> 
> * Winfried Boxleitner <[email protected]> [2011-12-20 14:35]:
> 
> > Package: mailagent
> > Version: 1:3.1-65-2
> > Severity: important
> > 
> > Dear Maintainer,
> > 
> >    after upgrade to mailagent 1:3.1-72-0.1 the header of each individual
> >    mail generated by mailagent misses the day and month string. e.g.:
> >    "From mailagent   20 13:10:24 MET 2011" instead of:
> >    "From mailagent Tue Dec 20 13:22:39 MET 2011"
> > 
> >    as a consequence, my mail reader (alpine) does not recognize these
> >    mails, and they are not displayed.
> > 
> >    a downgrade to mailagent 1:3.1-65-2 restores normal operation.

Ah, I have found the problem.  The previous version of mailagent used
the Perl 4 ctime.pl library, and this has now been included in
mailagent itself.  Unfortunately, the arrays containing the day and
month names don't actually get read in the new setup (they occur after
exit 0 and are not in a sub).  Uploading a fixed version.

Raphael: All that is needed is to remove ctime.pl entirely and replace
all calls to it with localtime(), or if this might not be in a scalar
context, then with scalar(localtime()).  There are occurrences of
&ctime in magent.sh, pl/callout.pl, pl/stats.pl and pl/context.pl.

Attached is a patch between the version I had based on the svn version
and the fixed version.

   Julian
diff -u mailagent-3.1-72/agent/magent.sh mailagent-3.1-72/agent/magent.sh
--- mailagent-3.1-72/agent/magent.sh
+++ mailagent-3.1-72/agent/magent.sh
@@ -522,9 +522,8 @@
 	$HD_KEEP = 1;				# Keep header fields
 
 	# Faked leading From line (used for digest items, by SPLIT)
-	local($now) = &ctime(time);
+	local($now) = scalar(localtime());
 	$now =~ s/\s(\d:\d\d:\d\d)\b/0$1/;	# Add leading 0 if hour < 10
-	chop($now);
 	$FAKE_FROM = "From mailagent " . $now;
 
 	# Miscellaneous constants
@@ -768,7 +767,6 @@
 }
 
 !NO!SUBS!
-$grep -v '^;#' pl/ctime.pl >>magent
 $grep -v '^;#' pl/jobnum.pl >>magent
 $grep -v '^;#' pl/read_conf.pl >>magent
 $grep -v '^;#' pl/acs_rqst.pl >>magent
diff -u mailagent-3.1-72/debian/changelog mailagent-3.1-72/debian/changelog
--- mailagent-3.1-72/debian/changelog
+++ mailagent-3.1-72/debian/changelog
@@ -1,3 +1,10 @@
+mailagent (1:3.1-72-0.2) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * Fix ctime.pl problem which was causing mail loss (Closes: Bug#652740)
+
+ -- Julian Gilbey <[email protected]>  Thu, 22 Dec 2011 21:20:30 +0000
+
 mailagent (1:3.1-72-0.1) unstable; urgency=low
 
   * Non-maintainer upload.
only in patch2:
unchanged:
--- mailagent-3.1-72.orig/agent/pl/callout.pl
+++ mailagent-3.1-72/agent/pl/callout.pl
@@ -214,7 +214,7 @@
 		return;
 	}
 
-	print CALLOUT "# Mailagent callout queue, last updated " . &'ctime(time);
+	print CALLOUT "# Mailagent callout queue, last updated " . scalar(localtime());
 
 	local(@type, @action, @file);
 	local($type, $action, $file);
only in patch2:
unchanged:
--- mailagent-3.1-72.orig/agent/pl/stats.pl
+++ mailagent-3.1-72/agent/pl/stats.pl
@@ -540,8 +540,8 @@
 # Print general informations, as found in @Top.
 sub print_general {
 	local($what) = @_;
-	local($last) = &'ctime($lasttime);
-	local($now) = &'ctime($current_time);
+	local($last) = localtime($lasttime);
+	local($now) = localtime($current_time);
 	local($n, $s);
 	chop $now;
 	chop $last;
only in patch2:
unchanged:
--- mailagent-3.1-72.orig/agent/pl/context.pl
+++ mailagent-3.1-72/agent/pl/context.pl
@@ -85,7 +85,7 @@
 	}
 	&'add_log("saving context file $cf'context") if $'loglvl > 17;
 	local($key, $value, $item);
-	print CONTEXT "# Mailagent context, last updated " . &'ctime(time);
+	print CONTEXT "# Mailagent context, last updated " . scalar(localtime());
 	while (($key, $value) = each %Context) {
 		next unless $value;
 		$item++;

Reply via email to