GNU bug report logs - #29008
26.0.90; two bugs in gnus-read-ephemeral-*

Previous Next

Package: emacs;

Reported by: Katsumi Yamaoka <yamaoka <at> jpl.org>

Date: Thu, 26 Oct 2017 08:17:01 UTC

Severity: normal

Found in version 26.0.90

Done: Katsumi Yamaoka <yamaoka <at> jpl.org>

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 29008 in the body.
You can then email your comments to 29008 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#29008; Package emacs. (Thu, 26 Oct 2017 08:17:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Katsumi Yamaoka <yamaoka <at> jpl.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 26 Oct 2017 08:17:02 GMT) Full text and rfc822 format available.

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

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.90; two bugs in gnus-read-ephemeral-*
Date: Thu, 26 Oct 2017 17:15:32 +0900
[Message part 1 (text/plain, inline)]
Hi,

BUG-1:
If a group for a certain bug number is once read and its contents
are cached, the following error happens.  This is the case I do

M-x gnus-read-ephemeral-emacs-bug-group RET 26862 RET

for reading bug#26862.

Debugger entered--Lisp error: (file-error "https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26862;mboxmaint=yes;mboxstat=yes" "Not modified")
  signal(file-error ("https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26862;mboxmaint=yes;mboxstat=yes" "Not modified"))
  url-insert-file-contents("https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26862;mboxmaint=yes;mboxstat=yes")
  gnus-read-ephemeral-bug-group((26862) "https://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s;mboxmaint=yes;mboxstat=yes" nil)
  gnus-read-ephemeral-emacs-bug-group(26862)

It's not intentional, is it?  Fixing it is easy by passing t as
the second argument to `url-insert-file-contents'.  However, it
causes another problem; the program prompts me for the yes-or-no
query when I redo `M-x gnus-read-ephemeral-emacs-bug-group' as:

Buffer  *temp file* modified; kill anyway? (yes or no)

This happens when finishing the (with-temp-file ...) form because
`url-insert-file-contents' sets `buffer-file-name' as the second
argument is set.  So, `buffer-file-name' has to be reset to nil.


BUG-2:
An example that (info "(gnus)Foreign Groups") introduces

   Here is an example:
     (require 'gnus-art)
     (add-to-list
      'gnus-button-alist
      '("#\\([0-9]+\\)\\>" 1
        (string-match "\\<emacs\\>" (or gnus-newsgroup-name ""))
        gnus-read-ephemeral-emacs-bug-group 1))

passes a bug number to `gnus-read-ephemeral-emacs-bug-group' as
a string.  Even if BUG-1 is fixed, this causes a bug as follows:

Debugger entered--Lisp error: (wrong-type-argument numberp "26862")
  number-to-string("26862")
  mapconcat(number-to-string ("26862") ",")
  gnus-read-ephemeral-bug-group(("26862") "https://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s;mboxmaint=yes;mboxstat=yes" nil)
  gnus-read-ephemeral-emacs-bug-group("26862")

A patch for both the bugs is below.  Thanks.

In GNU Emacs 26.0.90 (build 1, i686-pc-cygwin, GTK+ Version 3.18.9)
 of 2017-10-26 built on localhost
Windowing system distributor 'The Cygwin/X Project', version 11.0.11900000


* lisp/gnus/gnus-group.el (gnus-read-ephemeral-gmane-group)
(gnus-read-ephemeral-bug-group): Make it work for any number of times.
(gnus-read-ephemeral-emacs-bug-group): Allow a string for bug#.

