GNU bug report logs - #24997
26.0.50; ibuffer-decompose-filter has side effects on error

Previous Next

Package: emacs;

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

Date: Wed, 23 Nov 2016 07:35: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 24997 in the body.
You can then email your comments to 24997 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#24997; Package emacs. (Wed, 23 Nov 2016 07:35:01 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. (Wed, 23 Nov 2016 07:35: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
Subject: 26.0.50; ibuffer-decompose-filter has side effects on error
Date: Wed, 23 Nov 2016 16:34:32 +0900
M-x ibuffer RET
/ m lisp-interaction-mode RET
/ > 10 RET
;; here `ibuffer-filtering-qualifiers' has value:
;; ((size-gt . 10) (used-mode . lisp-interaction-mode))
/ d
;; Signals error:
ibuffer-decompose-filter: Filter type size-gt is not compound

Note that previous command has side effects on `ibuffer-filtering-qualifiers'
even when there is an error; after this command the var has value:
((used-mode . lisp-interaction-mode))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From 4540c12df119e247b5eb0a33c216375a43421e62 Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha <at> gmail.com>
Date: Wed, 23 Nov 2016 16:28:49 +0900
Subject: [PATCH] ibuffer-decompose-filter: Avoid side effects on error

* lisp/ibuf-ext.el (ibuffer-decompose-filter):
Update 'ibuffer-filtering-qualifiers' only if there is no error (Bug#24997).
---
 lisp/ibuf-ext.el | 39 +++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 5ef0746..3d11972 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -840,29 +840,24 @@ ibuffer-decompose-filter
 be a complex filter like (OR [name: foo] [mode: bar-mode]), will be
 turned into two separate filters [name: foo] and [mode: bar-mode]."
   (interactive)
-  (when (null ibuffer-filtering-qualifiers)
+  (unless ibuffer-filtering-qualifiers
     (error "No filters in effect"))
-  (let ((lim (pop ibuffer-filtering-qualifiers)))
-    (pcase (car lim)
-      (`or
-       (setq ibuffer-filtering-qualifiers (append
-					  (cdr lim)
-					  ibuffer-filtering-qualifiers)))
-      (`saved
-       (let ((data
-	      (assoc (cdr lim)
-		     ibuffer-saved-filters)))
-	 (unless data
-	   (ibuffer-filter-disable)
-	   (error "Unknown saved filter %s" (cdr lim)))
-	 (setq ibuffer-filtering-qualifiers (append
-					    (cadr data)
-					    ibuffer-filtering-qualifiers))))
-      (`not
-       (push (cdr lim)
-	     ibuffer-filtering-qualifiers))
-      (_
-       (error "Filter type %s is not compound" (car lim)))))
+  (let* ((filters ibuffer-filtering-qualifiers)
+         (head (cdar filters))
+         (tail (cdr filters))
+         (value
+          (pcase (caar filters)
+            (`or (nconc head tail))
+            (`saved
+             (let ((data (assoc head ibuffer-saved-filters)))
+               (unless data
+                 (ibuffer-filter-disable)
+                 (error "Unknown saved filter %s" head))
+               (nconc (cadr data) tail)))
+            (`not (cons head tail))
+            (_
+             (error "Filter type %s is not compound" (caar filters))))))
+    (setq ibuffer-filtering-qualifiers value))
   (ibuffer-update nil t))
 
 ;;;###autoload
-- 
2.10.2

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

In GNU Emacs 26.0.50.5 (x86_64-pc-linux-gnu, GTK+ Version 3.22.3)
 of 2016-11-23 built on calancha-pc
