bug#26991: New quoting takes up unnecessary space

2018-12-13 Thread Assaf Gordon

Hello,

On 2017-05-19 6:37 p.m., L A Walsh wrote:



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





We created a summary of common issues and FAQs
regarding the quoting change in ls(1):
  https://www.gnu.org/software/coreutils/quotes.html

If there is an issue that is not addressed there,
please send an email to coreut...@gnu.org .

regards,
 - assaf





bug#26991: New quoting takes up unnecessary space

2017-05-19 Thread L A Walsh



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?:

'"'\''"'   bbb0   'ddd ddd1'   eee0   ggghhh1
'aaa aaa1' bbb2ddd eee2   ggg0   hhh2
aaa0 'ccc ccc1'   ddd0fffggg1
aaa2  ccc ddd2fff0   ggg2
'bbb bbb1' ccc0   'eee eee1'   fff1   hhh
bbb   ccc2eee fff2   hhh0
   123456712341234123123

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:


'"'\''"'   bbb0   'ddd ddd1'  eee0   ggghhh1
'aaa aaa1' bbb2dddeee2   ggg0   hhh2
aaa0 'ccc ccc1'   ddd0   fffggg1
aaa2  ccc ddd2   fff0   ggg2
'bbb bbb1' ccc0eee1   fff1   hhh
bbb   ccc2eeefff2   hhh0

And this: 


'"aaa'\''"'   bb cc0dd2ffgg0   hh1
'aaa aa1' bb0cc2   'eee ee1'   ff0   gg1   hh2
aa0  bb2   'ddd dd1'   ee ff1   gg2
aa2 'ccc cc1'   dd ee0ff2   hh
'bbb bb1' cc dd0ee2gghh0
   12345123123 123   123   123
12345678901234567890123456789012345678901234567890123456789012345678901234567890

Could have been:

'"aaa'\''"'  'bbb bb1''ccc cc1'  dd1  ee1  ff   gg   
hh
'aaa aa1' b  ccdd   ee   ff0  gg0  hh0
aa0  b0 cc0   dd0  ee0  ff1  gg1  hh1
aa2  b2 cc2   dd2  ee2  ff2  gg2  hh2
  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  aa0
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27  aa2
-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  bb
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27  bb0
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27  bb2

---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 aa0
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27 aa2
-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 bb
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27 bb0
-rw-rw-rw-+ 1 Bliss\law Bliss\lawgroup 0 May 18 23:27 bb2

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







bug#26991: New quoting takes up unnecessary space

2017-05-19 Thread Pádraig Brady
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. It's more important to have consistent
spacing I think on modern terminals. 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.

The spacing is increased to 3 to allow for an extra space
for left alignment of non quoted items with quoted ones.

The alignment is more important for long listing I think,
but thought it a net benefit for other formats also.

Pádraig.






bug#26991: New quoting takes up unnecessary space

2017-05-19 Thread L A Walsh



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

Here are 32 files:

 ls
aaa   bbb   ccc   ddd   eee   fff   ggg   
hhh
aaa0  bbb0  ccc0  ddd0  eee0  fff0  ggg0  
hhh0
aaa1  bbb1  ccc1  ddd1  eee1  fff1  ggg1  
hhh1
aaa2  bbb2  ccc2  ddd2  eee2  fff2  ggg2  
hhh2

#   ^^ -- 2 chars separate


 mv aaa \"\'\"#same number of characters
 ls  
'"'\''"'   bbb0   ccc1   ddd2   fffggg0   
hhh1
aaa0  bbb1   ccc2   eeefff0   ggg1   
hhh2

aaa1  bbb2   dddeee0   fff1   ggg2
aaa2  cccddd0   eee1   fff2   hhh
bbb   ccc0   ddd1   eee2   ggghhh0
  ^^^ - now using minimum of 3 spaces between columns