this post was submitted on 28 Nov 2024
91 points (96.0% liked)

Linux

48677 readers
437 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

it's so confusing that the order changes when adding IDENTICAL strings to BOTH filenames. Is this really how it's supposed to be?

you are viewing a single comment's thread
view the rest of the comments
[–] mathemachristian@hexbear.net 5 points 3 weeks ago* (last edited 3 weeks ago) (1 children)

Check the top: apparently "5" < "5.5" but "5 A" > "5.5 A". It's probably because a substring is lexicographically before the string containing it.

But when comparing 5 A with 5.5 A the second characters ' ' and '.' get compared and apparently '.' < ' '.

agree on your point though.

[–] dysprosium@lemmy.dbzer0.com 2 points 3 weeks ago (1 children)

I see, but wouldn't it make more "human readable sense" to order spaces before any other character? Any human working with analog archives would rank 5 A before 5.5 A, since they think 5 is 5.0 in their head

[–] mathemachristian@hexbear.net 2 points 3 weeks ago* (last edited 3 weeks ago)

I don't know the exact reasoning for it, I would guess it's because '.' is also used to delimit file types "A book on the.pdf" < "A book on the pdf.pdf" or "Book.pdf" < "Book sequel.pdf"

I guess your confusion has in part to do with reading digits as numbers, but within a string they are part of an alphabet, every character stands on its own and has no relation to the characters around it. There is no difference between "5 1", "5.1" and "511" you just pick an ordering of the alphabet and then sort each character accordingly.