GNU bug report logs - #33055
27.0.50; load-prefer-newer loads wrong file

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Mon, 15 Oct 2018 22:50:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 27.0.50

Fixed in version 26.2

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33055 in the body.
You can then email your comments to 33055 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#33055; Package emacs. (Mon, 15 Oct 2018 22:50:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 15 Oct 2018 22:50:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; load-prefer-newer loads wrong file
Date: Tue, 16 Oct 2018 01:43:15 +0300
Tags: patch

When load-prefer-newer is customized to t, smtpmail-send-queued-mail
fails to load the correct file.  This patch fixes it:

diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 8bc3cc78d9..a889cfd75b 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -407,6 +407,11 @@ smtpmail-send-queued-mail
     (let ((file-msg "")
           (qfile (expand-file-name smtpmail-queue-index-file
                                    smtpmail-queue-dir))
+          ;; To ensure that `load' below will load the right file
+          ;; with the suffix `.el' instead of a newer text file
+          ;; with the same name and without the suffix `.el',
+          ;; force load-prefer-newer to be nil:
+          (load-prefer-newer nil)
 	  result)
       (insert-file-contents qfile)
       (goto-char (point-min))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33055; Package emacs. (Mon, 15 Oct 2018 23:38:01 GMT) Full text and rfc822 format available.

Message #8 received at 33055 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 33055 <at> debbugs.gnu.org
Subject: Re: bug#33055: 27.0.50; load-prefer-newer loads wrong file
Date: Mon, 15 Oct 2018 19:37:47 -0400
Juri Linkov wrote:

> --- a/lisp/mail/smtpmail.el
> +++ b/lisp/mail/smtpmail.el
> @@ -407,6 +407,11 @@ smtpmail-send-queued-mail
>      (let ((file-msg "")
>            (qfile (expand-file-name smtpmail-queue-index-file
>                                     smtpmail-queue-dir))
> +          ;; To ensure that `load' below will load the right file
> +          ;; with the suffix `.el' instead of a newer text file
> +          ;; with the same name and without the suffix `.el',
> +          ;; force load-prefer-newer to be nil:
> +          (load-prefer-newer nil)
>  	  result)
>        (insert-file-contents qfile)
>        (goto-char (point-min))

Perhaps it would be cleaner for the load statement to use the precise
filename that it wants to load (ie, explicitly add the .el suffix)?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33055; Package emacs. (Tue, 16 Oct 2018 22:47:02 GMT) Full text and rfc822 format available.

Message #11 received at 33055 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 33055 <at> debbugs.gnu.org
Subject: Re: bug#33055: 27.0.50; load-prefer-newer loads wrong file
Date: Wed, 17 Oct 2018 01:44:52 +0300
> Perhaps it would be cleaner for the load statement to use the precise
> filename that it wants to load (ie, explicitly add the .el suffix)?

In a new patch I used the same variable names as in the function
smtpmail-send-it that creates these files.  But now I realized
this fix might be needed for emacs-26.  Maybe, Eli knows for sure?

diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 8bc3cc78d9..8607f9fa9c 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -404,21 +404,22 @@ smtpmail-send-queued-mail
   (with-temp-buffer
     ;; Get index, get first mail, send it, update index, get second
     ;; mail, send it, etc...
-    (let ((file-msg "")
+    (let (file-data file-elisp
           (qfile (expand-file-name smtpmail-queue-index-file
                                    smtpmail-queue-dir))
 	  result)
       (insert-file-contents qfile)
       (goto-char (point-min))
       (while (not (eobp))
-	(setq file-msg (buffer-substring (point) (line-end-position)))
-	(load file-msg)
+	(setq file-data (buffer-substring (point) (line-end-position)))
+	(setq file-elisp (concat file-data ".el"))
+	(load file-elisp)
 	;; Insert the message literally: it is already encoded as per
 	;; the MIME headers, and code conversions might guess the
 	;; encoding wrongly.
 	(with-temp-buffer
 	  (let ((coding-system-for-read 'no-conversion))
-	    (insert-file-contents file-msg))
+	    (insert-file-contents file-data))
           (let ((smtpmail-mail-address
                  (or (and mail-specify-envelope-from (mail-envelope-from))
                      user-mail-address)))
@@ -428,8 +429,8 @@ smtpmail-send-queued-mail
 				    (current-buffer)))
 		  (error "Sending failed: %s" result))
               (error "Sending failed; no recipients"))))
-	(delete-file file-msg)
-	(delete-file (concat file-msg ".el"))
+	(delete-file file-data)
+	(delete-file file-elisp)
 	(delete-region (point-at-bol) (point-at-bol 2)))
       (write-region (point-min) (point-max) qfile))))
 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33055; Package emacs. (Wed, 17 Oct 2018 16:16:01 GMT) Full text and rfc822 format available.

Message #14 received at 33055 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: rgm <at> gnu.org, 33055 <at> debbugs.gnu.org
Subject: Re: bug#33055: 27.0.50; load-prefer-newer loads wrong file
Date: Wed, 17 Oct 2018 19:14:50 +0300
> From: Juri Linkov <juri <at> linkov.net>
> Date: Wed, 17 Oct 2018 01:44:52 +0300
> Cc: 33055 <at> debbugs.gnu.org
> 
> In a new patch I used the same variable names as in the function
> smtpmail-send-it that creates these files.  But now I realized
> this fix might be needed for emacs-26.  Maybe, Eli knows for sure?

It's okay to install this on emacs-26.  Thanks.




Added tag(s) fixed. Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Wed, 17 Oct 2018 22:30:05 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.2, send any further explanations to 33055 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Wed, 17 Oct 2018 22:30:05 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33055; Package emacs. (Wed, 17 Oct 2018 22:30:05 GMT) Full text and rfc822 format available.

Message #21 received at 33055-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rgm <at> gnu.org, 33055-done <at> debbugs.gnu.org
Subject: Re: bug#33055: 27.0.50; load-prefer-newer loads wrong file
Date: Thu, 18 Oct 2018 01:25:43 +0300
tags 33055 fixed
close 33055 26.2
quit

>> In a new patch I used the same variable names as in the function
>> smtpmail-send-it that creates these files.  But now I realized
>> this fix might be needed for emacs-26.  Maybe, Eli knows for sure?
>
> It's okay to install this on emacs-26.  Thanks.

Done with commit eb6768977e.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 15 Nov 2018 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 216 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.