Hi Pablo,

On Mon, 2026-02-23 at 19:17 +0100, Pablo Rodriguez via ntg-context wrote:
> but https://modules.contextgarden.net/dl/ sorts the `basicexam-*.zip`
> files in a rather uncommon way:
>
>     basicexam-2025.12.12.zip
>     basicexam-2026.02.18.zip
>     basicexam-20250102A.zip
>
> At least, `ls -lh basicexam-*` in “Fedora 43” gives the more standard:
>
>     basicexam-20250102A.zip
>     basicexam-2025.12.12.zip
>     basicexam-2026.02.18.zip

The sorting order depends on the current locale:

    $ cat /etc/os-release | grep PRETTY_NAME
    PRETTY_NAME="Fedora Linux 43 (Workstation Edition)"
    $ touch basicexam-2025.12.12.zip basicexam-2026.02.18.zip 
basicexam-20250102A.zip

    $ locale | grep LC_COLLATE
    LC_COLLATE="en_CA.UTF-8"
    $ ls -1
    basicexam-20250102A.zip
    basicexam-2025.12.12.zip
    basicexam-2026.02.18.zip

    $ LC_COLLATE=C ls -1
    basicexam-2025.12.12.zip
    basicexam-20250102A.zip
    basicexam-2026.02.18.zip

    $ LC_COLLATE=es_ES.UTF-8 ls -1
    basicexam-20250102A.zip
    basicexam-2025.12.12.zip
    basicexam-2026.02.18.zip

And if you're using a program that doesn't sort the output, then the
order will be random (but usually based on the date the file was
created):

    $ rm 1 2 3; touch 1 2 3; find -type f
    ./3
    ./2
    ./1

    $ rm 1 2 3; touch 3 2 1; find -type f
    ./1
    ./2
    ./3

    $ rm 1 2 3; touch 2 1 3; find -type f
    ./3
    ./1
    ./2

So I don't think that it's really safe to assume that there is a single
correct way of sorting a list of files.

Thanks,
-- Max
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to