unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29008: 26.0.90; two bugs in gnus-read-ephemeral-*
@ 2017-10-26  8:15 Katsumi Yamaoka
  2017-10-26 12:19 ` Noam Postavsky
  0 siblings, 1 reply; 5+ messages in thread
From: Katsumi Yamaoka @ 2017-10-26  8:15 UTC (permalink / raw)
  To: 29008

[-- Attachment #1: Type: text/plain, Size: 2433 bytes --]

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#.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1628 bytes --]

--- 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#29008: 26.0.90; two bugs in gnus-read-ephemeral-*
  2017-10-26  8:15 bug#29008: 26.0.90; two bugs in gnus-read-ephemeral-* Katsumi Yamaoka
@ 2017-10-26 12:19 ` Noam Postavsky
  2017-10-26 23:34   ` Katsumi Yamaoka
  0 siblings, 1 reply; 5+ messages in thread
From: Noam Postavsky @ 2017-10-26 12:19 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 29008

Katsumi Yamaoka <yamaoka@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?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#29008: 26.0.90; two bugs in gnus-read-ephemeral-*
  2017-10-26 12:19 ` Noam Postavsky
@ 2017-10-26 23:34   ` Katsumi Yamaoka
  2017-10-27  0:12     ` Noam Postavsky
  0 siblings, 1 reply; 5+ messages in thread
From: Katsumi Yamaoka @ 2017-10-26 23:34 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 29008

On Thu, 26 Oct 2017 08:19:50 -0400, Noam Postavsky wrote:
> Katsumi Yamaoka <yamaoka@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?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#29008: 26.0.90; two bugs in gnus-read-ephemeral-*
  2017-10-26 23:34   ` Katsumi Yamaoka
@ 2017-10-27  0:12     ` Noam Postavsky
  2017-10-27  0:47       ` Katsumi Yamaoka
  0 siblings, 1 reply; 5+ messages in thread
From: Noam Postavsky @ 2017-10-27  0:12 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 29008

Katsumi Yamaoka <yamaoka@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?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#29008: 26.0.90; two bugs in gnus-read-ephemeral-*
  2017-10-27  0:12     ` Noam Postavsky
@ 2017-10-27  0:47       ` Katsumi Yamaoka
  0 siblings, 0 replies; 5+ messages in thread
From: Katsumi Yamaoka @ 2017-10-27  0:47 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 29008

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.







^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-27  0:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-26  8:15 bug#29008: 26.0.90; two bugs in gnus-read-ephemeral-* Katsumi Yamaoka
2017-10-26 12:19 ` Noam Postavsky
2017-10-26 23:34   ` Katsumi Yamaoka
2017-10-27  0:12     ` Noam Postavsky
2017-10-27  0:47       ` Katsumi Yamaoka

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).