#588484 regex(7): incorrect semantics for backslash + ordinary character

Package:
manpages
Source:
manpages
Submitter:
Jakub Wilk
Date:
2022-01-26 21:30:04 UTC
Severity:
normal
Tags:
#588484#5
Date:
2010-07-08 20:31:54 UTC
From:
To:
Hello,

According to regex(7) manpage, a backslash followed by any other
character than ^.[$()|*+?{\ matches that character taken as an ordinary
character, as if the backslash had not been present. However:

* According to POSIX[0], the interpretation of an ordinary character
preceded by a backslash is undefined.

* Worse still, the described behavior differs from what is actually
implemented in the GNU libc:

$ gcc -Wall testre.c -o testre && ./testre
\S matches foobar


[0] http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04_02

#588484#12
Date:
2022-01-26 21:27:06 UTC
From:
To:
The current manpage (5.10-1 or 5.13 upstream) at least now annotates the
corresponding parts, including the one referenced to, with

| POSIX.2 leaves some aspects of RE syntax and semantics open; "(!)"
| marks decisions on these aspects that may not be fully portable to other
| POSIX.2 implementations.

So this improves the situation somewhat.

This part still seems to hold true.

Cheers,
Flo