all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#43789: 27.1; Dired cannot handle file which name contains linebreak
@ 2020-10-04  8:58 Zhu Zihao
  2020-10-04  9:36 ` Eli Zaretskii
  2020-10-05  9:30 ` Michael Albinus
  0 siblings, 2 replies; 18+ messages in thread
From: Zhu Zihao @ 2020-10-04  8:58 UTC (permalink / raw)
  To: 43789

[-- Attachment #1: Type: text/plain, Size: 258 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 515 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-04  8:58 bug#43789: 27.1; Dired cannot handle file which name contains linebreak Zhu Zihao
@ 2020-10-04  9:36 ` Eli Zaretskii
  2020-10-04  9:49   ` bug#43789: " Zhu Zihao
  2020-10-05  9:30 ` Michael Albinus
  1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2020-10-04  9:36 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: 43789

> Date: Sun, 4 Oct 2020 16:58:06 +0800 (CST)
> From: "Zhu Zihao" <all_but_last@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".





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: Re: bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-04  9:36 ` Eli Zaretskii
@ 2020-10-04  9:49   ` Zhu Zihao
  2020-10-04 10:54     ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Zhu Zihao @ 2020-10-04  9:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 43789

[-- Attachment #1: Type: text/plain, Size: 684 bytes --]

Thank you, what about make this a part of default ls switch?





















At 2020-10-04 17:36:58, "Eli Zaretskii" <eliz@gnu.org> wrote:
>> Date: Sun, 4 Oct 2020 16:58:06 +0800 (CST)
>> From: "Zhu Zihao" <all_but_last@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".

[-- Attachment #2: Type: text/html, Size: 1159 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-04  9:49   ` bug#43789: " Zhu Zihao
@ 2020-10-04 10:54     ` Eli Zaretskii
  2020-10-05  7:39       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2020-10-04 10:54 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: 43789

> Date: Sun, 4 Oct 2020 17:49:17 +0800 (CST)
> From: "Zhu Zihao" <all_but_last@163.com>
> Cc: 43789@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.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-04 10:54     ` Eli Zaretskii
@ 2020-10-05  7:39       ` Lars Ingebrigtsen
  2020-10-05  7:47         ` bug#43789: " Zhu Zihao
  2020-10-05  7:49         ` Andreas Schwab
  0 siblings, 2 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-05  7:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 43789, Zhu Zihao

[-- Attachment #1: Type: text/plain, Size: 287 bytes --]

Eli Zaretskii <eliz@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:


[-- Attachment #2: Type: image/png, Size: 19083 bytes --]

[-- Attachment #3: Type: text/plain, Size: 102 bytes --]


The latter works in dired by default, while the former doesn't.

Adding b to the switches gives me:


[-- Attachment #4: Type: image/png, Size: 17864 bytes --]

[-- Attachment #5: Type: text/plain, Size: 221 bytes --]


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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: Re: bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-05  7:39       ` Lars Ingebrigtsen
@ 2020-10-05  7:47         ` Zhu Zihao
  2020-10-05  7:49         ` Andreas Schwab
  1 sibling, 0 replies; 18+ messages in thread
From: Zhu Zihao @ 2020-10-05  7:47 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43789

[-- Attachment #1: Type: text/plain, Size: 450 bytes --]

It generally follows the escape rule of string in Elisp I think.





















At 2020-10-05 15:39:54, "Lars Ingebrigtsen" <larsi@gnus.org> wrote:
>Eli Zaretskii <eliz@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:
>

[-- Attachment #2: Type: text/html, Size: 892 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-05  7:39       ` Lars Ingebrigtsen
  2020-10-05  7:47         ` bug#43789: " Zhu Zihao
@ 2020-10-05  7:49         ` Andreas Schwab
  2020-10-05  8:10           ` Eli Zaretskii
  1 sibling, 1 reply; 18+ messages in thread
From: Andreas Schwab @ 2020-10-05  7:49 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43789, Zhu Zihao

One downside is that -b isn't POSIX.

Andreas.

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





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-05  7:49         ` Andreas Schwab
@ 2020-10-05  8:10           ` Eli Zaretskii
  2020-10-05  8:18             ` bug#43789: " Zhu Zihao
  2020-10-05  8:26             ` Lars Ingebrigtsen
  0 siblings, 2 replies; 18+ messages in thread
From: Eli Zaretskii @ 2020-10-05  8:10 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: larsi, 43789, all_but_last

> From: Andreas Schwab <schwab@linux-m68k.org>
> Cc: Eli Zaretskii <eliz@gnu.org>,  43789@debbugs.gnu.org,  Zhu Zihao
>  <all_but_last@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.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: Re: bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-05  8:10           ` Eli Zaretskii
@ 2020-10-05  8:18             ` Zhu Zihao
  2020-10-05  9:40               ` Eli Zaretskii
  2020-10-05  8:26             ` Lars Ingebrigtsen
  1 sibling, 1 reply; 18+ messages in thread
From: Zhu Zihao @ 2020-10-05  8:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Andreas Schwab, larsi, 43789

[-- Attachment #1: Type: text/plain, Size: 470 bytes --]

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@gnu.org> wrote:
>> From: Andreas Schwab <schwab@linux-m68k.org>
>> Cc: Eli Zaretskii <eliz@gnu.org>,  43789@debbugs.gnu.org,  Zhu Zihao
>>  <all_but_last@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.

[-- Attachment #2: Type: text/html, Size: 936 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-05  8:10           ` Eli Zaretskii
  2020-10-05  8:18             ` bug#43789: " Zhu Zihao
@ 2020-10-05  8:26             ` Lars Ingebrigtsen
  1 sibling, 0 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-05  8:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Andreas Schwab, 43789, all_but_last

Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-04  8:58 bug#43789: 27.1; Dired cannot handle file which name contains linebreak Zhu Zihao
  2020-10-04  9:36 ` Eli Zaretskii
@ 2020-10-05  9:30 ` Michael Albinus
  2020-10-05  9:51   ` Eli Zaretskii
                     ` (2 more replies)
  1 sibling, 3 replies; 18+ messages in thread
From: Michael Albinus @ 2020-10-05  9:30 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: 43789

"Zhu Zihao" <all_but_last@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.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-05  8:18             ` bug#43789: " Zhu Zihao
@ 2020-10-05  9:40               ` Eli Zaretskii
  0 siblings, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2020-10-05  9:40 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: schwab, larsi, 43789

> Date: Mon, 5 Oct 2020 16:18:11 +0800 (CST)
> From: "Zhu Zihao" <all_but_last@163.com>
> Cc: "Andreas Schwab" <schwab@linux-m68k.org>, larsi@gnus.org, 
> 	43789@debbugs.gnu.org
> 
> If "\002" can be display like ^B, we can make "\n" display like ^J in dired.

The display comes from 'ls'.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-05  9:30 ` Michael Albinus
@ 2020-10-05  9:51   ` Eli Zaretskii
  2020-10-06 16:11     ` bug#43789: " Zhu Zihao
  2020-10-05 16:53   ` Drew Adams
  2020-10-06  2:30   ` Richard Stallman
  2 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2020-10-05  9:51 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 43789, all_but_last

> From: Michael Albinus <michael.albinus@gmx.de>
> Date: Mon, 05 Oct 2020 11:30:50 +0200
> Cc: 43789@debbugs.gnu.org
> 
> "Zhu Zihao" <all_but_last@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.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-05  9:30 ` Michael Albinus
  2020-10-05  9:51   ` Eli Zaretskii
@ 2020-10-05 16:53   ` Drew Adams
  2020-10-06  2:30   ` Richard Stallman
  2 siblings, 0 replies; 18+ messages in thread
From: Drew Adams @ 2020-10-05 16:53 UTC (permalink / raw)
  To: Michael Albinus, Zhu Zihao; +Cc: 43789

> > 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.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-05  9:30 ` Michael Albinus
  2020-10-05  9:51   ` Eli Zaretskii
  2020-10-05 16:53   ` Drew Adams
@ 2020-10-06  2:30   ` Richard Stallman
  2020-10-06  8:59     ` Michael Albinus
  2 siblings, 1 reply; 18+ messages in thread
From: Richard Stallman @ 2020-10-06  2:30 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 43789, all_but_last

[[[ 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)







^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-06  2:30   ` Richard Stallman
@ 2020-10-06  8:59     ` Michael Albinus
  0 siblings, 0 replies; 18+ messages in thread
From: Michael Albinus @ 2020-10-06  8:59 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 43789, all_but_last

Richard Stallman <rms@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.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: Re: bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-05  9:51   ` Eli Zaretskii
@ 2020-10-06 16:11     ` Zhu Zihao
  2020-10-06 16:25       ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Zhu Zihao @ 2020-10-06 16:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Michael Albinus, 43789

[-- Attachment #1: Type: text/plain, Size: 868 bytes --]

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@gnu.org> wrote:
>> From: Michael Albinus <michael.albinus@gmx.de>
>> Date: Mon, 05 Oct 2020 11:30:50 +0200
>> Cc: 43789@debbugs.gnu.org
>> 
>> "Zhu Zihao" <all_but_last@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.

[-- Attachment #2: Type: text/html, Size: 1279 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#43789: 27.1; Dired cannot handle file which name contains linebreak
  2020-10-06 16:11     ` bug#43789: " Zhu Zihao
@ 2020-10-06 16:25       ` Eli Zaretskii
  0 siblings, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2020-10-06 16:25 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: michael.albinus, 43789-done

> Date: Wed, 7 Oct 2020 00:11:35 +0800 (CST)
> From: "Zhu Zihao" <all_but_last@163.com>
> Cc: "Michael Albinus" <michael.albinus@gmx.de>, 43789@debbugs.gnu.org
> 
> I think I get an acceptable solution. thank you  all!
> 
> We may close this issue now.

Done, thanks.





^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-10-06 16:25 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-04  8:58 bug#43789: 27.1; Dired cannot handle file which name contains linebreak Zhu Zihao
2020-10-04  9:36 ` Eli Zaretskii
2020-10-04  9:49   ` bug#43789: " Zhu Zihao
2020-10-04 10:54     ` Eli Zaretskii
2020-10-05  7:39       ` Lars Ingebrigtsen
2020-10-05  7:47         ` bug#43789: " Zhu Zihao
2020-10-05  7:49         ` Andreas Schwab
2020-10-05  8:10           ` Eli Zaretskii
2020-10-05  8:18             ` bug#43789: " Zhu Zihao
2020-10-05  9:40               ` Eli Zaretskii
2020-10-05  8:26             ` Lars Ingebrigtsen
2020-10-05  9:30 ` Michael Albinus
2020-10-05  9:51   ` Eli Zaretskii
2020-10-06 16:11     ` bug#43789: " Zhu Zihao
2020-10-06 16:25       ` Eli Zaretskii
2020-10-05 16:53   ` Drew Adams
2020-10-06  2:30   ` Richard Stallman
2020-10-06  8:59     ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.