On Sat, Apr 27, 2019 at 9:38 AM Warner Losh <imp(a)bsdimp.com> wrote:
On Sat, Apr 27, 2019 at 8:26 AM Anthony Martin <ality(a)pbrane.org> wrote:
From at least V2 to V6, the ls(1) command would
not
show directory entries whose names began with a '.'
unless the -a flag was supplied.
This was changed in V7: only the directory entries
for "." and ".." would be skipped by default.
gnu ls does not follow this convention. The system V sources one can find
on the internet have the curious code:
#define DOTSUP 1
...
if (aflg==0 && dentry->d_name[0]=='.'
# ifndef DOTSUP
&& (dentry->d_name[1]=='\0' ||
dentry->d_name[1]=='.'
&& dentry->d_name[2]=='\0')
# endif
) /* check for directory items '.',
'..',
* and items without valid inode-number;
*/
continue;
which is the V7 behavior ifdef'd out.
I've confirmed that all the ls.c's that I have from AT&T, apart from
research, do the . is a hidden file thing in ls. All the research things
inherit the V7 behavior (though the V8 sources I found have an
off-by-default ifdef for the BSD behavior). All descendants of SysV that I
could find source to have the V6 behavior, not V7. Both system III and all
revs of System V I could find have an #ifdef for this, and a 1 line change
restore the V7 behavior. Illumos has the BSD semantics and has lost even
the ifdef.
As pointed out later in the thread I was incorrect about 'base on 4.1BSD. I
took a closer look at the sources we have. The kernel has various bits of
BSD included in it starting in V8, but as noted the networking bits seem
odd to my eye. I didn't do a detailed analysis beyond spot checking a few
files. The userland looks more like evolved V7 code with some BSDism
imported rather than a wholesale switch to the BSD versions.
I like the dot is hidden thing. It's simple, elegant, and transports to
other systems well, so long as they are unix or have filesystems that don't
get hung up on 'extension'. That latter bit is likely why many find it...
distasteful.
Warner