From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/54819 Path: main.gmane.org!not-for-mail From: Simon Josefsson Newsgroups: gmane.emacs.gnus.general Subject: Re: gnus: pgg-gpg-lookup-key uses wrong regular expression Date: Fri, 14 Nov 2003 23:13:42 +0100 Sender: ding-owner@lists.math.uh.edu Message-ID: References: <87oevfug08.fsf@glaurung.green-gryphon.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1068848258 24592 80.91.224.253 (14 Nov 2003 22:17:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 14 Nov 2003 22:17:38 +0000 (UTC) Cc: ultrasoul@ultrasoul.com (David D. Smith), 220521-forwarded@bugs.debian.org, ding@gnus.org Original-X-From: ding-owner+M3359@lists.math.uh.edu Fri Nov 14 23:17:35 2003 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AKmFz-0003RB-00 for ; Fri, 14 Nov 2003 23:17:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1AKmCc-0002aC-00; Fri, 14 Nov 2003 16:14:06 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1AKmCU-0002a6-00 for ding@lists.math.uh.edu; Fri, 14 Nov 2003 16:13:58 -0600 Original-Received: from yxa.extundo.com (178.230.13.217.in-addr.dgcsystems.net [217.13.230.178]) by justine.libertine.org (Postfix) with ESMTP id 41E7B3A0027; Fri, 14 Nov 2003 16:13:57 -0600 (CST) Original-Received: from latte (yxa.extundo.com [217.13.230.178]) (authenticated bits=0) by yxa.extundo.com (8.12.10/8.12.10) with ESMTP id hAEMDo1K030625; Fri, 14 Nov 2003 23:13:51 +0100 Original-To: bugs@gnus.org (The Gnus Bugfixing Girls + Boys) Mail-Copies-To: nobody X-Payment: hashcash 1.2 0:031114:bugs@gnus.org:613b0c4881265022 X-Hashcash: 0:031114:bugs@gnus.org:613b0c4881265022 X-Payment: hashcash 1.2 0:031114:ultrasoul@ultrasoul.com:c4c6f5ea3ad480fb X-Hashcash: 0:031114:ultrasoul@ultrasoul.com:c4c6f5ea3ad480fb X-Payment: hashcash 1.2 0:031114:220521-forwarded@bugs.debian.org:c25475c3230b19c3 X-Hashcash: 0:031114:220521-forwarded@bugs.debian.org:c25475c3230b19c3 X-Payment: hashcash 1.2 0:031114:ding@gnus.org:5200f9c2c54854cb X-Hashcash: 0:031114:ding@gnus.org:5200f9c2c54854cb In-Reply-To: <87oevfug08.fsf@glaurung.green-gryphon.com> (Manoj Srivastava's message of "Fri, 14 Nov 2003 09:27:51 -0600") User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:54819 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:54819 Manoj Srivastava writes: > Gnus v5.10.2 > GNU Emacs 21.3.1 (i386-pc-linux-gnu, X toolkit) > of 2003-10-31 on raven, modified by Debian > > Hi, > > [Please retain the CC to 220521-forwarded@bugs.debian.org, so > that the Debian BTS has a record of your contribution] > > This was reported by a Debian user. > > In pgg-gpg-kookup-key (line 113 of pgg-gpg.el), that re-search-forward > call places point at the end of "^\\(sec\\|pub\\):" Next, it splits > that string at point on ":" separation. The problem is that if the > string looks like this: > > "sec::foo:bar", split string returns '("foo" "bar"), not what the code > actually expects it to return, '("" "foo" "bar"). The code wants to > extract the third element of that list return from the split which is > now unpredictable. This bug was provoked because when I'm signing, it > parses a string like the one given, but when I'm verifying, it parses > a string like "pub:u:foo:bar" which returns '("u" "foo" "bar") and the > third element of that list is indeed what we want. > > From the documentation of the split-string function, "If there is > match for SEPARATORS at the beginning of STRING, we do not include a > null substring for that. Likewise, if there is a match at the end of > STRING, we don't include a null substring for that. > > Changing the regular expression to not include the first colon, so > "^\\(sec\\|pub\\)" produces the proper result every time. Another > option may be to search forward to the point found by the original > regular expression and back up one place, so we know every time that > the string to be split will begin with a separator. The `split-string in Emacs CVS subr.el contain the following change that fixes the problem. As this changes the behaviour of `split-string', there should be a NEWS entry about it, which there isn't. Trying the various examples in the Elisp manual also doesn't return the same values. I'll forward this to emacs-devel@gnu.org, then we can find out whether the right solution is to fix Debian's Emacs or fix Emacs CVS and Gnus. * subr.el (split-string): Implement specification that splitting on explicit separators retains null fields. Add new argument OMIT-NULLS. Special-case (split-string "a string").