bug#57946: ls indenting broken if executed without color flag after i set tabs to 4

2022-09-20 Thread Paul Eggert via GNU coreutils Bug Reports

On 9/19/22 20:19, galih surya wrote:

Actually, I don't know if this is a bug.


It's not something 'ls' can easily fix, because 'ls' can't deduce from 
the operating system that you have installed nonstandard tab stops.


I installed the attached to try to document the issue.

Messing with hardware tab stops is typically more trouble than it's 
worth. I think the last time I did it was back in the 1970s, with a IBM 
029 keypunch drum card. Back then it sort of made sense, if you were 
programming in assembler or FORTRAN 66. Nowadays, not so much.From 4cbe227fa0b1bfd05b10245a3466ed99413e3a15 Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Tue, 20 Sep 2022 00:09:42 -0700
Subject: [PATCH] doc: warn about tabs command (bug#57946)

---
 doc/coreutils.texi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index e6eae44dc..adf957e61 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -8295,6 +8295,15 @@ TAB following a non-ASCII byte.  You can avoid that issue by using the
 @option{-T0} option or put @code{TABSIZE=0} in your environment, to tell
 @command{ls} to align using spaces, not tabs.
 
+If set a terminal's hardware tabs to anything other than the default,
+you should also use a @command{--tabsize} option or @env{TABSIZE}
+environment variable either to match the hardware tabs, or to disable
+the use of hardware tabs.  Otherwise, the output of @command{ls} may
+not line up.  For example, if you run the shell command @samp{tabs -4}
+to set hardware tabs to every four columns, you should also run
+@samp{export TABSIZE=4} or @samp{export TABSIZE=0}, or use the
+corresponding @option{--tabsize} options.
+
 @item -w @var{cols}
 @itemx --width=@var{cols}
 @opindex -w
-- 
2.37.3



bug#57946: ls indenting broken if executed without color flag after i set tabs to 4

2022-09-19 Thread galih surya
Actually, I don't know if this is a bug. But, when I set tabs to 4 in bash

$ tabs 4

then ls (without the color flag) a big directory, such as /usr/bin

$ alias
$ ls /usr/bin/
(lots of white text)...
 elfedit  info   nl-route-add
 sndfile-deinterleavexzegrep
 env  infocmpnl-route-delete
sndfile-infoxzfgrep
 envsubst infotocap  nl-route-get
 sndfile-interleave  xzgrep
 eqn  init   nl-route-list
sndfile-metadata-getxzless
 eqn2graphinsmod nl-rule-list
 sndfile-metadata-setxzmore
 escapesrcinstallnl-tctree-list
 sndfile-playyacc
 event_rpcgen.py  install-info   nl-util-addr
 sndfile-salvage yat2m
 expand   integritysetup nm
 soelim  yes
 expiry   ionice nmcli sort
   zcat
 expr ip nm-online sotruss
zcmp
 factor   ip6tables  nmtui
source-highlightzdiff

Compare to when I use color flag...

$ ls --color=auto /usr/bin/
(lots of colored text)...
 faillock  ip6tables-apply
nmtui-connect  source-highlight-esc.sh zdump
 faillog ip6tables-legacy
nmtui-editsource-highlight-settings   zegrep
 faked  ip6tables-legacy-restore
nmtui-hostname speaker-test   zfgrep
 fakeroot  ip6tables-legacy-save  nohup
 speexdec   zforce
 fallocate  ip6tables-nft
nologinspeexenc   zgrep
 falseip6tables-nft-restore
nproc  splitzic
 fancontrol   ip6tables-nft-save
npth-config sprof   zless
 fax2ps ip6tables-restore
nroffsqldiff
zmore
 fax2tiff ip6tables-restore-translate nscd
 sqlite3znew

The indentation didn't broke at all.
If this is a bug, please fix it. Thanks!