GNU bug report logs -
#75877
30.0.91; dired-omit-expunge embeds unquoted filename in format string
Previous Next
To reply to this bug, email your comments to 75877 AT debbugs.gnu.org.
There is no need to reopen the bug first.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75877
; Package
emacs
.
(Sun, 26 Jan 2025 18:27:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Derek Upham <derek_upham <at> mailfence.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 26 Jan 2025 18:27:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Looking at “dired-omit-expunge” in dired-x.el, in this block:
(setq count (+ count
(dired-do-kill-lines
nil
(if dired-omit-verbose
(format "Omitted %%d line%%s in %s"
(abbreviate-file-name
dired-directory))
"")
init-count)))
Here that “format” call generates a format template, such that
“dired-do-kill-lines” can invoke “message” with that text plus
count
information.
If the directory name contains embedded percentage characters,
then the
template ends up with extra parameter slots. The call to
“message”
fails with an error and Dired does not present the directory.
(error "Not enough arguments for format string")
(In case someone is curious “Why put percentages in the names at
all?”,
I use it to map those directories 1:1 with URLs/websites.)
In GNU Emacs 30.0.91 (build 2, x86_64-pc-linux-gnu, GTK+ Version
2.24.33, cairo version 1.18.2) of 2024-10-19 built on
priss.frightenedpiglet.com
Windowing system distributor 'The X.Org Foundation', version
11.0.12101014
System Description: Debian GNU/Linux trixie/sid
--
Derek Upham
derek_upham <at> mailfence.com
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75877
; Package
emacs
.
(Sat, 01 Feb 2025 10:58:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 75877 <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 26 Jan 2025 10:26:27 -0800
> From: Derek Upham via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
>
> Looking at “dired-omit-expunge” in dired-x.el, in this block:
>
> (setq count (+ count
> (dired-do-kill-lines
> nil
> (if dired-omit-verbose
> (format "Omitted %%d line%%s in %s"
> (abbreviate-file-name
> dired-directory))
> "")
> init-count)))
>
> Here that “format” call generates a format template, such that
> “dired-do-kill-lines” can invoke “message” with that text plus
> count
> information.
>
> If the directory name contains embedded percentage characters,
> then the
> template ends up with extra parameter slots. The call to
> “message”
> fails with an error and Dired does not present the directory.
>
> (error "Not enough arguments for format string")
>
> (In case someone is curious “Why put percentages in the names at
> all?”,
> I use it to map those directories 1:1 with URLs/websites.)
Thanks. Is the below the right fix?
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 4a05f60..89390a4 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -498,8 +498,10 @@ dired-omit-expunge
nil
(if dired-omit-verbose
(format "Omitted %%d line%%s in %s"
- (abbreviate-file-name
- dired-directory))
+ (replace-regexp-in-string
+ "%" "%%"
+ (abbreviate-file-name
+ dired-directory)))
"")
init-count)))
(force-mode-line-update))))
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Wed, 05 Feb 2025 13:50:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Derek Upham <derek_upham <at> mailfence.com>
:
bug acknowledged by developer.
(Wed, 05 Feb 2025 13:50:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 75877-done <at> debbugs.gnu.org (full text, mbox):
> From: Derek Upham <derek_upham <at> mailfence.com>
> Date: Tue, 04 Feb 2025 15:40:12 -0800
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > Thanks. Is the below the right fix?
> >
> > diff --git a/lisp/dired-x.el b/lisp/dired-x.el
> > index 4a05f60..89390a4 100644
> > --- a/lisp/dired-x.el
> > +++ b/lisp/dired-x.el
> > @@ -498,8 +498,10 @@ dired-omit-expunge
> > nil
> > (if dired-omit-verbose
> > (format "Omitted %%d line%%s
> > in %s"
> > -
> > (abbreviate-file-name
> > - dired-directory))
> > +
> > (replace-regexp-in-string
> > + "%" "%%"
> > +
> > (abbreviate-file-name
> > + dired-directory)))
> > "")
> > init-count)))
> > (force-mode-line-update))))
>
> Yeah, that patch will handle that use case. Thanks.
Thanks, installed on the master branch, and closing the bug.
This bug report was last modified 1 day ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.