2019-06-11 17:57:30 +0200, Joerg Schilling:
> L A Walsh <[email protected]> wrote:
> 
> > On 2019/06/05 02:06, Joerg Schilling wrote:
> > > I believe that there is a 
> > > need to be able to check whether a shell hides "." and ".." from the glob
> > > results.
> > >   
> > How will you tell if that is the case, or whether or not the
> > underlying OS hides (or provides) them, OR whether or not the
> > underlying file system supports them?
> 
> This is why the Bourne Shell supports set -o globskipdot since last weekend.
> 
> The new code always hides the entries "." and ".." from readdir() and creates 
> synthesized entries with "set +o globskipdot" (which is the default).
[...]

Why make it default off? The sane value (where "chmod 644 .*"
or "rm -rf .*/snapshot" work as people would expect for
instance) would be on.

The only reason why I can imagine you'd want to default to off
would be if you want to keep some level of backward
compatibility.

But here, that's not even the case as you're synthesizing "." and
".." when it's off which is a change of behaviour from the old
behaviour.

The only remotely plausible reason I can think of why anyone
would want globs to include "." and ".." would be people trying
to find out whether readdir() returns them.

Like:

if [ .[.] = '.[.]' ]; then
  echo "Not a UNIX file system"
fi

Which would have worked on some systems with some shells
(including bosh before the change).

-- 
Stephane

Reply via email to