mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
'ptx -W "a*"' would never terminate. SKIP_SOMETHING advanced the cursor by the length of the match, which is zero when the word regexp matches the empty string, and no other value in the surrounding loop conditions changes. find_occurs_in_text already skips zero length matches, and a zero length --context-regexp match is rejected outright; only this macro lacked the forward progress guarantee. * src/ptx.c (SKIP_SOMETHING): Advance by at least one byte on a zero length match, as the other branches of the macro already do. * tests/ptx/word-regex-loop.sh: New test. * tests/local.mk (all_tests): Reference it. * NEWS: Mention the fix. Link: https://github.com/coreutils/coreutils/pull/328