aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/blog/2025-09-28-alphabetic-order/alphabetic-order.md102
-rw-r--r--src/blog/2025-09-28-alphabetic-order/dolphin.pngbin0 -> 123212 bytes
-rw-r--r--src/blog/2025-09-28-alphabetic-order/drive.pngbin0 -> 29700 bytes
3 files changed, 102 insertions, 0 deletions
diff --git a/src/blog/2025-09-28-alphabetic-order/alphabetic-order.md b/src/blog/2025-09-28-alphabetic-order/alphabetic-order.md
new file mode 100644
index 0000000..262a0d8
--- /dev/null
+++ b/src/blog/2025-09-28-alphabetic-order/alphabetic-order.md
@@ -0,0 +1,102 @@
1# When I say "alphabetic order", I mean "alphabetic order"
2
3Last month I have been on a multi-day hike with my dad. Each of us took
4many pictures, and when we came back we put them all in a shared folder.
5We both have Android phones, and the naming scheme used for our pictures
6was the same: `IMG_YYYYMMDD_HHmmss` followed maybe by some other numbers
7and then a `.jpg`. Here `YYYY` stands for the year, `MM` for month and
8so on, so that sorting the pictures in alphabetic order is the same as
9sorting them by date.
10
11Or so I thought. Strangely, when I looked at the files from my dad's
12Windows PC, they were not sorted correctly: all the pictures took
13with my phone came first, followed by all the pictures took by him.
14I thought this was surely some weird Microsoft bug - after using
15Windows 11 at work for a while, I would not be surprised if you
16told me their file explorer can't figure out how to sort strings.
17
18But then I looked at the same files in a shared Google Drive folder,
19and again they were in the wrong order:
20
21![Screenshot from Google Drive](drive.png)
22
23As you can see, the picture taken at 5:54 (with my dad's phone) comes
24before the one taken at 9:20 (also with my dad's phone), but after the
25one taken at 12:11 (with my phone).
26
27Weird. Well, maybe Microsoft *and* Google got this wrong. But
28that seems unlikely.
29
30Indeed, KDE's Dolphin file manager does the same thing:
31
32![Screenshot from Dolphin](dolphin.png)
33
34I'll spare you the screenshots, but Gnome and both the file managers
35that I have on my phone also get the alphabetic order wrong.
36
37At this point I thought that maybe one of the two phones is using some
38weird alternative unicode character instead of the underscore `_`. Really,
39I could not see any other explanation. But nope, this is not it, because
40the good old `ls` sorts my files correctly:
41
42```
43$ ls -l
44
45total 218572
46-rw-r--r-- 1 seba seba 1866185 Aug 28 18:51 IMG_20250820_055436307.jpg
47-rw-r--r-- 1 seba seba 4749899 Aug 28 18:50 IMG_20250820_092016029_HDR.jpg
48-rw-r--r-- 1 seba seba 6201609 Aug 28 18:52 IMG_20250820_092440966_HDR.jpg
49-rw-r--r-- 1 seba seba 7694802 Aug 28 18:51 IMG_20250820_092832138_HDR.jpg
50-rw-r--r-- 1 seba seba 1536520 Aug 20 09:57 IMG_20250820_095716_607.jpg
51-rw-r--r-- 1 seba seba 1054553 Aug 20 10:38 IMG_20250820_103857_991.jpg
52-rw-r--r-- 1 seba seba 965353 Aug 20 10:39 IMG_20250820_103903_811.jpg
53(and so on)
54```
55
56This was consistent among the couple of Linux distros I use, as well
57as my OpenBSD server. On the one hand this is good: not *every* single
58piece of software fucks up something as basic as string sorting. On the
59other hand, this makes it harder to debug what the fuck is going on with
60all the other file managers.
61
62It took me more than a month to figure this one out. Tell me, which
63file do you think comes first in alphabetic order, `file-9.txt` or
64`file-10.txt`?
65
66Of course, the user who named those files probably wants `file-9.txt` to
67come before `file-10.txt`. But `1` is smaller than `9`, so `file-10.txt`
68should be first in alphabetic order. Everyone understands that, and
69soon people learn to put enough leading zeros if they want their files
70to stay sorted the way they like.
71
72Well, apparently all these operating systems have decided that no,
73users are too dumb and they cannot possibly understand what alphabetic
74order means. So when you ask them to sort your files alphabetically,
75they don't. Instead, they decide that if some piece of the file name is
76a number, the real numerical value must be used.
77
78I don't know when this became the norm, to be honest I have not used a
79normal graphical file manager in a long time.
80
81*I know you asked for the files to be sorted in alphabetic order,
82but you don't want `file-10.txt` to come before `file-9.txt`, do
83you? No, I know you don't. I am not even going to ask you, your
84mushy human brain is too small to comprehend the intricacies of
85such a question. I'll spare you the thinking.*
86
87So it turns out that my dad's phone wrote the milliseconds in the file
88name right after the seconds, while mine added an extra underscore to
89separate them from the seconds. Which in my mind it should not have
90mattered, because alphabetically they should still have been sorted
91correctly to the second. But with this "modern" interpretation of the
92alphabetic order, the files without the extra separator in the name had
93a much higher number, so they come last.
94
95Now that I know what the issue is, I can solve it by renaming the files
96with a consistent scheme. I have also found a setting to fix Dolphin's
97behavior, but it was very much buried into its many configuration
98options. And I would rather not have to change this setting in every
99application I use, assuming they even allow it.
100
101I miss the time when computers did what you told them to, instead of
102trying to read your mind.
diff --git a/src/blog/2025-09-28-alphabetic-order/dolphin.png b/src/blog/2025-09-28-alphabetic-order/dolphin.png
new file mode 100644
index 0000000..2342445
--- /dev/null
+++ b/src/blog/2025-09-28-alphabetic-order/dolphin.png
Binary files differ
diff --git a/src/blog/2025-09-28-alphabetic-order/drive.png b/src/blog/2025-09-28-alphabetic-order/drive.png
new file mode 100644
index 0000000..9bd044e
--- /dev/null
+++ b/src/blog/2025-09-28-alphabetic-order/drive.png
Binary files differ

Generated with cgit - Back to sebastiano.tronto.net