Message ID | t3tjfncwhu5shadny7kikk5ulsycsqk6in3ieuof3ibivekd5c@tarta.nabijaczleweli.xyz (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Herbert Xu |
Headers | show |
Series | bltin/test: = and != are strcmp, not strcoll | expand |
наб <nabijaczleweli@nabijaczleweli.xyz> wrote: > [-- text/plain, encoding quoted-printable, charset: us-ascii, 38 lines --] > > 117067 s1 = s2 True if the strings s1 and s2 are identical; otherwise, false. > 117068 s1 != s2 True if the strings s1 and s2 are not identical; otherwise, false. > 117069 s1 > s2 True if s1 collates after s2 in the current locale; otherwise, false. > 117070 s1 < s2 True if s1 collates before s2 in the current locale; otherwise, false. > > "identical" does not mean "collate equally"; > this is the difference between sort | uniq and sort -u > --- > This bug violates every POSIX issue i can find. > > The manual is already correct. > > src/bltin/test.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Patch applied. Thanks.
diff --git a/src/bltin/test.c b/src/bltin/test.c index 06f6818..2e2790f 100644 --- a/src/bltin/test.c +++ b/src/bltin/test.c @@ -354,9 +354,9 @@ binop(void) /* NOTREACHED */ #endif case STREQ: - return strcoll(opnd1, opnd2) == 0; + return strcmp(opnd1, opnd2) == 0; case STRNE: - return strcoll(opnd1, opnd2) != 0; + return strcmp(opnd1, opnd2) != 0; case STRLT: return strcoll(opnd1, opnd2) < 0; case STRGT: