[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ls output changes considered unacceptable

From: Bernhard Voelker
Subject: Re: ls output changes considered unacceptable
Date: Thu, 18 Feb 2016 10:08:05 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 02/18/2016 02:46 AM, Michael Stone wrote:
> Ironically, the original solution (the ?'s) was more interoperable for 
> many use cases. 

... and a big trap:

People are lazy and like copy+paste.
Consider the following files:

  $ alias lsold=/usr/bin/ls
  $  alias lsnew=$HOME/coreutils/src/ls

  $ lsold
  a b  a?b  a'b  a"b  a*b  a?b  axb

  $ lsnew
  'a b' 'a?b' 'a'\''b' 'a"b' 'a*b' 'a'$'\n''b' axb

Without shell quoting, consider what would happen when the user
copies the name of a file with globbing characters ('?', '*') or
one where an unprintable character is printed like one (e.g. $'\n'
mapped to '?'), and pastes it as arguments to e.g. rm(1):

  $ rm -v a?b
  removed ‘a b’
  removed ‘a?b’
  removed ‘a'b’
  removed ‘a"b’
  removed ‘a*b’
  removed ‘a\nb’
  removed ‘axb’

Also with ' or " in the file name, this could potentially lead
to unexpected results when the quoting spans several file names
and the globbing result matches an existing file name.

BTW: you like to replay the above example?  Try copy+paste with
the above ls output ...

Although the new output looks strange at first, it seems to be
really useful to avoid accidental naming collisions because it
avoids unescaped globbing characters.

I was quite neutral regarding this change in the beginning, but
the above safety seems to be worth the change in mind regarding
the expected output of ls.

I brought coreutils-8.25 without a change into openSUSE:Tumbleweed
(the build/QA cycle took some time, so it is available for
Tumbleweed users only since yesterday), and will see if there
are major complaints from our users.

Finally I'd like to ask the other way round: is there a use case
- other than copying to a GUI - where the new format would make

Have a nice day,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]