bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7009: 24.0.50; [gnus] nnir uses incorrect server checks with maildir


From: Lluís
Subject: bug#7009: 24.0.50; [gnus] nnir uses incorrect server checks with maildir
Date: Fri, 10 Sep 2010 17:18:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

The `server' string is repeatedly checked against "nnmaildir:" to see if
the search result is stored in maildir.

Unfortunately, that string is, in fact "nnmaildir:somethingelse".

The attached patch makes sure that only the server type (i.e.,
"nnmaildir:") is checked.

diff -Nur /tmp/nnir.el.orig /tmp/nnir.el
--- /tmp/nnir.el.orig   2010-09-10 17:03:51.000000000 +0200
+++ /tmp/nnir.el        2010-09-10 17:12:45.000000000 +0200
@@ -858,6 +858,12 @@
 (nnoo-define-skeleton nnir)
 
 
+(defun nnir-server-type (server)
+  "Get the part until ':' from a server string."
+  (if (string-match "[^:]*:" server)
+      (substring server 0 (match-end 0))
+    server))
+
 (defmacro nnir-add-result (dirnam artno score prefix server artlist)
   "Ask `nnir-compose-result' to construct a result vector,
 and if it is non-nil, add it to artlist."
@@ -880,7 +886,9 @@
   (when (file-readable-p (concat prefix dirnam article))
     ;; remove trailing slash and, for nnmaildir, cur/new/tmp
     (setq dirnam
-         (substring dirnam 0 (if (string= server "nnmaildir:") -5 -1)))
+         (substring dirnam 0
+                     (if (string= (nnir-server-type server) "nnmaildir:")
+                         -5 -1)))
 
     ;; Set group to dirnam without any leading dots or slashes,
     ;; and with all subsequent slashes replaced by dots
@@ -889,7 +897,7 @@
                  "[/\\]" "." t)))
 
     (vector (nnir-group-full-name group server)
-           (if (string= server "nnmaildir:")
+           (if (string= (nnir-server-type server) "nnmaildir:")
                (nnmaildir-base-name-to-article-number
                 (substring article 0 (string-match ":" article))
                 group nil)
@@ -1187,7 +1195,7 @@
           ;; is sufficient.  Note that we can't only use the value of
           ;; nnml-use-compressed-files because old articles might have been
           ;; saved with a different value.
-          (article-pattern (if (string= server "nnmaildir:")
+          (article-pattern (if (string= (nnir-server-type server) "nnmaildir:")
                                ":[0-9]+"
                              "^[0-9]+\\(\\.[a-z0-9]+\\)?$"))
            score artno dirnam filenam)
@@ -1437,12 +1445,12 @@
   (when group
     (error "The Namazu backend cannot search specific groups"))
   (save-excursion
-    (let ((article-pattern (if (string= server "nnmaildir:")
+    (let ((article-pattern (if (string= (nnir-server-type server) "nnmaildir:")
                               ":[0-9]+"
                             "^[0-9]+$"))
           artlist
-         (qstring (cdr (assq 'query query)))
-         (prefix (nnir-read-server-parm 'nnir-namazu-remove-prefix server))
+          (qstring (cdr (assq 'query query)))
+          (prefix (nnir-read-server-parm 'nnir-namazu-remove-prefix server))
           score group article
           (process-environment (copy-sequence process-environment)))
       (setenv "LC_MESSAGES" "C")

Diff finished.  Fri Sep 10 17:12:54 2010

In GNU Emacs 24.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2010-09-08 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20100903-3)
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
configured using `configure  '--build' 'x86_64-linux-gnu' '--host' 
'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' 
'--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' 
'--mandir=/usr/share/man' '--with-pop=yes' 
'--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.0.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.0.50/site-lisp:/usr/share/emacs/site-lisp'
 '--without-compress-info' '--with-x=yes' '--with-x-toolkit=gtk' 
'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN 
-DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

apa!

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth

reply via email to

[Prev in Thread] Current Thread [Next in Thread]