GNU bug report logs - #10607
Handle all the escapes used by ls -b

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Thu, 26 Jan 2012 06:50:01 UTC

Severity: minor

Tags: confirmed

To reply to this bug, email your comments to 10607 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


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

From: Glenn Morris <rgm <at> gnu.org>
To: quiet <at> debbugs.gnu.org
Subject: Handle all the escapes used by ls -b
Date: Thu, 26 Jan 2012 01:48:59 -0500
Package: emacs
Severity: minor

Emacs only partially handles (setq dired-listing-switches "-alb") at the
moment. Ideally, should add handling for all possible file-name
characters (eg  = \a, etc). dired-goto-file needs this, possibly other
places.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10607; Package emacs. (Wed, 20 Jan 2021 17:42:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 10607 <at> debbugs.gnu.org
Subject: Re: bug#10607: Handle all the escapes used by ls -b
Date: Wed, 20 Jan 2021 18:41:19 +0100
Glenn Morris <rgm <at> gnu.org> writes:

> Emacs only partially handles (setq dired-listing-switches "-alb") at the
> moment. Ideally, should add handling for all possible file-name
> characters (eg  = \a, etc). dired-goto-file needs this, possibly other
> places.

This problem is still present in Emacs 28.

Case to reproduce:

(progn
  (setq dired-listing-switches "-alb")
  (shell-command "touch /tmp/a\ab")
  (dired "/tmp/")
  (dired-goto-file "/tmp/a\ab"))

This will not go to the a^Gb file.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) confirmed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 20 Jan 2021 17:42:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10607; Package emacs. (Tue, 04 Apr 2023 20:52:02 GMT) Full text and rfc822 format available.

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

From: Charles El Hourani <charlie.eh <at> gmail.com>
To: 10607 <at> debbugs.gnu.org
Subject: bug-10607
Date: Tue, 4 Apr 2023 21:52:39 +0300
[Message part 1 (text/plain, inline)]
Here is a way to solve the issue by calling `ls` directly, without
re-implementing the "-b" functionality of ls in elisp.
[Message part 2 (text/html, inline)]
[0001-Fix-dired-goto-file-when-b-is-provided-to-ls-bug-106.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10607; Package emacs. (Wed, 05 Apr 2023 04:46:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Charles El Hourani <charlie.eh <at> gmail.com>
Cc: 10607 <at> debbugs.gnu.org
Subject: Re: bug#10607: bug-10607
Date: Wed, 05 Apr 2023 07:45:57 +0300
> From: Charles El Hourani <charlie.eh <at> gmail.com>
> Date: Tue, 4 Apr 2023 21:52:39 +0300
> 
> Here is a way to solve the issue by calling `ls` directly, without re-implementing the "-b" functionality of ls in
> elisp.
> 
> From 22962ffd84370ac05017ed05cca88286d010aa0e Mon Sep 17 00:00:00 2001
> From: Charlie El Hourani <charlie.eh <at> gmail.com>
> Date: Tue, 4 Apr 2023 21:26:07 +0300
> Subject: [PATCH] Fix dired goto file when -b is provided to ls (bug#10607)
> 
> This fixes the goto file in dired mode for:
> - files containing a control character
> - and when dired uses ls with the "-b" flag
> 
> The goto file function calls 'ls' to give it the escaped name.

Thanks, but is it really a good idea to invoke a program each time we
move in Dired?  dired-goto-file is a function that is used very
frequently.

In any case, calling literally "ls" is not TRT, IMO, since the user
could have modified the value of insert-directory-program.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10607; Package emacs. (Thu, 06 Apr 2023 16:47:02 GMT) Full text and rfc822 format available.

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

From: Charles El Hourani <charlie.eh <at> gmail.com>
To: 10607 <at> debbugs.gnu.org
Subject: Re: bug#10607: bug-10607
Date: Thu, 6 Apr 2023 12:45:46 -0400
[Message part 1 (text/plain, inline)]
Practically, the concern I see in this additional `ls` call here is a
slowdown when dired is used for remote locations. It is an added delay to
the delay already incurred with read-file-name when called interactively.

On that note, dired-goto-file could just use the files already inserted in
the buffer to provide options to the user to pick from. That could obviate
the need to convert the read-file-name choice to what dired originally got
from the insert-directory-program.

Listing the missing control characters is another option, but placing this
conversion in dired is making it more complex when the
insert-directory-program like "ls" is already handling it.

We could call here insert-directory-program instead of "ls", unless the
escape option is not supported in this program. I don't know how we can
find that out.

On Wed, Apr 5, 2023 at 12:45 AM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Charles El Hourani <charlie.eh <at> gmail.com>
> > Date: Tue, 4 Apr 2023 21:52:39 +0300
> >
> > Here is a way to solve the issue by calling `ls` directly, without
> re-implementing the "-b" functionality of ls in
> > elisp.
> >
> > From 22962ffd84370ac05017ed05cca88286d010aa0e Mon Sep 17 00:00:00 2001
> > From: Charlie El Hourani <charlie.eh <at> gmail.com>
> > Date: Tue, 4 Apr 2023 21:26:07 +0300
> > Subject: [PATCH] Fix dired goto file when -b is provided to ls
> (bug#10607)
> >
> > This fixes the goto file in dired mode for:
> > - files containing a control character
> > - and when dired uses ls with the "-b" flag
> >
> > The goto file function calls 'ls' to give it the escaped name.
>
> Thanks, but is it really a good idea to invoke a program each time we
> move in Dired?  dired-goto-file is a function that is used very
> frequently.
>
> In any case, calling literally "ls" is not TRT, IMO, since the user
> could have modified the value of insert-directory-program.
>
[Message part 2 (text/html, inline)]

This bug report was last modified 1 year and 26 days ago.

Previous Next


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