Index | Thread | Search

From:
Jason McIntyre <jmc@kerhand.co.uk>
Subject:
Re: reference glob(7), not fnmatch(3) in utility manuals
To:
tech@openbsd.org
Date:
Tue, 3 Dec 2024 07:11:33 +0000

Download raw body.

Thread
On Fri, Nov 29, 2024 at 12:07:09PM -0800, Evan Silberman wrote:
> User utilities supporting glob(7) patterns should refer to that manual,
> rather than fnmatch(3), which doesn't actually document the pattern
> language.
> 
> diff /usr/src
> commit - 47aad511869fbab8df27a9d9220f3dfaa012d2e7
> path + /usr/src
> blob - abf65c7e9a0ca88ba53b20a2ffe0fe3d9f3e6ea7
> file + usr.bin/diff/diff.1
> --- usr.bin/diff/diff.1
> +++ usr.bin/diff/diff.1
> @@ -284,8 +284,8 @@ options may be specified.
>  .It Fl x Ar pattern
>  Exclude files and subdirectories from comparison whose basenames match
>  .Ar pattern .
> -Patterns are matched using shell-style globbing via
> -.Xr fnmatch 3 .
> +Patterns are matched using shell-style globbing as described by
> +.Xr glob 7 .
>  Multiple
>  .Fl x
>  options may be specified.

i committed this, but changed "by" to "in".

> blob - 4eacbc9ad141163c49d9b11c741e8cf5fde2b456
> file + usr.bin/kstat/kstat.1
> --- usr.bin/kstat/kstat.1
> +++ usr.bin/kstat/kstat.1
> @@ -51,16 +51,16 @@ The components of arguments are as follows:
>  .It Ar provider
>  The name of the device providing the statistical data.
>  Pattern matching with
> -.Xr fnmatch 3
> -is supported.
> +.Xr glob 7
> +patterns is supported.
>  .It Ar instance
>  An unsigned integer number.
>  Currently, all statistics use an instance number of 0.
>  .It Ar name
>  A string identifying the kind of data to be shown.
>  Pattern matching with
> -.Xr fnmatch 3
> -is supported.
> +.Xr glob 7
> +patterns is supported.
>  .It Ar unit
>  An unsigned integer number, used for example if a network device has
>  multiple rings.

i swithered about thw repitition of "Pattern matching with glob
patterns" but in the end left it as-is.

> blob - a959bc6130b574e258ae71aab21f15cacdb93d59
> file + usr.bin/locate/locate/locate.1
> --- usr.bin/locate/locate/locate.1
> +++ usr.bin/locate/locate/locate.1
> @@ -171,7 +171,7 @@ locate database
>  Zero matches are not considered an error.
>  .Sh SEE ALSO
>  .Xr find 1 ,
> -.Xr fnmatch 3 ,
> +.Xr glob 7 ,
>  .Xr locate.updatedb 8 ,
>  .Xr weekly 8
>  .Rs
> blob - f4a1642151b3077c882c1375c3b3dc3cc0479180
> file + usr.bin/tmux/tmux.1
> --- usr.bin/tmux/tmux.1
> +++ usr.bin/tmux/tmux.1

i haven't committed the tmux part yet as might tweak it, so will run it
past nicm.

jmc

> @@ -760,7 +760,7 @@ would match a session named
>  .Ql mysession .
>  .It
>  An
> -.Xr fnmatch 3
> +.Xr glob 7
>  pattern which is matched against the session name.
>  .El
>  .Pp
> @@ -808,8 +808,8 @@ An exact window name, such as
>  The start of a window name, such as
>  .Ql mysession:mywin .
>  .It
> -As an
> -.Xr fnmatch 3
> +As a
> +.Xr glob 7
>  pattern matched against the window name.
>  .El
>  .Pp
> @@ -2859,7 +2859,7 @@ other commands are not blocked from running until the 
>  .Xc
>  .D1 Pq alias: Ic findw
>  Search for a
> -.Xr fnmatch 3
> +.Xr glob 7
>  pattern or, with
>  .Fl r ,
>  regular expression
> @@ -4230,8 +4230,8 @@ supports.
>  .Pp
>  This is an array option where each entry is a colon-separated string made up
>  of a terminal type pattern (matched using
> -.Xr fnmatch 3 )
> -followed by a list of terminal features.
> +.Xr glob 7
> +patterns) followed by a list of terminal features.
>  The available features are:
>  .Bl -tag -width Ds
>  .It 256
> @@ -4287,7 +4287,8 @@ Allow terminal descriptions read using
>  to be overridden.
>  Each entry is a colon-separated string made up of a terminal type pattern
>  (matched using
> -.Xr fnmatch 3 )
> +.Xr glob 7
> +patterns)
>  and a set of
>  .Em name=value
>  entries.
> @@ -5625,14 +5626,14 @@ true, for example
>  .Pp
>  An
>  .Ql m
> -specifies an
> -.Xr fnmatch 3
> +specifies a
> +.Xr glob 7
>  or regular expression comparison.
>  The first argument is the pattern and the second the string to compare.
>  An optional argument specifies flags:
>  .Ql r
>  means the pattern is a regular expression instead of the default
> -.Xr fnmatch 3
> +.Xr glob 7
>  pattern, and
>  .Ql i
>  means to ignore case.
> @@ -5643,7 +5644,7 @@ or
>  A
>  .Ql C
>  performs a search for an
> -.Xr fnmatch 3
> +.Xr glob 7
>  pattern or regular expression in the pane content and evaluates to zero if not
>  found, or a line number if found.
>  Like
>