Closed jepler closed 6 years ago
Yeah, I wondered how stable shell's glob is, and whether I have to use ls -1
, or run it thru sort
, or whatever. The change looks good. But I'd prefer to squash this into the commit where the script was introduced. Let me know if you'd like credits in the commit message.
no worries about credit, squashing makes perfect sense
Squashed as discussed, thanks.
.. by ensuring that the "C" locale is used while running this script. This requires sorting the "ref" file which was generated using the collation order of some other locale such as en_US.UTF-8.
Apparently, POSIX promises that shell globs use the locale's collation ordering, but bash is alone (among dash, mksh and zsh) at actually doing this. For discussion, see https://serverfault.com/questions/122737/in-bash-are-wildcard-expansions-guaranteed-to-be-in-order
Without this change, I get a failure when I "sh run-afl-test-corpus.sh" (sh is invoking /bin/dash). With this change, I get success with all 4 sh implementations I tested and regardless of my LANG setting such as LANG=en_US.UTF-8 LANG=zh_CN.UTF-8 LANG=C.UTF-8 LANG=C