GNU bug report logs - #43789
27.1; Dired cannot handle file which name contains linebreak

Previous Next

Package: emacs;

Reported by: "Zhu Zihao" <all_but_last <at> 163.com>

Date: Sun, 4 Oct 2020 09:14:01 UTC

Severity: minor

Merged with 22477, 35578

Found in versions 24.5, 27.1

Done: Eli Zaretskii <eliz <at> gnu.org>

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 43789 in the body.
You can then email your comments to 43789 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#43789; Package emacs. (Sun, 04 Oct 2020 09:14:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Zhu Zihao" <all_but_last <at> 163.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 04 Oct 2020 09:14:02 GMT) Full text and rfc822 format available.

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

From: "Zhu Zihao" <all_but_last <at> 163.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.1; Dired cannot handle file which name contains linebreak
Date: Sun, 4 Oct 2020 16:58:06 +0800 (CST)
[Message part 1 (text/plain, inline)]
Step to reproduce:


1. Use touch from coreutils or find-file in Emacs to create a file which name contains a linebreak. (e.g. "line\nbreak")
2. Visit it in dired, you cannot do anything with this file because the characters after "\n" was ignored by dired.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Sun, 04 Oct 2020 09:38:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Zhu Zihao" <all_but_last <at> 163.com>
Cc: 43789 <at> debbugs.gnu.org
Subject: Re: bug#43789: 27.1;
 Dired cannot handle file which name contains linebreak
Date: Sun, 04 Oct 2020 12:36:58 +0300
> Date: Sun, 4 Oct 2020 16:58:06 +0800 (CST)
> From: "Zhu Zihao" <all_but_last <at> 163.com>
> 
> 1. Use touch from coreutils or find-file in Emacs to create a file which name contains a linebreak. (e.g.
> "line\nbreak")
> 2. Visit it in dired, you cannot do anything with this file because the characters after "\n" was ignored by
> dired.

You need to add -b to the 'ls' switches, and then it will work.  That
is:

  C-u C-x d
  b RET

The "b RET" part makes the switches passed to 'ls' be "-alb" instead
of the default "-al".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Sun, 04 Oct 2020 09:50:01 GMT) Full text and rfc822 format available.

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

From: "Zhu Zihao" <all_but_last <at> 163.com>
To: "Eli Zaretskii" <eliz <at> gnu.org>
Cc: 43789 <at> debbugs.gnu.org
Subject: Re:Re: bug#43789: 27.1; Dired cannot handle file which name
 contains linebreak
Date: Sun, 4 Oct 2020 17:49:17 +0800 (CST)
[Message part 1 (text/plain, inline)]
Thank you, what about make this a part of default ls switch?





















At 2020-10-04 17:36:58, "Eli Zaretskii" <eliz <at> gnu.org> wrote:
>> Date: Sun, 4 Oct 2020 16:58:06 +0800 (CST)
>> From: "Zhu Zihao" <all_but_last <at> 163.com>
>> 
>> 1. Use touch from coreutils or find-file in Emacs to create a file which name contains a linebreak. (e.g.
>> "line\nbreak")
>> 2. Visit it in dired, you cannot do anything with this file because the characters after "\n" was ignored by
>> dired.
>
>You need to add -b to the 'ls' switches, and then it will work.  That
>is:
>
>  C-u C-x d
>  b RET
>
>The "b RET" part makes the switches passed to 'ls' be "-alb" instead
>of the default "-al".
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Sun, 04 Oct 2020 10:55:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Zhu Zihao" <all_but_last <at> 163.com>
Cc: 43789 <at> debbugs.gnu.org
Subject: Re: bug#43789: 27.1; Dired cannot handle file which name
 contains linebreak
Date: Sun, 04 Oct 2020 13:54:44 +0300
> Date: Sun, 4 Oct 2020 17:49:17 +0800 (CST)
> From: "Zhu Zihao" <all_but_last <at> 163.com>
> Cc: 43789 <at> debbugs.gnu.org
> 
> Thank you, what about make this a part of default ls switch?

I think this would have unwanted effect on other control characters.
ISTR this was discussed in the past, but I cannot find that discussion
at the moment.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Mon, 05 Oct 2020 07:41:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 43789 <at> debbugs.gnu.org, Zhu Zihao <all_but_last <at> 163.com>
Subject: Re: bug#43789: 27.1; Dired cannot handle file which name contains
 linebreak
Date: Mon, 05 Oct 2020 09:39:54 +0200
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

> I think this would have unwanted effect on other control characters.
> ISTR this was discussed in the past, but I cannot find that discussion
> at the moment.

I experimented a bit with two files, one with a newline and one with a
C-b character:

[Message part 2 (image/png, inline)]
[Message part 3 (text/plain, inline)]
The latter works in dired by default, while the former doesn't.

Adding b to the switches gives me:

[Message part 4 (image/png, inline)]
[Message part 5 (text/plain, inline)]
The C-b file still works, and the one with newline also works.

Does anybody remember what the unwanted effect was?

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

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Mon, 05 Oct 2020 07:48:02 GMT) Full text and rfc822 format available.

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

From: "Zhu Zihao" <all_but_last <at> 163.com>
To: "Lars Ingebrigtsen" <larsi <at> gnus.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 43789 <at> debbugs.gnu.org
Subject: Re:Re: bug#43789: 27.1; Dired cannot handle file which name
 contains linebreak
Date: Mon, 5 Oct 2020 15:47:43 +0800 (CST)
[Message part 1 (text/plain, inline)]
It generally follows the escape rule of string in Elisp I think.





















At 2020-10-05 15:39:54, "Lars Ingebrigtsen" <larsi <at> gnus.org> wrote:
>Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> I think this would have unwanted effect on other control characters.
>> ISTR this was discussed in the past, but I cannot find that discussion
>> at the moment.
>
>I experimented a bit with two files, one with a newline and one with a
>C-b character:
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Mon, 05 Oct 2020 07:50:01 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 43789 <at> debbugs.gnu.org,
 Zhu Zihao <all_but_last <at> 163.com>
Subject: Re: bug#43789: 27.1; Dired cannot handle file which name contains
 linebreak
Date: Mon, 05 Oct 2020 09:49:13 +0200
One downside is that -b isn't POSIX.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Mon, 05 Oct 2020 08:12:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: larsi <at> gnus.org, 43789 <at> debbugs.gnu.org, all_but_last <at> 163.com
Subject: Re: bug#43789: 27.1; Dired cannot handle file which name contains
 linebreak
Date: Mon, 05 Oct 2020 11:10:59 +0300
> From: Andreas Schwab <schwab <at> linux-m68k.org>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  43789 <at> debbugs.gnu.org,  Zhu Zihao
>  <all_but_last <at> 163.com>
> Date: Mon, 05 Oct 2020 09:49:13 +0200
> 
> One downside is that -b isn't POSIX.

Right.

I'm also not sure everyone would like to see \002 instead of ^B.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Mon, 05 Oct 2020 08:19:01 GMT) Full text and rfc822 format available.

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

From: "Zhu Zihao" <all_but_last <at> 163.com>
To: "Eli Zaretskii" <eliz <at> gnu.org>
Cc: 43789 <at> debbugs.gnu.org, larsi <at> gnus.org,
 Andreas Schwab <schwab <at> linux-m68k.org>
Subject: Re:Re: bug#43789: 27.1; Dired cannot handle file which name
 contains linebreak
Date: Mon, 5 Oct 2020 16:18:11 +0800 (CST)
[Message part 1 (text/plain, inline)]
If "\002" can be display like ^B, we can make "\n" display like ^J in dired.





















At 2020-10-05 16:10:59, "Eli Zaretskii" <eliz <at> gnu.org> wrote:
>> From: Andreas Schwab <schwab <at> linux-m68k.org>
>> Cc: Eli Zaretskii <eliz <at> gnu.org>,  43789 <at> debbugs.gnu.org,  Zhu Zihao
>>  <all_but_last <at> 163.com>
>> Date: Mon, 05 Oct 2020 09:49:13 +0200
>> 
>> One downside is that -b isn't POSIX.
>
>Right.
>
>I'm also not sure everyone would like to see \002 instead of ^B.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Mon, 05 Oct 2020 08:27:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 43789 <at> debbugs.gnu.org, Andreas Schwab <schwab <at> linux-m68k.org>,
 all_but_last <at> 163.com
Subject: Re: bug#43789: 27.1; Dired cannot handle file which name contains
 linebreak
Date: Mon, 05 Oct 2020 10:26:29 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> One downside is that -b isn't POSIX.
>
> Right.

I thought I remembered seeing some code in dired to probe for whether a
switch was supported or not...  did I just dream that?

> I'm also not sure everyone would like to see \002 instead of ^B.

Both control characters and newlines are pretty rare occurrences in file
names, but I'd take \002 for ^B over a Dired that doesn't work with \n.
Functionality over prettiness, or something. 

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Mon, 05 Oct 2020 09:32:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: "Zhu Zihao" <all_but_last <at> 163.com>
Cc: 43789 <at> debbugs.gnu.org
Subject: Re: bug#43789: 27.1; Dired cannot handle file which name contains
 linebreak
Date: Mon, 05 Oct 2020 11:30:50 +0200
"Zhu Zihao" <all_but_last <at> 163.com> writes:

> Step to reproduce:
>
> 1. Use touch from coreutils or find-file in Emacs to create a file
> which name contains a linebreak. (e.g. "line\nbreak")
> 2. Visit it in dired, you cannot do anything with this file because
> the characters after "\n" was ignored by dired.

I recommend to avoid file names containing line breaks. Tramp, for
example, cannot handle them at all.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Mon, 05 Oct 2020 09:41:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Zhu Zihao" <all_but_last <at> 163.com>
Cc: 43789 <at> debbugs.gnu.org, larsi <at> gnus.org, schwab <at> linux-m68k.org
Subject: Re: bug#43789: 27.1; Dired cannot handle file which name
 contains linebreak
Date: Mon, 05 Oct 2020 12:40:16 +0300
> Date: Mon, 5 Oct 2020 16:18:11 +0800 (CST)
> From: "Zhu Zihao" <all_but_last <at> 163.com>
> Cc: "Andreas Schwab" <schwab <at> linux-m68k.org>, larsi <at> gnus.org, 
> 	43789 <at> debbugs.gnu.org
> 
> If "\002" can be display like ^B, we can make "\n" display like ^J in dired.

The display comes from 'ls'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Mon, 05 Oct 2020 09:52:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 43789 <at> debbugs.gnu.org, all_but_last <at> 163.com
Subject: Re: bug#43789: 27.1;
 Dired cannot handle file which name contains linebreak
Date: Mon, 05 Oct 2020 12:51:00 +0300
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Date: Mon, 05 Oct 2020 11:30:50 +0200
> Cc: 43789 <at> debbugs.gnu.org
> 
> "Zhu Zihao" <all_but_last <at> 163.com> writes:
> 
> > Step to reproduce:
> >
> > 1. Use touch from coreutils or find-file in Emacs to create a file
> > which name contains a linebreak. (e.g. "line\nbreak")
> > 2. Visit it in dired, you cannot do anything with this file because
> > the characters after "\n" was ignored by dired.
> 
> I recommend to avoid file names containing line breaks. Tramp, for
> example, cannot handle them at all.

Cannot agree more.  And I think we shouldn't tweak our implementation
too much for such use cases, given that there's an easy workaround.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Mon, 05 Oct 2020 16:54:02 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: Michael Albinus <michael.albinus <at> gmx.de>, Zhu Zihao <all_but_last <at> 163.com>
Cc: 43789 <at> debbugs.gnu.org
Subject: RE: bug#43789: 27.1; Dired cannot handle file which name contains
 linebreak
Date: Mon, 5 Oct 2020 09:53:15 -0700 (PDT)
> > 1. Use touch from coreutils or find-file in Emacs to create a file
> > which name contains a linebreak. (e.g. "line\nbreak")
> > 2. Visit it in dired, you cannot do anything with this file because
> > the characters after "\n" was ignored by dired.
> 
> I recommend to avoid file names containing line breaks. Tramp, for
> example, cannot handle them at all.

And it's likely to mess up font-locking and other
Dired features that expect a newline to indicate
the end of a Dired line.

Dired, and other line-oriented displays, are a bit
fragile in this respect.




Merged 22477 35578 43789. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 05 Oct 2020 23:14:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Tue, 06 Oct 2020 02:31:02 GMT) Full text and rfc822 format available.

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

From: Richard Stallman <rms <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 43789 <at> debbugs.gnu.org, all_but_last <at> 163.com
Subject: Re: bug#43789: 27.1;
 Dired cannot handle file which name contains linebreak
Date: Mon, 05 Oct 2020 22:30:45 -0400
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > I recommend to avoid file names containing line breaks.

I agree -- but what if you have one, perhaps made by mistake?
The natural way for an Emacs user to rename or delete it
is with Dired.  It would be nice for Dired to handle it
at least enough to do that.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Tue, 06 Oct 2020 09:00:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Richard Stallman <rms <at> gnu.org>
Cc: 43789 <at> debbugs.gnu.org, all_but_last <at> 163.com
Subject: Re: bug#43789: 27.1; Dired cannot handle file which name contains
 linebreak
Date: Tue, 06 Oct 2020 10:59:39 +0200
Richard Stallman <rms <at> gnu.org> writes:

Hi Richard,

>   > I recommend to avoid file names containing line breaks.
>
> I agree -- but what if you have one, perhaps made by mistake?
> The natural way for an Emacs user to rename or delete it
> is with Dired.  It would be nice for Dired to handle it
> at least enough to do that.

But that's already possible. The user might set temporarily

(setq dired-actual-switches "-alb")

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43789; Package emacs. (Tue, 06 Oct 2020 16:12:01 GMT) Full text and rfc822 format available.

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

From: "Zhu Zihao" <all_but_last <at> 163.com>
To: "Eli Zaretskii" <eliz <at> gnu.org>
Cc: 43789 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>
Subject: Re:Re: bug#43789: 27.1; Dired cannot handle file which name
 contains linebreak
Date: Wed, 7 Oct 2020 00:11:35 +0800 (CST)
[Message part 1 (text/plain, inline)]
I think I get an acceptable solution. thank you  all!


We may close this issue now.






At 2020-10-05 17:51:00, "Eli Zaretskii" <eliz <at> gnu.org> wrote:
>> From: Michael Albinus <michael.albinus <at> gmx.de>
>> Date: Mon, 05 Oct 2020 11:30:50 +0200
>> Cc: 43789 <at> debbugs.gnu.org
>> 
>> "Zhu Zihao" <all_but_last <at> 163.com> writes:
>> 
>> > Step to reproduce:
>> >
>> > 1. Use touch from coreutils or find-file in Emacs to create a file
>> > which name contains a linebreak. (e.g. "line\nbreak")
>> > 2. Visit it in dired, you cannot do anything with this file because
>> > the characters after "\n" was ignored by dired.
>> 
>> I recommend to avoid file names containing line breaks. Tramp, for
>> example, cannot handle them at all.
>
>Cannot agree more.  And I think we shouldn't tweak our implementation
>too much for such use cases, given that there's an easy workaround.
[Message part 2 (text/html, inline)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Tue, 06 Oct 2020 16:27:01 GMT) Full text and rfc822 format available.

Notification sent to "Zhu Zihao" <all_but_last <at> 163.com>:
bug acknowledged by developer. (Tue, 06 Oct 2020 16:27:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Zhu Zihao" <all_but_last <at> 163.com>
Cc: 43789-done <at> debbugs.gnu.org, michael.albinus <at> gmx.de
Subject: Re: bug#43789: 27.1; Dired cannot handle file which name
 contains linebreak
Date: Tue, 06 Oct 2020 19:25:53 +0300
> Date: Wed, 7 Oct 2020 00:11:35 +0800 (CST)
> From: "Zhu Zihao" <all_but_last <at> 163.com>
> Cc: "Michael Albinus" <michael.albinus <at> gmx.de>, 43789 <at> debbugs.gnu.org
> 
> I think I get an acceptable solution. thank you  all!
> 
> We may close this issue now.

Done, thanks.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Tue, 06 Oct 2020 16:27:02 GMT) Full text and rfc822 format available.

Notification sent to Aura Kelloniemi <kaura.dev <at> sange.fi>:
bug acknowledged by developer. (Tue, 06 Oct 2020 16:27:02 GMT) Full text and rfc822 format available.

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Tue, 06 Oct 2020 16:27:02 GMT) Full text and rfc822 format available.

Notification sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
bug acknowledged by developer. (Tue, 06 Oct 2020 16:27:02 GMT) Full text and rfc822 format available.

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

This bug report was last modified 4 years and 224 days ago.

Previous Next


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