Re: [PATCH v7 4/8] regex.3: Improve REG_STARTEND

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

 



Hi!

On 4/21/23 02:39, наб wrote:
> Explicitly spell out the ranges involved. The original wording always
> confused me, but it's actually very sane.
> 
> Remove "this doesn't change R_NOTBOL & R_NEWLINE" ‒ so does it change
> R_NOTEOL? No. That's weird and confusing.
> 
> String largeness doesn't matter, known-lengthness does.
> 
> Explicitly spell out the influence on returned matches
> (relative to string, not start of range).
> 
> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@xxxxxxxxxxxxxxxxxx>

Patch applied.

> ---
> Range-diff against v6:
> 1:  4b7971a5e < -:  --------- regex.3: Desoupify regfree() description
> 2:  5fb4cc16f ! 1:  ed050649b regex.3: Improve REG_STARTEND
>     @@ man3/regex.3: .SS Matching
>      -and ending before byte
>      -.IR pmatch[0].rm_eo .
>      +Match
>     -+.RI [ string " + " pmatch[0].rm_so ", " string " + " pmatch[0].rm_eo )
>     ++.RI [ "string + pmatch[0].rm_so" , " string + pmatch[0].rm_eo" )
>      +instead of
>     -+.RI [ string ", " string " + \fBstrlen\fP(" string )).
>     ++.RI [ string , " string + strlen(string)" ).
>       This allows matching embedded NUL bytes
>       and avoids a
>       .BR strlen (3)
>     @@ man3/regex.3: .SS Matching
>      +as usual, and the match offsets remain relative to
>      +.IR string
>      +(not
>     -+.IR string " + " pmatch[0].rm_so ).
>     ++.IR "string + pmatch[0].rm_so" ).
>       This flag is a BSD extension, not present in POSIX.
>       .SS Match offsets
>       Unless
> 
>  man3/regex.3 | 29 ++++++++++++++++-------------
>  1 file changed, 16 insertions(+), 13 deletions(-)
> 
> diff --git a/man3/regex.3 b/man3/regex.3
> index 46a4a12b9..099c2c17f 100644
> --- a/man3/regex.3
> +++ b/man3/regex.3
> @@ -131,23 +131,26 @@ .SS Matching
>  above).
>  .TP
>  .B REG_STARTEND
> -Use
> -.I pmatch[0]
> -on the input string, starting at byte
> -.I pmatch[0].rm_so
> -and ending before byte
> -.IR pmatch[0].rm_eo .
> +Match
> +.RI [ "string + pmatch[0].rm_so" , " string + pmatch[0].rm_eo" )
> +instead of
> +.RI [ string , " string + strlen(string)" ).
>  This allows matching embedded NUL bytes
>  and avoids a
>  .BR strlen (3)
> -on large strings.
> -It does not use
> +on known-length strings.
> +If any matches are returned
> +.RB ( REG_NOSUB
> +wasn't passed to
> +.BR regcomp (),
> +the match succeeded, and
>  .I nmatch
> -on input, and does not change
> -.B REG_NOTBOL
> -or
> -.B REG_NEWLINE
> -processing.
> +> 0), they overwrite
> +.I pmatch
> +as usual, and the match offsets remain relative to
> +.IR string

Minor glitch: s/IR/I/

I fixed it.  BTW, don't know if you knew, but you can run some linters
to check these accidents by yourself.


$ make lint check -t >/dev/null
$ echo .IR foo >> man3/regex.3
$ make lint check -k
LINT (mandoc)	.tmp/man/man3/regex.3.lint-man.mandoc.touch
LINT (tbl comment)	.tmp/man/man3/regex.3.lint-man.tbl.touch
PRECONV	.tmp/man/man3/regex.3.tbl
TBL	.tmp/man/man3/regex.3.eqn
EQN	.tmp/man/man3/regex.3.cat.troff
TROFF	.tmp/man/man3/regex.3.cat.grotty
an.tmac:man3/regex.3:376: style: .IR expects at least 2 arguments, got 1
found style problems; aborting
make: *** [share/mk/build/catman.mk:80: .tmp/man/man3/regex.3.cat.grotty] Error 1
make: *** Deleting file '.tmp/man/man3/regex.3.cat.grotty'
make: Target 'check' not remade because of errors.
$ git restore -p
diff --git a/man3/regex.3 b/man3/regex.3
index e91504986..4840edb83 100644
--- a/man3/regex.3
+++ b/man3/regex.3
@@ -373,3 +373,4 @@ .SH SEE ALSO
 .PP
 The glibc manual section,
 .I "Regular Expressions"
+.IR foo
(1/1) Discard this hunk from worktree [y,n,q,a,d,e,?]? y

alx@asus5775:~/src/linux/man-pages/man-pages/main$ make lint check -k
LINT (mandoc)	.tmp/man/man3/regex.3.lint-man.mandoc.touch
LINT (tbl comment)	.tmp/man/man3/regex.3.lint-man.tbl.touch
PRECONV	.tmp/man/man3/regex.3.tbl
TBL	.tmp/man/man3/regex.3.eqn
EQN	.tmp/man/man3/regex.3.cat.troff
TROFF	.tmp/man/man3/regex.3.cat.grotty
GROTTY	.tmp/man/man3/regex.3.cat
COL	.tmp/man/man3/regex.3.cat.grep
GREP	.tmp/man/man3/regex.3.check-catman.touch


If you want to read more about this, see the CONTRIBUTING file, or the
Makefile itself (or rather, themselves).


Cheers,
Alex


> +(not
> +.IR "string + pmatch[0].rm_so" ).
>  This flag is a BSD extension, not present in POSIX.
>  .SS Match offsets
>  Unless

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux