GNU bug report logs - #18198
Gnus fails to read ~/.newsrc with group names which are not symbols

Previous Next

Packages: emacs, gnus;

Reported by: Ivan Shmakov <ivan <at> siamics.net>

Date: Tue, 5 Aug 2014 10:09:01 UTC

Severity: minor

Tags: fixed, patch

Done: Lars Ingebrigtsen <larsi <at> gnus.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 18198 in the body.
You can then email your comments to 18198 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, bugs <at> gnus.org:
bug#18198; Package emacs, gnus. (Tue, 05 Aug 2014 10:09:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ivan Shmakov <ivan <at> siamics.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org. (Tue, 05 Aug 2014 10:09:02 GMT) Full text and rfc822 format available.

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

From: Ivan Shmakov <ivan <at> siamics.net>
To: submit <at> debbugs.gnu.org
Subject: Gnus fails to read ~/.newsrc with group names which are not symbols 
Date: Tue, 05 Aug 2014 10:07:50 +0000
Package:  emacs, gnus
Severity: minor
Tags:     patch

	As it seems, gnus-newsrc-to-gnus-format fails to correctly
	process ~/.newsrc entries with group names not being /complete/
	Emacs Lisp expressions (integers, symbols, etc.), as in:

[Hello]/World: 42
[[[This-fails: 1

	I believe that the problem is at the following point.

  2556	      (narrow-to-region
  2557	       (point)
  2558	       (progn (skip-chars-forward "^ \t!:\n") (point)))
  2559	      (goto-char (point-min))
  2560	      (setq symbol
  2561		    (and (/= (point-min) (point-max))
  2562			 (let ((obarray gnus-active-hashtb)) (read buf))))
  2563	      (widen)

	Here, the “group” field of .newsrc is read as an Emacs Lisp
	expression.  Which may result either in an error, or, in the
	case of [Hello]/World – and, similarly, (Hello)/World – in only
	the leading [Hello] or (Hello) being actually read.

	Instead, I believe that the entire string is to be read and
	interned, as in (untested):

   (setq symbol
         (let ((save (point)))
           (skip-chars-forward "^ \t!:\n")
           (and (> (point) save)
                (intern (buffer-substring-no-properties save (point))
                        gnus-active-hashtb))))

  2582	       (symbol
  2583		;; Group names can be just numbers.
  2584		(when (numberp symbol)
  2585		  (setq symbol (intern (int-to-string symbol) gnus-active-hashtb)))
  2586		(unless (boundp symbol)
  2587		  (set symbol nil))

	Naturally, the numberp check above will no longer be necessary
	after the change suggested.

	Please note that this change also prevents the boundp check here
	from raising an error should the group name be a valid Emacs
	Lisp non-symbol form (say, a vector or a list.)

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#18198; Package emacs, gnus. (Fri, 13 Feb 2015 08:45:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Ivan Shmakov <ivan <at> siamics.net>
Cc: 18198 <at> debbugs.gnu.org
Subject: Re: bug#18198: Gnus fails to read ~/.newsrc with group names which
 are not symbols
Date: Fri, 13 Feb 2015 19:43:38 +1100
Ivan Shmakov <ivan <at> siamics.net> writes:

> 	I believe that the problem is at the following point.
>
>   2556	      (narrow-to-region
>   2557	       (point)
>   2558	       (progn (skip-chars-forward "^ \t!:\n") (point)))
>   2559	      (goto-char (point-min))
>   2560	      (setq symbol
>   2561		    (and (/= (point-min) (point-max))
>   2562			 (let ((obarray gnus-active-hashtb)) (read buf))))
>   2563	      (widen)
>
> 	Here, the “group” field of .newsrc is read as an Emacs Lisp
> 	expression.  Which may result either in an error, or, in the
> 	case of [Hello]/World – and, similarly, (Hello)/World – in only
> 	the leading [Hello] or (Hello) being actually read.

Well, "[Hello]/World" isn't a valid newsgroup name, and I think only
newsgroups are supposed to be in ~/.newsrc?  How did you get such a
group name there?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#18198; Package emacs, gnus. (Sat, 14 Feb 2015 08:07:01 GMT) Full text and rfc822 format available.

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

From: Ivan Shmakov <ivan <at> siamics.net>
To: 18198 <at> debbugs.gnu.org
Subject: Re: bug#18198: Gnus fails to read ~/.newsrc with group names which
 are not symbols 
Date: Sat, 14 Feb 2015 08:05:50 +0000
>>>>> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>>>>> Ivan Shmakov <ivan <at> siamics.net> writes:

[…]

 >> Here, the “group” field of .newsrc is read as an Emacs Lisp
 >> expression.  Which may result either in an error, or, in the case of
 >> [Hello]/World – and, similarly, (Hello)/World – in only the leading
 >> [Hello] or (Hello) being actually read.

 > Well, "[Hello]/World" isn't a valid newsgroup name,

	Yet (Hello)/World is.  (Per the newsgroup-name and wildmat-exact
	productions given in section 9.8 of RFC 3977.)

 > and I think only newsgroups are supposed to be in ~/.newsrc?  How did
 > you get such a group name there?

	I didn’t.  The person who brought this issue to IRC has
	apparently used something like (nnimap "imap.gmail.com") for
	gnus-select-method.

	Though indeed, I know of no reason /not/ to set
	gnus-save-newsrc-file to nil in this case.

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#18198; Package emacs, gnus. (Sat, 14 Feb 2015 10:43:01 GMT) Full text and rfc822 format available.

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

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#18198: Gnus fails to read ~/.newsrc with group names which
 are not symbols
Date: Sat, 14 Feb 2015 18:41:41 +0800
[Message part 1 (text/plain, inline)]
Ivan Shmakov <ivan <at> siamics.net> writes:

>>>>>> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>>>>>> Ivan Shmakov <ivan <at> siamics.net> writes:
>
> […]
>
>  >> Here, the “group” field of .newsrc is read as an Emacs Lisp
>  >> expression.  Which may result either in an error, or, in the case of
>  >> [Hello]/World – and, similarly, (Hello)/World – in only the leading
>  >> [Hello] or (Hello) being actually read.
>
>  > Well, "[Hello]/World" isn't a valid newsgroup name,
>
> 	Yet (Hello)/World is.  (Per the newsgroup-name and wildmat-exact
> 	productions given in section 9.8 of RFC 3977.)
>
>  > and I think only newsgroups are supposed to be in ~/.newsrc?  How did
>  > you get such a group name there?
>
> 	I didn’t.  The person who brought this issue to IRC has
> 	apparently used something like (nnimap "imap.gmail.com") for
> 	gnus-select-method.
>
> 	Though indeed, I know of no reason /not/ to set
> 	gnus-save-newsrc-file to nil in this case.

This was discussed on the gnus.general list, and I produced a fix for it
(at least, I'm 95% sure it's the same issue), and then apparently never
sent the patch to the list, despite having thought I did. Attaching the
patch here.

Eric

[0001-Handle-unquoted-IMAP-group-names.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#18198; Package emacs, gnus. (Sat, 14 Feb 2015 10:57:01 GMT) Full text and rfc822 format available.

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

From: Ivan Shmakov <ivan <at> siamics.net>
To: 18198 <at> debbugs.gnu.org
Subject: Re: bug#18198: Gnus fails to read ~/.newsrc with group names which
 are not symbols 
Date: Sat, 14 Feb 2015 10:55:53 +0000
>>>>> Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
>>>>> Ivan Shmakov <ivan <at> siamics.net> writes:

[…]

 >> I didn’t.  The person who brought this issue to IRC has apparently
 >> used something like (nnimap "imap.gmail.com") for
 >> gnus-select-method.

 >> Though indeed, I know of no reason /not/ to set
 >> gnus-save-newsrc-file to nil in this case.

 > This was discussed on the gnus.general list, and I produced a fix for
 > it (at least, I'm 95% sure it's the same issue),

	It isn’t, – the one #18198 is about is that Gnus fails to read
	~/.newsrc it produces back; the one you suggest a patch for is
	about the (mis)use of ‘read’ in the Gnus IMAP implementation.

 > and then apparently never sent the patch to the list, despite having
 > thought I did.  Attaching the patch here.

	I believe that the information regarding (possible) bugs –
	including patches – should be sent to the BTS /first./

	This way, it’s easier to add late follow-ups, /and/ it still
	ends up in a mailing list (the bug-gnu-emacs@ one, that is.)

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#18198; Package emacs, gnus. (Sat, 14 Feb 2015 11:29:02 GMT) Full text and rfc822 format available.

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

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#18198: Gnus fails to read ~/.newsrc with group names which
 are not symbols
Date: Sat, 14 Feb 2015 19:27:43 +0800
Ivan Shmakov <ivan <at> siamics.net> writes:

>>>>>> Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
>>>>>> Ivan Shmakov <ivan <at> siamics.net> writes:
>
> […]
>
>  >> I didn’t.  The person who brought this issue to IRC has apparently
>  >> used something like (nnimap "imap.gmail.com") for
>  >> gnus-select-method.
>
>  >> Though indeed, I know of no reason /not/ to set
>  >> gnus-save-newsrc-file to nil in this case.
>
>  > This was discussed on the gnus.general list, and I produced a fix for
>  > it (at least, I'm 95% sure it's the same issue),
>
> 	It isn’t, – the one #18198 is about is that Gnus fails to read
> 	~/.newsrc it produces back; the one you suggest a patch for is
> 	about the (mis)use of ‘read’ in the Gnus IMAP implementation.

Ah, my apologies -- just a similar-looking problem, then.

>  > and then apparently never sent the patch to the list, despite having
>  > thought I did.  Attaching the patch here.
>
> 	I believe that the information regarding (possible) bugs –
> 	including patches – should be sent to the BTS /first./
>
> 	This way, it’s easier to add late follow-ups, /and/ it still
> 	ends up in a mailing list (the bug-gnu-emacs@ one, that is.)

Sorry, didn't quite understand this -- did you mean just start another
bug report?





Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#18198; Package emacs, gnus. (Sun, 15 Feb 2015 04:45:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 18198 <at> debbugs.gnu.org
Subject: Re: bug#18198: Gnus fails to read ~/.newsrc with group names which
 are not symbols
Date: Sun, 15 Feb 2015 15:42:16 +1100
Ivan Shmakov <ivan <at> siamics.net> writes:

> 	I didn’t.  The person who brought this issue to IRC has
> 	apparently used something like (nnimap "imap.gmail.com") for
> 	gnus-select-method.
>
> 	Though indeed, I know of no reason /not/ to set
> 	gnus-save-newsrc-file to nil in this case.

There should only be newsgroups in the .newsrc file -- it's for
interoperability with other newsreaders, and putting non-newsgroups in
there makes no sense.  So that does sound like a bug.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#18198; Package emacs, gnus. (Sun, 15 Feb 2015 05:53:01 GMT) Full text and rfc822 format available.

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

From: Ivan Shmakov <ivan <at> siamics.net>
To: 18198 <at> debbugs.gnu.org
Subject: Re: bug#18198: Gnus fails to read ~/.newsrc with group names which
 are not symbols 
Date: Sun, 15 Feb 2015 05:52:37 +0000
>>>>> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>>>>> Ivan Shmakov <ivan <at> siamics.net> writes:
>>>>> Lars Ingebrigtsen <larsi <at> gnus.org> writes:

 >>> Well, "[Hello]/World" isn't a valid newsgroup name,

 >> Yet (Hello)/World is.  (Per the newsgroup-name and wildmat-exact
 >> productions given in section 9.8 of RFC 3977.)

[…]

 >> The person who brought this issue to IRC has apparently used
 >> something like (nnimap "imap.gmail.com") for gnus-select-method.

 >> Though indeed, I know of no reason /not/ to set
 >> gnus-save-newsrc-file to nil in this case.

 > There should only be newsgroups in the .newsrc file -- it's for
 > interoperability with other newsreaders, and putting non-newsgroups
 > in there makes no sense.

	There still may be RFC-compliant newsgroup names which contain
	parentheses; and alt.foo.(bar) would fail just the same as
	[Hello]/World.

	Granted, I know of no such /public/ newsgroups, but whoever
	hosts an NNTP server could probably add a local one with ease.

 > So that does sound like a bug.

	As long as there’s no clear indication from Gnus that ~/.newsrc
	could easily break when used together with nnimap (and possibly
	other similar select methods), I’d rather deem it a bug in Gnus.

-- 
FSF associate member #7257  np. Bounzie boom — S. A. Kiviniemi B6A0 230E 334A




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#18198; Package emacs, gnus. (Wed, 25 Jan 2017 18:32:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 18198 <at> debbugs.gnu.org
Subject: Re: bug#18198: Gnus fails to read ~/.newsrc with group names which
 are not symbols
Date: Wed, 25 Jan 2017 19:24:49 +0100
Ivan Shmakov <ivan <at> siamics.net> writes:

> 	As long as theres no clear indication from Gnus that ~/.newsrc
> 	could easily break when used together with nnimap (and possibly
> 	other similar select methods), Id rather deem it a bug in Gnus.

It should perhaps not create a .newsrc file at all when
gnus-select-method isn't an NNTP method?  I think I'll just make that
change instead.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 25 Jan 2017 18:32:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 18198 <at> debbugs.gnu.org and Ivan Shmakov <ivan <at> siamics.net> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 25 Jan 2017 18:32:03 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. (Thu, 23 Feb 2017 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 112 days ago.

Previous Next


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