bug-coreutils
[Top][All Lists]
Advanced

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

bug#26991: New quoting takes up unnecessary space


From: L A Walsh
Subject: bug#26991: New quoting takes up unnecessary space
Date: Fri, 19 May 2017 17:37:29 -0700
User-agent: Thunderbird



Pádraig Brady wrote:
On 19/05/17 07:48, L A Walsh wrote:

The new format uses extra spacing on columns where it isn't needed --
but the extra space isn't enough to handle the 1 file that was quoted
(needs 5 extra columns).  Where does it get '3' (and why doesn't it use
2?)?

Yes one can construct edge cases where this isn't ideal.
The normal case though is the quoted files are interspersed
in various columns.
---
 Like this?:

'"aaaa'\''"'   bbbbbbb0   'ddd ddd1'   eeeeeee0   ggggggg    hhhhhhh1
'aaa aaa1'     bbbbbbb2    ddddddd     eeeeeee2   ggggggg0   hhhhhhh2
aaaaaaa0     'ccc ccc1'   ddddddd0    fffffff    ggggggg1
aaaaaaa2      ccccccc     ddddddd2    fffffff0   ggggggg2
'bbb bbb1'     ccccccc0   'eee eee1'   fffffff1   hhhhhhh
bbbbbbb       ccccccc2    eeeeeee     fffffff2   hhhhhhh0
       1234567        1234        1234        123        123

You have 3 different spacings between columns.  Your argument
of using 3-spaces for an extra quote vs. 2 when not needed is looking pretty unsupportable since it doesn't use 3 when quotes ARE needed (it uses 4). The above could just as easily have been:

'"aaaa'\''"'   bbbbbbb0   'ddd ddd1'  eeeeeee0   ggggggg    hhhhhhh1
'aaa aaa1'     bbbbbbb2    ddddddd    eeeeeee2   ggggggg0   hhhhhhh2
aaaaaaa0     'ccc ccc1'   ddddddd0   fffffff    ggggggg1
aaaaaaa2      ccccccc     ddddddd2   fffffff0   ggggggg2
'bbb bbb1'     ccccccc0    eeeeeee1   fffffff1   hhhhhhh
bbbbbbb       ccccccc2    eeeeeee    fffffff2   hhhhhhh0

And this:
'"aaa'\''"'   bbbbbb     cccccc0    dddddd2    ffffff    gggggg0   hhhhhh1
'aaa aa1'     bbbbbb0    cccccc2   'eee ee1'   ffffff0   gggggg1   hhhhhh2
aaaaaa0      bbbbbb2   'ddd dd1'   eeeeee     ffffff1   gggggg2
aaaaaa2     'ccc cc1'   dddddd     eeeeee0    ffffff2   hhhhhh
'bbb bb1'     cccccc     dddddd0    eeeeee2    gggggg    hhhhhh0
       12345        123        123         123       123       123
12345678901234567890123456789012345678901234567890123456789012345678901234567890

Could have been:

'"aaa'\''"'  'bbb bb1'        'ccc cc1'  dddddd1  eeeeee1  ffffff   gggggg   
hhhhhh
'aaa aa1'     bbbbb      cccccc    dddddd   eeeeee   ffffff0  gggggg0  hhhhhh0
aaaaaa0      bbbbb0     cccccc0   dddddd0  eeeeee0  ffffff1  gggggg1  hhhhhh1
aaaaaa2      bbbbb2     cccccc2   dddddd2  eeeeee2  ffffff2  gggggg2  hhhhhh2
12 12 12 12 12 12 12 12345678901234567890123456789012345678901234567890123456789012345678901234567890


It's more important to have consistent spacing I think on modern terminals.
----
        But you don't as shown above -- you simply waste an extra space using
3 columns of padding rather than 2.


Anyway with layouts
like this you get more wasted space when a few files have
relatively longer names, irrespective of quoting, which is
a much more common issue.
---
        Irrelevant. You are using 3 spaces when no quoting is
needed, instead of 2, forcing an extra column into all output
regardless of name length.


The spacing is increased to 3 to allow for an extra space
for left alignment of non quoted items with quoted ones.
---
        As shown above it isn't needed.  I have 2 between 2 quoted items,
between a combo w/1-quoted and 1 not, and 2 between non-quoted.  2-spaces
between visible characters in all columns.

The alignment is more important for long listing I think,
but thought it a net benefit for other formats also.
---
        For a long listing, you don't multiply the spacing
by N columns. You only have 1 column, so ANY filename w/a quote would require an extra space for the entire (1) column to line up, but
in a long listing things are still odd looking w/the last column sticking out:
ls -l *[ab]*
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:28 '"aaa'\''"'
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27 'aaa aa1'
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27  aaaaaa0
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27  aaaaaa2
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27 'bbb bb1'
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27  bbbbbb
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27  bbbbbb0
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27  bbbbbb2

---vs. non quoted format---

-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:28 "aaa'"
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27 aaa aa1
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27 aaaaaa0
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27 aaaaaa2
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27 bbb bb1
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27 bbbbbb
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27 bbbbbb0
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27 bbbbbb2

Very simply, the new format is wasting space with no justifiable reason.






reply via email to

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