filesystem – zsh : Sorting by time doesn’t work anymore

filesystem – zsh : Sorting by time doesn’t work anymore

When porting a zsh script from the Cygwin setting to MacOS (zsh model 5.8.1), I discovered that sorting listing entries by time doesn’t work anymore. Principally, the command in query was one thing like

echo vp5-[aeiou](N^om)

which is meant to yield the directories soreted by modification time. The output was

vp5-a vp5-e vp5-i vp5-o vp5-u

(alphabetical order), which IMO is incorrect right here. Checking the timestamps in additional element, I discovered that

ls -dl vp5-[aeiou](N^om)

produced

drwxrwxrwx  1 ronaldfischer  employees  524288 26 Might 09:07 vp5-a
drwxrwxrwx  1 ronaldfischer  employees  524288 26 Might 09:07 vp5-e
drwxrwxrwx  1 ronaldfischer  employees  524288 26 Might 09:07 vp5-i
drwxrwxrwx  1 ronaldfischer  employees  524288 26 Might 09:07 vp5-o
drwxrwxrwx  1 ronaldfischer  employees  524288 26 Might 09:07 vp5-u

I do not perceive why all of them present the identical timestamp. Additional verifying directories individually utilizing stat yielded as an illustration

stat vp5-a
16777231 132019 drwxrwxrwx 1 ronaldfischer employees 0 524288 "Jun 30 11:46:04 2023" "Might 26 09:07:02 2023" "Might 26 09:07:02 2023" "Sep  4 09:04:30 2019" 524288 1024 0 vp5-a

stat vp5-i
16777231 596013 drwxrwxrwx 1 ronaldfischer employees 0 524288 "Might 30 17:12:10 2023" "Might 26 09:07:02 2023" "Might 26 09:07:02 2023" "Sep 12 12:53:21 2019" 524288 1024 0 vp5-

stat vp5-u
16777231 729594 drwxrwxrwx 1 ronaldfischer employees 0 524288 "Jul 10 15:48:50 2023" "Might 26 09:07:02 2023" "Might 26 09:07:02 2023" "Oct 24 14:12:45 2019" 524288 1024 0 vp5-u

We see (appropriately) that vp5-i (Might 30) is i.e. older than vp5-a (June 30), however it’s nonetheless listed later within the echo above.

I believe that MacOS is doing one thing basically totally different with the timestamps than Cygwin/Home windows was doing.

The file system of the amount the place the directories are situated is ExFAT. I do know that ExFAT has some restrictions, however these too shouldn’t be associated to timestamps.

Leave a Reply

Your email address will not be published. Required fields are marked *