218
1337 h4x0r (lemmy.dbzer0.com)
you are viewing a single comment's thread
view the rest of the comments
[-] WalnutLum@lemmy.ml 30 points 2 days ago

"here is a checksum of my /usr/lib folder, if yours differs from mine I can't provide installation support"

[-] tal@lemmy.today 12 points 2 days ago* (last edited 2 days ago)

here is a checksum of my /usr/lib folder

That's actually not as trivial as it seems, because you need a canonical representation of that directory to generate such a thing in the same way on each side.

You need to encode the metadata in a standard way, encode new data that shows up in a standard way, and various people can add more metadata to files: think like Posix ACLs or the immutable flag or whatever.

Then there is maybe some metadata that you probably want to exclude, like atime (though not if you're something like rsync -U!), and some metadata that you almost-certainly want to exclude, like inode number.

The OS's file APIs won't have a defined order in which they return entries in a directory. Like, they'll normally just return it in whatever order things come back from the filesystem, which is probably whatever is most-efficient for the filesystem in question, given how things are encoded on disk. If you sort the directory entries, then it can't be


as is the case for most things on the system


done in a locale-dependent fashion. Utilities like tar don't impose a canonical ordering, so you can't just dump the problems on tar by checksumming a tarball of the directory.

EDIT: tar does appear to have a canonical ordering option today, though it also probably doesn't have the constraint of being backwards-compatible with metadata included, another thing that one would need for such a checksum if one were to leverage tar.

[-] FishFace@lemmy.world 1 points 1 day ago

You need to

Given it was a joke, I don't think you need to do anything...

The OS’s file APIs won’t have a defined order in which they return entries in a directory

Sorting is a thing :)

[-] WalnutLum@lemmy.ml 9 points 2 days ago

You need to encode the metadata in a standard way, encode new data that shows up in a standard way, and various people can add more metadata to files: think like Posix ACLs or the immutable flag or whatever.

Nix actually invented a fork of tar specifically for this called "normalized archive" or "Nix Archive" or nar. Guix uses this too:

https://releases.nixos.org/nix/nix-2.22.0/manual/protocols/nix-archive.html

this post was submitted on 20 Aug 2025
218 points (100.0% liked)

linuxmemes

26877 readers
96 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
  • Don't get baited into back-and-forth insults. We are not animals.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn, no politics, no trolling or ragebaiting.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, <loves/tolerates/hates> systemd, and wants to interject for a moment. You can stop now.
  • 5. 🇬🇧 Language/язык/Sprache
  • This is primarily an English-speaking community. 🇬🇧🇦🇺🇺🇸
  • Comments written in other languages are allowed.
  • The substance of a post should be comprehensible for people who only speak English.
  • Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
  • 6. (NEW!) Regarding public figuresWe all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations.
  • Keep discussions polite and free of disparagement.
  • We are never in possession of all of the facts. Defamatory comments will not be tolerated.
  • Discussions that get too heated will be locked and offending comments removed.
  •  

    Please report posts and comments that break these rules!


    Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.

    founded 2 years ago
    MODERATORS