/bin/ls vs .dotted files

Chris Turner c.turner at 199technologies.com
Thu Sep 13 20:46:24 PDT 2012

On 09/13/12 19:41, Matthew Dillon wrote:
>      I can't think of a good reason why f_listdot is set for root
>      automatically,

Agreed -

Except that if you're root, you don't want to be 'user friendlyified'
and miss files that should be found/removed/inspected/etc, possibly.

Alternately - why is it *not set* otherwise?
who says these dot files should be hidden anyway?

>      It goes all the way back to the original import in 2003 when we forked
>      from FreeBSD.

Correction - goes back to at least 2BSD/3BSD in 1979:

# tar ztvf ../2bsd.tar.gz ./src/ls.c
-rw-r--r--  0 mhol   wheel   11507 May  9  1979 src/ls.c
# grep Aflg.*uid src/ls.c
         Aflg = getuid() == 0;
# grep 'Modified by' ls.c
  * Modified by Bill Joy UCB May/August 1977

# tar ztvf ../3bsd.tar.gz usr/src/cmd/ls/*.c
-rw-r--r--  0 mhol   daemon   7235 Feb 12  1979 usr/src/cmd/ls/ls.c
-rw-r--r--  0 mhol   staff   18644 Oct 11  1979 usr/src/cmd/ls/ucbls.c
# grep 'Aflg.*getuid' ucbls.c
         Aflg = getuid() == 0;
# grep 'Modified by' ucbls.c
  * Modified by Bill Joy UCB May/August 1977

ls.c here is almost identical to v7/32V - and ls.c/v7/32v does
not include the root-specific behavior. The 'ucbls' in 3BSD and
ls.c in 2BSD does lots of interesting 'modern ls' stuff other
than '-A' - from the header:

  * Columnar output is the default.
  * If, however, the standard output is not a teletype, the default
  * is one-per-line.

this is not 'consistent' either.. noone is talking of removing this..

The 1BSD 'ls.c' has the terminal/noterminal '-1' stuff, and a modification
date of 1977, with the matching May/August comment - but no uid stuff.
So probably somewhere between 1 and 2BSD the '-A' default was added.

For 32Bit/VAX BSD Unix - The 'bsd ls' is included as default 4.2BSD
in 1983[2]:

dev01# tar ztvf src.tar.gz bin/ls.c
-r--r--r--  0 0      10      14161 Sep 26  1983 ./bin/ls.c
# grep sccsid bin/ls.c
static  char *sccsid = "@(#)ls.c        4.20 (Berkeley) 9/22/83";
# sed -n 69,70p ./bin/ls.c
         if (getuid() == 0)

>      At the very least I will bring in this change.  But it may well be
>      that we should also change the default to NOT be -A for root.

My vote depends on if V7 or 4.2BSD is the 'true unix'.
And that is a whole discussion unto itself :D

In this *particular* case, I will defer to the wisdom of Cliff Stoll[3]:

   The Unix operating system was invented in the early 1970's at AT&T's Bell
Laboratories in New Jersey. In the late '70s, Unix zealots from Bell Labs
visited the Berkeley campus, and a new, richer version of Unix was developed.
Along with hot tubs, leftist politics, and the free speech movement,
Berkeley is known for its Unix implementation.
   A schism developed between advocates of the small, compact AT&T Unix and
the more elaborate Berkeley implementation. Despite conferences, standards,
and promises, no consensus has appeared, and the world is left with two
competing Unix operating systems.
   Of course, our lab used Berkeley Unix, as do all right-thinking folks.
East Coast people were said to be biased towards AT&T Unix, but then,
they hadn't discovered hot tubs either.
   From a single letter, Dave ruled out the entire computing population
of the West Coast. Conceivably, a Berkeley hacker might use an old-fashioned
command, but Dave discounted this. "We're watching someone who's never used
Berkeley Unix." He sucked in his breath and whispered, "A heathen."


Ok there goes most of an evening. But I always wondered that myself. lol.

.. [1] http://ftp.math.utah.edu/pub///mirrors/minnie.tuhs.org/4BSD/Distributions/3bsd.tar.gz
.. [2] http://ftp.math.utah.edu/pub///mirrors/minnie.tuhs.org/4BSD/Distributions/4.2BSD/src.tar.gz
.. [3] http://en.wikipedia.org/wiki/The_Cuckoo%27s_Egg_%28book%29

More information about the Users mailing list