Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add iswpunct(3) breakage workaround for Android
On Android 14.0 with Termux 0.118.0, one regression test failure remains, in src/cmd/ksh93/tests/sh_match.sh: the '$' character does not match the [[:punct:]] character class, which is incorrect. This character class queries the system's iswpunct(3) function via src/lib/libast/regex/regclass.c, even for plain single-byte ASCII characters; it should be equivalent to ispunct(3) in that case. Turns out iswpunct(3) is simply broken on Android. Nine of the expected ASCII characters are not recognised, whereas ispunct(3) is fine. A test program shows: ispunct('!')==16; iswpunct('!')==1 ispunct('"')==16; iswpunct('"')==1 ispunct('#')==16; iswpunct('#')==1 ispunct('$')==16; iswpunct('$')==0 ispunct('%')==16; iswpunct('%')==1 ispunct('&')==16; iswpunct('&')==1 ispunct(''')==16; iswpunct(''')==1 ispunct('(')==16; iswpunct('(')==1 ispunct(')')==16; iswpunct(')')==1 ispunct('*')==16; iswpunct('*')==1 ispunct('+')==16; iswpunct('+')==0 ispunct(',')==16; iswpunct(',')==1 ispunct('-')==16; iswpunct('-')==1 ispunct('.')==16; iswpunct('.')==1 ispunct('/')==16; iswpunct('/')==1 ispunct(':')==16; iswpunct(':')==1 ispunct(';')==16; iswpunct(';')==1 ispunct('<')==16; iswpunct('<')==0 ispunct('=')==16; iswpunct('=')==0 ispunct('>')==16; iswpunct('>')==0 ispunct('?')==16; iswpunct('?')==1 ispunct('@')==16; iswpunct('@')==1 ispunct('[')==16; iswpunct('[')==1 ispunct('\')==16; iswpunct('\')==1 ispunct(']')==16; iswpunct(']')==1 ispunct('^')==16; iswpunct('^')==0 ispunct('_')==16; iswpunct('_')==1 ispunct('`')==16; iswpunct('`')==0 ispunct('{')==16; iswpunct('{')==1 ispunct('|')==16; iswpunct('|')==0 ispunct('}')==16; iswpunct('}')==1 ispunct('~')==16; iswpunct('~')==0 It's broken for multibyte UTF-8 characters as well; at least £ and € are not recognised as punctuation. But there's nothing we can realistically do about that. But we can at least fix the ASCII characters as those are important for portability.
- Loading branch information