[PATCH] bltin/test: = and != are strcmp, not strcoll
наб <[email protected]>
| Newsgroups | org.kernel.vger.dash |
|---|---|
| Message-ID | <t3tjfncwhu5shadny7kikk5ulsycsqk6in3ieuof3ibivekd5c@tarta.nabijaczleweli.xyz> |
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(-) 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: -- 2.39.2
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEfWlHToQCjFzAxEFjvP0LAY0mWPEFAmaMKc0ACgkQvP0LAY0m WPH0ow//ZIuguMhxHsSfGfno7M6nBbqjuqqsuUNKu/zw8DFtsSAucJy/5X7DvjAL R+49T1vH1Kv9zoMtMMpczFn6yFK4Wh111yIwNCd2I27CxEuEojVWx9x+P7HEm3oD /vRQyhdDP5ISPc2YCjsskOa+h4Z2LsXXBbKtV3XKrdB/iRqQJdQseXjsB+Xb9MgQ Ly/wCwAswNNrxoqGvygGPmpeDjeepYgIaQ/uvsQCyDKh/LSdMeKI3Ls756W9OHjf MFPgsQcvcVG+9yySuwLOx09kCKwctYvbUF7aWU3CNtcN4EXLO0nVTs6w3LL7jOqG 0NfsTea2fGcmDaJimfBnt910+epLp0SihlZ6rTKXfFZeyJ6gOCN5zLiYMT+eDr/y yu99yjhWufP6lFwKzic3awuVqz+VO8vDbkZvJerV8VU6cQ9dtKRr9Q8TOjtv8IOw l1rS0VmYwiM63KTu5RLl1/cbPMN9dHaRPQg/LOw4cNknis8Ps5jhT4rlO0bR7Agz 4+1ChFCjNEcQwH+dQwARmV6TmEeMJH5UgMNDMiZ5RWDDLXJAL3xvAuwNE/xrDvzs +pkDJThImqTfbmp4cciUzlKtOM0KO93TojWSBN8sTu/u3/4kN0gETiD7h8rpLEjj WVI6kqoTW51JdD7b10h6VfwRXGD/0NQUDZI2VffARto5w0HKm3U= =Hh9Z -----END PGP SIGNATURE-----