findutils-patches
[Top][All Lists]
Advanced

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

Re: [Findutils-patches] [PATCH] POSIX will soon standarise -path; un-dep


From: Eric Blake
Subject: Re: [Findutils-patches] [PATCH] POSIX will soon standarise -path; un-deprecate it.
Date: Mon, 20 Aug 2007 06:40:04 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to James Youngman on 8/19/2007 12:56 PM:
> 2007-08-19  James Youngman  <address@hidden>
> 
>       Prepare for POSIX standardisation of -path.
>       * find/parser.c (parse_path): This is the 'canonical' name once
>       again.
>       (parse_wholename): This is not.
>       (parse_ipath): No longer deprecated.
> 
>  
> address@hidden Test -wholename pattern
> address@hidden Test -iwholename pattern
> address@hidden Test -path pattern
> address@hidden Test -wholename pattern
>  True if the entire file name, starting with the command line argument
>  under which the file was found, matches shell pattern @var{pattern}.
> -For @samp{-iwholename}, the match is case-insensitive.  To ignore a
> -whole directory tree, use @samp{-prune} rather than checking every
> -file in the tree (@pxref{Directories}).  The ``entire file name'' as
> -used by @code{find} starts with the starting-point specified on the
> -command line, and is not converted to an absolute pathname, so for
> -example @code{cd /; find tmp -wholename /tmp} will never match
> -anything.
> +To ignore a whole directory tree, use @samp{-prune} rather than
> +checking every file in the tree (@pxref{Directories}).  The ``entire
> +file name'' as used by @code{find} starts with the starting-point
> +specified on the command line, and is not converted to an absolute
> +pathname, so for example @code{cd /; find tmp -wholename /tmp} will
> +never match anything.   The name @samp{-wholename} is GNU-specific,
> +but @samp{-path} is more portable; it is supported by HP-UX
> address@hidden and will soon be part of POSIX.

It may be worth following this sentence with one more, explaining why we
provide -wholename as a synonym for -path (because -path, although chosen
by POSIX, has the wrong connotation of being a list of directories, rather
than a single file name including directories).

>  
> +
> +In the context of the tests @samp{-path}, @samp{-wholename},
> address@hidden and @samp{-wholename}, a ``full path'' is the name of
> +all the directories traversed from @code{find}'s start point to the
> +file being tested, followed by the base name of the file itself.
> +These paths are often not absolute paths; for example
> +
> address@hidden
> +$ cd /tmp
> +$ mkdir -p foo/bar/baz
> +$ find foo -path foo/bar -print
> +foo/bar
> +$ find foo -path /tmp/foo/bar -print
> +$ find /tmp/foo -path /tmp/foo/bar -print
> +/tmp/foo/bar
> address@hidden example
> +
> +Notice that the second @code{find} command prints nothing, even though
> address@hidden/tmp/foo/bar} exists and was examined by @code{find}.

Also, it may be worth an example showing how * in the pattern matches even
/ and leading `.'.

> +++ b/find/parser.c
> @@ -279,7 +279,7 @@ static struct parser_table const parse_table[] =
>    PARSE_PUNCTUATION("or",                    or),         /* GNU */
>    PARSE_ACTION     ("ok",                    ok),
>    PARSE_ACTION     ("okdir",                 okdir), /* GNU (-execdir is 
> BSD) */
> -  PARSE_TEST       ("path",                  path), /* GNU, HP-UX, GNU 
> prefers wholename */
> +  PARSE_TEST       ("path",                  path), /* GNU, HP-UX, RMS 
> prefers wholename, but anyway soon POSIX */

Not introduced by this bug, but those are some long lines.  Is it worth
reformatting a bit to get 80-column lines?

Missing a NEWS entry.  Otherwise, I think this is ready for applying to
4.3.x, after addressing the above points.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGyYuj84KuGfSFAYARAk0MAJwI1FAbV3vvFNNj4R1SNPXG0Z/H6QCfadKV
BuwirMhrfQCSg2p0v5IqTRE=
=GArm
-----END PGP SIGNATURE-----




reply via email to

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