[RESEND PATCH v2] sed: parse delimiters in regular expression correctly
Celeste
cielesti at protonmail.com
Mon Jan 20 14:27:15 UTC 2025
With this patch, i encountered issues building LVM2 manpages.
Specifically, the regex from line 201 of https://gitlab.com/lvmteam/lvm2/-/blob/v2_03_30/man/Makefile.in#L201 (`s+[\][[]\(<\{0,1\}\)\\\-+\\\[\1-+g`) causes "sed: unmatched '+'".
I tried that with GNU sed, and it did not give me this error.
On Thursday, 14 Nov 2024 at 11:10, Yao Zi <ziyao at disroot.org> wrote:
> As specified in POSIX standard[1], delimiters in bracket expression
> should not terminate the regex and always have their original meaning,
> hus 's/[\/]//' matches either '\' or '/' and 's/[[:alpha:]/]//' matches
> any alphabet or '/'. But with busybox sed,
>
> $ echo a | sed 's/[[:alpha:]/]/b/'
> sed: bad option in substitution expression
> $ echo '\/' | sed 's/[\/]//'
> \
>
> This commit implements a state machine to determine whether a character
> is in a bracket expression, in order to parse escape sequence and
> command delimiters correctly, following the specification and other
> implementation's behavior (GNU and NetBSD). Corresponding test is added
> as well.
More information about the busybox
mailing list