Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15412

Re: Wrong command option in the manual examples

Path csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Robert Elz <kre@munnari.OZ.AU>
Newsgroups gnu.bash.bug
Subject Re: Wrong command option in the manual examples
Date Mon, 23 Sep 2019 21:02:47 +0700
Lines 40
Approved bug-bash@gnu.org
Message-ID <mailman.879.1569248190.2190.bug-bash@gnu.org> (permalink)
References <59cf49b0-1292-b752-4fe8-8928fd558ebf@iki.fi> <CAD0rTC6EHd5w5A6kuD850mLzu+V_EJXQyoZ=amQcF9TktTSEJA@mail.gmail.com> <38052651-6d67-6107-660c-707ca39ee00c@case.edu> <23726.1569247367@jinx.noi.kre.to>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1569248191 27313 209.51.188.17 (23 Sep 2019 14:16:31 GMT)
X-Complaints-To action@cs.stanford.edu
Cc chet.ramey@case.edu, hk <hkadeveloper@gmail.com>, bug-bash@gnu.org
To Ilkka Virta <itvirta@iki.fi>
Envelope-to bug-bash@gnu.org
In-Reply-To <59cf49b0-1292-b752-4fe8-8928fd558ebf@iki.fi>
X-detected-operating-system by eggs.gnu.org: GNU/Linux 3.x [generic]
X-Received-From 2001:3c8:9009:181::2
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <23726.1569247367@jinx.noi.kre.to>
X-Mailman-Original-References <59cf49b0-1292-b752-4fe8-8928fd558ebf@iki.fi> <CAD0rTC6EHd5w5A6kuD850mLzu+V_EJXQyoZ=amQcF9TktTSEJA@mail.gmail.com> <38052651-6d67-6107-660c-707ca39ee00c@case.edu>
Xref csiph.com gnu.bash.bug:15412

Show key headers only | View raw


    Date:        Mon, 23 Sep 2019 12:29:18 +0300
    From:        Ilkka Virta <itvirta@iki.fi>
    Message-ID:  <59cf49b0-1292-b752-4fe8-8928fd558ebf@iki.fi>

  | (as well the standard '-depth', somewhat confusingly)

There is no real standard for this - NetBSD has deprecated the -depth
operator (which never really was one) and replaced it by a -d option
which makes much more sense (-depth never really was the right way to
do it).  -depth (the old way) is still supported for compat with old
scripts, but is only mentioned in doc in the STANDARDS section, as:

     Historically, the -d, -h, and -x options were implemented using the
     primaries "-depth", "-follow", and "-xdev".  These primaries always
     evaluated to true, and always took effect when the expression was parsed,
     before the file system traversal began.  As a result, some legal
     expressions could be confusing.  For example, in the expression "-print
     -or -depth", -print always evaluates to true, so the standard meaning of
     -or implies that -depth would never be evaluated, but that is not what
     happens; in fact, -depth takes effect immediately, without testing
     whether -print returns true or false.

What I think is the purpose of poor choice of an option, the FreeBSD -depth N
is done using -maxdepth and -mindepth in combination (using the same value).

(That is, to select a depth of exactly N, one requests a depth of no less
than N and no more than N (where N, if signed, has the usual meaning, of
course).

Either way (as "-depth N", or "-mindepth N -maxdepth N") this is an operator
that applies to each path element encountered, so makes sense to have as
an element of the find expression (unlike the old -depth which does not.)

I'd strongly suggest not using examples of anything using "-depth" - choose
some other example instead.

kre


Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Wrong command option in the manual examples Robert Elz <kre@munnari.OZ.AU> - 2019-09-23 21:02 +0700

csiph-web