|
|
Subscribe / Log in / New account

Sorting filenames

Sorting filenames

Posted Sep 17, 2015 9:12 UTC (Thu) by epa (subscriber, #39769)
Parent article: A status update on Debian's reproducible builds

The fix is to pipe the list of files through sort before it goes to tar.
But sort too is affected by the locale setting. Wouldn't setting LC_ALL=C when building be a simpler and more effective fix?

(I never understood why tools like sort and tar, which are hardly anything an end user would use directly, had to start doing locale sort by default rather than just byte order, which works sanely enough for both ASCII and UTF-8. But I guess it's too late to change now.)


to post comments

Sorting filenames

Posted Sep 17, 2015 10:52 UTC (Thu) by hummassa (subscriber, #307) [Link] (1 responses)

> (I never understood why tools like sort and tar, which are hardly anything an end user would use directly, had to start doing locale sort by default rather than just byte order, which works sanely enough for both ASCII and UTF-8. But I guess it's too late to change now.)

I actually use sort and tar as an "end user" a lot, BUT I agree with you that locale-awareness should be a nondefault option. My default locale is non-english, non-US, but mostly I want things sorted bytewise... There are a lot "env LANG= something-or-other" in my work scripts.

Sorting filenames

Posted Sep 17, 2015 19:01 UTC (Thu) by josh (subscriber, #17465) [Link]

If you generally want a specific non-C locale, but you want sorting based on the C locale, you can set LC_COLLATE=C. I personally do that because most "natural language" locales don't preserve the classic UNIX "sort capital before lowercase" behavior that makes it useful to name files README or Makefile.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds