-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
sort -f
produces a different output then GNU
#5849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
failed with:
|
sort -f
produces a different output then GNU
You can simplify it to:
|
I took a brief look at this, admittedly without actually running any code from this crate, and I believe this is a locale issue. I did read through the code and believe issue lies in how cmp_chars determines sort order. Looking at the reference docs for the GNU version there is a footnote about collation that states
I tested this with GNU sort on my machine and was able to produce both sorting orders with GNU sort just by changing locale: echo -e "a\n(c\nb\nd" | LC_ALL=C sort
(c
a
b
d vs echo -e "a\n(c\nb\nd" | LC_ALL=en_US.UTF-8 sort
a
b
(c
d Based on this (very limited character set) it looks like rust is using the C locale and the GNU test is not? I did a quick search on locales in rust and it seems there has been some recent discussion on on it, although the discussion was more focused on international comparisons, which I am unclear of if it is in scope or not. I did find a crate that in theory can load locales since a quick search indicated that the stdlib does not respect them, which a quick playground test seemed to confirm. Hopefully this is helpful :) |
Yes, you are right, uutils |
OSS-Fuzz has closed this bug. Please see https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65860 for details. |
OSS-Fuzz has found a bug in this project. Please see https://oss-fuzz.com/testcase?key=5184835421274112 for details and reproducers.
This issue is mirrored from https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65860 and will auto-close if the status changes there.
If you have trouble accessing this report, please file an issue at https://github.com/google/oss-fuzz/issues/new.
The text was updated successfully, but these errors were encountered: