coreutils
[Top][All Lists]
Advanced

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

Re: suggestion: $LS_ARGS


From: Harald Dunkel
Subject: Re: suggestion: $LS_ARGS
Date: Tue, 27 Feb 2018 08:38:45 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Hi Eric,

On 02/23/18 15:01, Eric Blake wrote:
On 02/23/2018 02:14 AM, Harald Dunkel wrote:
Hi folks,

I would like to suggest to introduce an environment variable
"LS_ARGS", holding the default arguments to ls (similar to $LESS).

This could help to simplify the user environment. You don't have
to create clumsy aliases for ls anymore, but you could set

     export LS_ARGS="--color=never --quoting-style=escape"

in your .bashrc without affecting foreign ls implementations (AIX,
OpenBSD, Solaris, etc).

Sorry, but we are discouraging the use of magic environment variables that 
change default behavior (especially introducing new ones), precisely because 
they can be a surprise source of breakage to unsuspecting scripts.   Or, if you 
make the variable magic so that it is only consulted when invoked from an 
interactive user, so that you ensure you don't break scripts with an 
unsuspected change to the defaults, then you have to consider how easy it is to 
discover what your current interactive setup is doing.  But an interactive-only 
env-var has no more effect than an interactive alias or function wrapper, yet 
'type ls' will show you what alias or functions you have set but not what 
env-vars you have set.  Thus, even though it has the same effect on changing 
the interactive default, it is action at a distance that is not as easily 
discoverable to change that default if it is not desired.  So we are unlikely 
to act on this proposal.


I completely agree with your concerns about magic vars, but
please consider

- there are tons of magic vars in wide use today: LANG and
  LC_xxx, LD_LIBRARY_PATH, LS_COLORS, TAPE, etc. Some of them
  are pretty close to a vulnerability, but they are in daily
  use, still.

- AFAICS coreutils' ls (as of 8.29) is not compatible to the
  "standard" ls anyway, already changing its behavior on the
  fly, unless (!) you define QUOTING_STYLE. Sample:

        % touch /tmp/a\ b
        % ls -1 /tmp/a\ b
        '/tmp/a b'
        % src/ls -1 /tmp/a\ b | cut -d\' -f1
        /tmp/a b
        % export QUOTING_STYLE=shell
        % src/ls -1 /tmp/a\ b | cut -d\' -f1

        %

When did pipes become unreliable?


Regards
Harri



reply via email to

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