[Message part 2 (text/x-patch, inline)]
--- gnus-group.el~	2017-10-25 22:06:10.154071900 +0000
+++ gnus-group.el	2017-10-26 08:08:28.510090200 +0000
@@ -2373,7 +2373,10 @@
     (with-temp-file tmpfile
       (url-insert-file-contents
        (format gnus-gmane-group-download-format
-	       group start (+ start range)))
+	       group start (+ start range))
+       t)
+      ;; `url-insert-file-contents' sets this because of the 2nd arg.
+      (setq buffer-file-name nil)
       (write-region (point-min) (point-max) tmpfile)
       (gnus-group-read-ephemeral-group
        (format "nndoc+ephemeral:%s.start-%s.range-%s" group start range)
@@ -2463,7 +2466,7 @@
 	    (if (and (not gnus-plugged)
 		     (file-exists-p file))
 		(insert-file-contents file)
-	      (url-insert-file-contents (format mbox-url id)))))
+	      (url-insert-file-contents (format mbox-url id) t))))
 	;; Add the debbugs address so that we can respond to reports easily.
 	(let ((address
 	       (format "%s@%s" (car ids)
@@ -2488,7 +2491,9 @@
 		    (insert ", " address))
 		(insert "To: " address "\n")))
 	    (goto-char (point-max))
-	    (widen)))))
+	    (widen)))
+	;; `url-insert-file-contents' sets this because of the 2nd arg.
+	(setq buffer-file-name nil)))
     (gnus-group-read-ephemeral-group
      (format "nndoc+ephemeral:bug#%s"
 	     (mapconcat 'number-to-string ids ","))
@@ -2512,6 +2517,8 @@
   (interactive (list (string-to-number
 		      (read-string "Enter bug number: "
 				   (thing-at-point 'word) nil))))
+  (when (stringp ids)
+    (setq ids (string-to-number ids)))
   (unless (listp ids)
     (setq ids (list ids)))
   (gnus-read-ephemeral-bug-group

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29008; Package emacs. (Thu, 26 Oct 2017 12:21:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>
Cc: 29008 <at> debbugs.gnu.org
Subject: Re: bug#29008: 26.0.90; two bugs in gnus-read-ephemeral-*
Date: Thu, 26 Oct 2017 08:19:50 -0400
Katsumi Yamaoka <yamaoka <at> jpl.org> writes:

> Hi,
>
> BUG-1:
> If a group for a certain bug number is once read and its contents
> are cached, the following error happens.  This is the case I do

How do you make it be cached?  I tried M-x
gnus-read-ephemeral-emacs-bug-group with the same number twice in a row,
but I got no error.

> BUG-2:
> An example that (info "(gnus)Foreign Groups") introduces
>
>    Here is an example:
>      (require 'gnus-art)
>      (add-to-list
>       'gnus-button-alist
>       '("#\\([0-9]+\\)\\>" 1
>         (string-match "\\<emacs\\>" (or gnus-newsgroup-name ""))
>         gnus-read-ephemeral-emacs-bug-group 1))
>
> passes a bug number to `gnus-read-ephemeral-emacs-bug-group' as
> a string.  Even if BUG-1 is fixed, this causes a bug as follows:
>
> Debugger entered--Lisp error: (wrong-type-argument numberp "26862")
>   number-to-string("26862")
>   mapconcat(number-to-string ("26862") ",")
>   gnus-read-ephemeral-bug-group(("26862") "https://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s;mboxmaint=yes;mboxstat=yes" nil)
>   gnus-read-ephemeral-emacs-bug-group("26862")

> * lisp/gnus/gnus-group.el (gnus-read-ephemeral-gmane-group)
> (gnus-read-ephemeral-bug-group): Make it work for any number of times.
> (gnus-read-ephemeral-emacs-bug-group): Allow a string for bug#.

Maybe we should fix the example instead?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29008; Package emacs. (Thu, 26 Oct 2017 23:35:02 GMT) Full text and rfc822 format available.

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

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 29008 <at> debbugs.gnu.org
Subject: Re: bug#29008: 26.0.90; two bugs in gnus-read-ephemeral-*
Date: Fri, 27 Oct 2017 08:34:24 +0900
On Thu, 26 Oct 2017 08:19:50 -0400, Noam Postavsky wrote:
> Katsumi Yamaoka <yamaoka <at> jpl.org> writes:
>> BUG-1:
>> If a group for a certain bug number is once read and its contents
>> are cached, the following error happens.  This is the case I do

> How do you make it be cached?

I did nothing special for it, so it seems the default feature.
In my case the cache is stored in the file:

~/.emacs.d/url/cache/yamaoka/https/org/gnu/debbugs/251a7740923b0757bb1cd2b95e60bf88

Removing it manually vanishes the "Not modified" error.

> I tried M-x
> gnus-read-ephemeral-emacs-bug-group with the same number twice in a row,
> but I got no error.

Could you try exiting the ephemeral bug group by `q' before
retrying it?  Though I can reproduce the error without doing so.

>> BUG-2:
>> An example that (info "(gnus)Foreign Groups") introduces

>>    Here is an example:
>>      (require 'gnus-art)
>>      (add-to-list
>>       'gnus-button-alist
>>       '("#\\([0-9]+\\)\\>" 1
>>         (string-match "\\<emacs\\>" (or gnus-newsgroup-name ""))
>>         gnus-read-ephemeral-emacs-bug-group 1))

>> passes a bug number to `gnus-read-ephemeral-emacs-bug-group' as
>> a string.  Even if BUG-1 is fixed, this causes a bug as follows:

>> Debugger entered--Lisp error: (wrong-type-argument numberp "26862")
>>   number-to-string("26862")
>>   mapconcat(number-to-string ("26862") ",")
>>   gnus-read-ephemeral-bug-group(("26862") "https://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s;mboxmaint=yes;mboxstat=yes" nil)
>>   gnus-read-ephemeral-emacs-bug-group("26862")

>> * lisp/gnus/gnus-group.el (gnus-read-ephemeral-gmane-group)
>> (gnus-read-ephemeral-bug-group): Make it work for any number of times.
>> (gnus-read-ephemeral-emacs-bug-group): Allow a string for bug#.

> Maybe we should fix the example instead?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29008; Package emacs. (Fri, 27 Oct 2017 00:13:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>
Cc: 29008 <at> debbugs.gnu.org
Subject: Re: bug#29008: 26.0.90; two bugs in gnus-read-ephemeral-*
Date: Thu, 26 Oct 2017 20:12:37 -0400
Katsumi Yamaoka <yamaoka <at> jpl.org> writes:

> I did nothing special for it, so it seems the default feature.
> In my case the cache is stored in the file:
>
> ~/.emacs.d/url/cache/yamaoka/https/org/gnu/debbugs/251a7740923b0757bb1cd2b95e60bf88

Ah, it's url-automatic-caching which defaults to nil.  After setting to
t I can reproduce the error.

It seems to me that 3xx HTTP errors should not signal a file-error, as
they merely indicate redirects or similar.  Probably not a good idea to
start messing with error handling in the release branch though.

So I would suggest that your fix could go to emacs-26 but marked not to
merge to master, and master could be changed not to signal error on 3xx
HTTP codes.  What do you think?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29008; Package emacs. (Fri, 27 Oct 2017 00:48:02 GMT) Full text and rfc822 format available.

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

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 29008 <at> debbugs.gnu.org
Subject: Re: bug#29008: 26.0.90; two bugs in gnus-read-ephemeral-*
Date: Fri, 27 Oct 2017 09:47:03 +0900
On Thu, 26 Oct 2017 20:12:37 -0400, Noam Postavsky wrote:
> Ah, it's url-automatic-caching which defaults to nil.  After setting to
> t I can reproduce the error.

Oops, I definitely have set url-automatic-caching.

> It seems to me that 3xx HTTP errors should not signal a file-error, as
> they merely indicate redirects or similar.  Probably not a good idea to
> start messing with error handling in the release branch though.

> So I would suggest that your fix could go to emacs-26 but marked not to
> merge to master, and master could be changed not to signal error on 3xx
> HTTP codes.  What do you think?

Yes, no one suffers any pain by 3xx, so they should not be errors.
I absolutely agree with changing the handling upon 3xx codes in
the future.  I'm going to commit the change in only emas-26 with
a comment.

Thanks.






bug closed, send any further explanations to 29008 <at> debbugs.gnu.org and Katsumi Yamaoka <yamaoka <at> jpl.org> Request was from Katsumi Yamaoka <yamaoka <at> jpl.org> to control <at> debbugs.gnu.org. (Fri, 27 Oct 2017 01:18:01 GMT) Full text and rfc822 format available.

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

This bug report was last modified 7 years and 295 days ago.

Previous Next


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