GNU bug report logs - #25042
26.0.50; ibuffer-filter-by-predicate: A wrong filter keeps enabled

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Sun, 27 Nov 2016 13:36:01 UTC

Severity: normal

Found in version 26.0.50

Done: Tino Calancha <tino.calancha <at> gmail.com>

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 25042 in the body.
You can then email your comments to 25042 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#25042; Package emacs. (Sun, 27 Nov 2016 13:36:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tino Calancha <tino.calancha <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 27 Nov 2016 13:36:02 GMT) Full text and rfc822 format available.

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

From: Tino Calancha <tino.calancha <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: tino.calancha <at> gmail.com
Subject: 26.0.50; ibuffer-filter-by-predicate: A wrong filter keeps enabled
Date: Sun, 27 Nov 2016 22:34:58 +0900
emacs -Q
M-x: ibuffer RET
/e (match-string "sc" (buffer-name))
;; Mistyped `match-string' instead of `string-match'.
M-: ibuffer-filtering-qualifiers RET
=> ((predicate match-string "sc" (buffer-name)))

The filter is wrong but it keeps enabled; calling
`ibuffer-update' would signal an error:
Wrong type argument: integerp, "sc"

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From 3188bd56128aa36035a4ebca391182cf7faba713 Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha <at> gmail.com>
Date: Sun, 27 Nov 2016 22:32:34 +0900
Subject: [PATCH] define-ibuffer-filter: Discard wrong filters

* lisp/ibuf-macs.el (define-ibuffer-filter): Do not store
in 'ibuffer-filtering-qualifiers' a wrong filter (Bug#25042).
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug25042): Add test.
---
 lisp/ibuf-macs.el          | 9 +++++++--
 test/lisp/ibuffer-tests.el | 7 +++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lisp/ibuf-macs.el b/lisp/ibuf-macs.el
index 27e7af9..3c95f4c 100644
--- a/lisp/ibuf-macs.el
+++ b/lisp/ibuf-macs.el
@@ -302,8 +302,13 @@ ibuffer-save-marks
 			  qualifier))
 	 (ibuffer-update nil t))
        (push (list ',name ,description
-		   #'(lambda (buf qualifier)
-		       ,@body))
+		   (lambda (buf qualifier)
+                     (condition-case nil
+                         ,@body
+                       (error (ibuffer-pop-filter)
+                              (when (eq ',name 'predicate)
+                                (error "Wrong filter predicate: %S"
+                                       qualifier))))))
 	     ibuffer-filtering-alist)
        :autoload-end)))
 
diff --git a/test/lisp/ibuffer-tests.el b/test/lisp/ibuffer-tests.el
index 3a4def3..8a9ded9 100644
--- a/test/lisp/ibuffer-tests.el
+++ b/test/lisp/ibuffer-tests.el
@@ -66,5 +66,12 @@
       (mapc (lambda (buf) (when (buffer-live-p buf)
                             (kill-buffer buf))) (list buf1 buf2)))))
 
+(ert-deftest ibuffer-test-Bug25042 ()
+  "Test for http://debbugs.gnu.org/25042 ."
+  (ibuffer)
+  (ignore-errors ; Mistyped `match-string' instead of `string-match'.
+    (ibuffer-filter-by-predicate '(match-string "foo" (buffer-name))))
+  (should-not ibuffer-filtering-qualifiers))
+
 (provide 'ibuffer-tests)
 ;; ibuffer-tests.el ends here
-- 
2.10.2

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.3)
 of 2016-11-27
Repository revision: 416adda38521c6246f77877c57843264fa4ae711




Reply sent to Tino Calancha <tino.calancha <at> gmail.com>:
You have taken responsibility. (Wed, 07 Dec 2016 13:09:02 GMT) Full text and rfc822 format available.

Notification sent to Tino Calancha <tino.calancha <at> gmail.com>:
bug acknowledged by developer. (Wed, 07 Dec 2016 13:09:02 GMT) Full text and rfc822 format available.

Message #10 received at 25042-done <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 25042-done <at> debbugs.gnu.org
Subject: Re: bug#25042: 26.0.50;
 ibuffer-filter-by-predicate: A wrong filter keeps enabled
Date: Wed, 07 Dec 2016 22:08:43 +0900
Tino Calancha <tino.calancha <at> gmail.com> writes:

> emacs -Q
> M-x: ibuffer RET
> /e (match-string "sc" (buffer-name))
> ;; Mistyped `match-string' instead of `string-match'.
> M-: ibuffer-filtering-qualifiers RET
> => ((predicate match-string "sc" (buffer-name)))
>
> The filter is wrong but it keeps enabled; calling
> `ibuffer-update' would signal an error:
> Wrong type argument: integerp, "sc"
Pushed fix to master branch as commit e41e89d.




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

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

Previous Next


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