Repository revision: c542fab20f53374dd0c71dce949ef370fc76fa48




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24997; Package emacs. (Wed, 23 Nov 2016 15:45:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 24997 <at> debbugs.gnu.org
Subject: Re: bug#24997: 26.0.50;
 ibuffer-decompose-filter has side effects on error
Date: Wed, 23 Nov 2016 17:44:17 +0200
> From: Tino Calancha <tino.calancha <at> gmail.com>
> Date: Wed, 23 Nov 2016 16:34:32 +0900
> 
> 
> M-x ibuffer RET
> / m lisp-interaction-mode RET
> / > 10 RET
> ;; here `ibuffer-filtering-qualifiers' has value:
> ;; ((size-gt . 10) (used-mode . lisp-interaction-mode))
> / d
> ;; Signals error:
> ibuffer-decompose-filter: Filter type size-gt is not compound
> 
> Note that previous command has side effects on `ibuffer-filtering-qualifiers'
> even when there is an error; after this command the var has value:
> ((used-mode . lisp-interaction-mode))
> 
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> >From 4540c12df119e247b5eb0a33c216375a43421e62 Mon Sep 17 00:00:00 2001
> From: Tino Calancha <tino.calancha <at> gmail.com>
> Date: Wed, 23 Nov 2016 16:28:49 +0900
> Subject: [PATCH] ibuffer-decompose-filter: Avoid side effects on error

Please always accompany bug fixes with a test, if that is feasible.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24997; Package emacs. (Thu, 24 Nov 2016 01:58:02 GMT) Full text and rfc822 format available.

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

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 24997 <at> debbugs.gnu.org
Cc: Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#24997: 26.0.50;
 ibuffer-decompose-filter has side effects on error
Date: Thu, 24 Nov 2016 10:57:12 +0900
Eli Zaretskii <eliz <at> gnu.org> writes:

> Please always accompany bug fixes with a test, if that is feasible.
>
> Thanks.
Added one test on commit 561ce85




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24997; Package emacs. (Sun, 27 Nov 2016 03:55:02 GMT) Full text and rfc822 format available.

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

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 24997 <at> debbugs.gnu.org
Cc: tino.calancha <at> gmail.com
Subject: Re: bug#24997: 26.0.50;
 ibuffer-decompose-filter has side effects on error
Date: Sun, 27 Nov 2016 12:54:30 +0900
Previous patch had undesirable side effects on `ibuffer-saved-filters'.
Updated patch:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From ffca1e2c713f39a0782b359279693e9e4245f791 Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha <at> gmail.com>
Date: Sun, 27 Nov 2016 12:46:19 +0900
Subject: [PATCH] ibuffer-decompose-filter: Avoid side effects on error

* lisp/ibuf-ext.el (ibuffer-decompose-filter):
Update 'ibuffer-filtering-qualifiers' only if there is no error (Bug#24997).
---
 lisp/ibuf-ext.el | 39 +++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 5ef0746..63db1e6 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -840,29 +840,24 @@ ibuffer-decompose-filter
 be a complex filter like (OR [name: foo] [mode: bar-mode]), will be
 turned into two separate filters [name: foo] and [mode: bar-mode]."
   (interactive)
-  (when (null ibuffer-filtering-qualifiers)
+  (unless ibuffer-filtering-qualifiers
     (error "No filters in effect"))
-  (let ((lim (pop ibuffer-filtering-qualifiers)))
-    (pcase (car lim)
-      (`or
-       (setq ibuffer-filtering-qualifiers (append
-					  (cdr lim)
-					  ibuffer-filtering-qualifiers)))
-      (`saved
-       (let ((data
-	      (assoc (cdr lim)
-		     ibuffer-saved-filters)))
-	 (unless data
-	   (ibuffer-filter-disable)
-	   (error "Unknown saved filter %s" (cdr lim)))
-	 (setq ibuffer-filtering-qualifiers (append
-					    (cadr data)
-					    ibuffer-filtering-qualifiers))))
-      (`not
-       (push (cdr lim)
-	     ibuffer-filtering-qualifiers))
-      (_
-       (error "Filter type %s is not compound" (car lim)))))
+  (let* ((filters ibuffer-filtering-qualifiers)
+         (head (cdar filters))
+         (tail (cdr filters))
+         (value
+          (pcase (caar filters)
+            (`or (nconc head tail))
+            (`saved
+             (let ((data (assoc head ibuffer-saved-filters)))
+               (unless data
+                 (ibuffer-filter-disable)
+                 (error "Unknown saved filter %s" head))
+               (append (cadr data) tail)))
+            (`not (cons head tail))
+            (_
+             (error "Filter type %s is not compound" (caar filters))))))
+    (setq ibuffer-filtering-qualifiers value))
   (ibuffer-update nil t))
 
 ;;;###autoload
-- 
2.10.2

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




Reply sent to Tino Calancha <tino.calancha <at> gmail.com>:
You have taken responsibility. (Wed, 07 Dec 2016 11:52: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 11:52:02 GMT) Full text and rfc822 format available.

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

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 24997-done <at> debbugs.gnu.org
Subject: Re: bug#24997: 26.0.50;
 ibuffer-decompose-filter has side effects on error
Date: Wed, 07 Dec 2016 20:50:57 +0900
Tino Calancha <tino.calancha <at> gmail.com> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> Please always accompany bug fixes with a test, if that is feasible.
>>
>> Thanks.
> Added one test on commit 561ce85
Pushed to master branch as commit 7b1e97f




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

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

Previous Next


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