GNU bug report logs - #73445
[PATCH] image-dired: quote file name fore search-forward-regexp

Previous Next

Package: emacs;

Reported by: Vitaliy Chepelev <vitalij <at> gmx.com>

Date: Tue, 24 Sep 2024 05:33:01 UTC

Severity: normal

Tags: patch

Fixed in version 31.1

Done: Stefan Kangas <stefankangas <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 73445 in the body.
You can then email your comments to 73445 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#73445; Package emacs. (Tue, 24 Sep 2024 05:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vitaliy Chepelev <vitalij <at> gmx.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 24 Sep 2024 05:33:02 GMT) Full text and rfc822 format available.

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

From: Vitaliy Chepelev <vitalij <at> gmx.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] image-dired: quote file name fore search-forward-regexp
Date: Tue, 24 Sep 2024 04:55:46 -0000
[Message part 1 (text/plain, inline)]
Tags: patch


In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, X toolkit) of
 2024-07-29 built on localhost
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: Gentoo Linux

[0001-image-dired-quote-file-name-fore-search-forward-rege.patch (text/patch, attachment)]
[Message part 3 (text/plain, inline)]
--
Best regards,

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73445; Package emacs. (Tue, 24 Sep 2024 18:26:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Vitaliy Chepelev <vitalij <at> gmx.com>, 73445 <at> debbugs.gnu.org
Subject: Re: bug#73445: [PATCH] image-dired: quote file name fore
 search-forward-regexp
Date: Tue, 24 Sep 2024 11:24:02 -0700
tags 73445 + pending
thanks

Could you resend the patch with a correct "From" line so that we
can get the attribution right?

Currently, the "From" line says:

> From: none <none>

Other than that, LGTM.

Bonus points if you include a ChangeLog according to CONTRIBUTE, but I
can easily write that for you.




Added tag(s) pending. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 24 Sep 2024 18:26:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73445; Package emacs. (Sat, 05 Oct 2024 01:11:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Vitaliy Chepelev <vitalij <at> gmx.com>
Cc: 73445 <at> debbugs.gnu.org
Subject: Re: bug#73445: [PATCH] image-dired: quote file name fore
 search-forward-regexp
Date: Fri, 4 Oct 2024 18:09:24 -0700
Stefan Kangas <stefankangas <at> gmail.com> writes:

> tags 73445 + pending
> thanks
>
> Could you resend the patch with a correct "From" line so that we
> can get the attribution right?
>
> Currently, the "From" line says:
>
>> From: none <none>
>
> Other than that, LGTM.
>
> Bonus points if you include a ChangeLog according to CONTRIBUTE, but I
> can easily write that for you.

Ping!




Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Sun, 15 Dec 2024 18:58:02 GMT) Full text and rfc822 format available.

Notification sent to Vitaliy Chepelev <vitalij <at> gmx.com>:
bug acknowledged by developer. (Sun, 15 Dec 2024 18:58:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Vitaliy Chepelev <vitalij <at> gmx.com>
Cc: 73445-done <at> debbugs.gnu.org
Subject: Re: bug#73445: [PATCH] image-dired: quote file name fore
 search-forward-regexp
Date: Sun, 15 Dec 2024 18:56:15 +0000
Version: 31.1

Vitaliy Chepelev <vitalij <at> gmx.com> writes:

> From fixed inside .patch. I don't know how to "include a ChangeLog
>  according to CONTRIBUTE", sorry.

Thanks for the patch.  Installed on master as commit 7930fe2f44f.

> From d0e7b67e10d3ecb34969c0af18ef6317fd96636d Mon Sep 17 00:00:00 2001
> From: vitalij <vitalij <at> gmx.com>
> Date: Tue, 24 Sep 2024 04:25:13 +0000
> Subject: [PATCH] image-dired: quote file name fore search-forward-regexp
>
> For example when you have file with name "file[image].jpg". and use M-x image-dired you will have error: image-dired-list-tags: Invalid regexp: "Unmatched [ or [^"
> ---
>  lisp/image/image-dired-dired.el |  2 +-
>  lisp/image/image-dired-tags.el  | 10 +++++-----
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/lisp/image/image-dired-dired.el b/lisp/image/image-dired-dired.el
> index 7219a10..c4e82e9 100644
> --- a/lisp/image/image-dired-dired.el
> +++ b/lisp/image/image-dired-dired.el
> @@ -383,7 +383,7 @@ matching tag will be marked in the Dired buffer."
>                        (file-name-directory curr-file)))
>          (setq curr-file (file-name-nondirectory curr-file))
>          (goto-char (point-min))
> -        (when (search-forward-regexp (format "\\s %s[*@]?$" curr-file) nil t)
> +        (when (search-forward-regexp (format "\\s %s[*@]?$" (regexp-quote curr-file)) nil t)
>            (setq hits (+ hits 1))
>            (dired-mark 1))))
>      (message "%d files with matching tag marked" hits)))
> diff --git a/lisp/image/image-dired-tags.el b/lisp/image/image-dired-tags.el
> index 54595ad..828372e 100644
> --- a/lisp/image/image-dired-tags.el
> +++ b/lisp/image/image-dired-tags.el
> @@ -79,7 +79,7 @@ FILE-TAGS is an alist in the following form:
>          (setq file (car elt)
>                tag (cdr elt))
>          (goto-char (point-min))
> -        (if (search-forward-regexp (format "^%s.*$" file) nil t)
> +        (if (search-forward-regexp (format "^%s.*$" (regexp-quote file)) nil t)
>              (progn
>                (setq end (point))
>                (beginning-of-line)
> @@ -103,7 +103,7 @@ FILES can be a name of a single file (a string) or a list of file names."
>            (error "Files must be a string or a list of strings!")))
>        (dolist (file files)
>          (goto-char (point-min))
> -        (when (search-forward-regexp (format "^%s;" file) nil t)
> +        (when (search-forward-regexp (format "^%s;" (regexp-quote file)) nil t)
>            (end-of-line)
>            (setq end (point))
>            (beginning-of-line)
> @@ -125,7 +125,7 @@ Value is a list of all tags for FILE."
>    (image-dired-sane-db-file)
>    (image-dired--with-db-file
>      (let (end (tags ""))
> -      (when (search-forward-regexp (format "^%s" file) nil t)
> +      (when (search-forward-regexp (format "^%s" (regexp-quote file)) nil t)
>          (end-of-line)
>          (setq end (point))
>          (beginning-of-line)
> @@ -179,7 +179,7 @@ FILE-COMMENTS is an alist on the following form:
>          (setq file (car elt)
>                comment (cdr elt))
>          (goto-char (point-min))
> -        (if (search-forward-regexp (format "^%s.*$" file) nil t)
> +        (if (search-forward-regexp (format "^%s.*$" (regexp-quote file)) nil t)
>              (progn
>                (setq end (point))
>                (beginning-of-line)
> @@ -236,7 +236,7 @@ Optionally use old comment from FILE as initial value."
>    (image-dired-sane-db-file)
>    (image-dired--with-db-file
>      (let (end comment-beg-pos comment-end-pos comment)
> -      (when (search-forward-regexp (format "^%s" file) nil t)
> +      (when (search-forward-regexp (format "^%s" (regexp-quote file)) nil t)
>          (end-of-line)
>          (setq end (point))
>          (beginning-of-line)
> --
> 2.44.2
>
>
> Stefan Kangas <stefankangas <at> gmail.com> writes:
>
>> Stefan Kangas <stefankangas <at> gmail.com> writes:
>>
>>> tags 73445 + pending
>>> thanks
>>>
>>> Could you resend the patch with a correct "From" line so that we
>>> can get the attribution right?
>>>
>>> Currently, the "From" line says:
>>>
>>>> From: none <none>
>>>
>>> Other than that, LGTM.
>>>
>>> Bonus points if you include a ChangeLog according to CONTRIBUTE, but I
>>> can easily write that for you.
>>
>> Ping!
>
> --
> Best regards,
> Vitaliy Chepelev
> Python Middle Data Scientist
> https://t.me/vitdata
> Magic numbers: 7850B0B5E3F536601D2E6A9DE1C43E074A047699




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

This bug report was last modified 235 days ago.

Previous Next


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