CSHATAG(1)

πŸ“¦ version 2.2.1, in nixos 26.05, nixpkgs unstable

πŸ’… CSHATAG(1) β€” like, the compiled shatag, bestie ✨

okay so this is cshatag(1), from the User Manuals section, and it's genuinely one of my faves 🫢


✨ NAME ✨

cshatag β€” the compiled shatag, periodt πŸ’…


🌸 SYNOPSIS 🌸

cshatag [OPTIONS] FILE [FILE...]

πŸ¦‹ DESCRIPTION πŸ¦‹

cshatag is a minimal and fast re-implementation of shatag ( https://github.com/maugier/shatag , written in Python by Maxime Augier ) but in a compiled language β€” and the way it leveled up: since v2.0 it's Go, and earlier versions were C πŸ‘‘

So what does it even do? cshatag is a tool to detect silent data corruption 😭✨ It writes the mtime and the sha256 checksum of a file into the file's extended attributes. For that to work, the filesystem needs to be mounted with user_xattr enabled β€” no cap, that's the vibe check it has to pass.

When you run it again, it compares the stored mtime and checksum. If it finds that the mtime is unchanged but the checksum has changed, it warns on stderr 🚨. In any case, the status of the file is printed to stdout and the stored checksum is updated. Iconic behaviour, honestly.

The file statuses that show up on stdout are:

  • <new> β€” file is missing both attributes
  • <outdated> β€” both mtime and checksum have changed
  • <ok> β€” both checksum and mtime stayed the same
  • <timechange> β€” only mtime has changed, checksum stayed the same
  • <corrupt> β€” mtime stayed the same but checksum changed πŸ’€

cshatag aims to be format-compatible with shatag and uses the same extended attributes (see the COMPATIBILITY section, bestie).

Fun lore drop πŸŽ€ cshatag was written in C in 2012 and has been rewritten in Go in 2019.


πŸ’– OPTIONS πŸ’–

  • -dry-run β€” don't make any changes πŸ™ˆ just look, don't touch
  • -recursive β€” recursively process the contents of directories πŸŒ€
  • -remove β€” remove cshatag's xattrs from FILE 🧹
  • -q β€” quiet mode β€” don't report <ok> files 🀫
  • -qq β€” quiet2 mode β€” only report <corrupt> files and errors πŸ’€
  • -fix β€” fix the stored sha256 on corrupt files πŸ”§

🌈 EXAMPLES 🌈

Check all regular files in the file tree below the current working directory:

# cshatag -qq -recursive .

Errors like corrupt files will be printed to stderr. Run it without -qq to see progress output πŸ‘€.

To remove the extended attributes from all files:

# cshatag -recursive -remove .

πŸ‘‘ RETURN VALUE πŸ‘‘

  • 0 β€” Success ✨
  • 1 β€” Wrong number of arguments πŸ™ˆ
  • 2 β€” One or more files could not be opened 😭
  • 3 β€” One or more files is not a regular file πŸ’€
  • 4 β€” Extended attributes could not be written to one or more files 🫠
  • 5 β€” At least one file was found to be corrupt 🚨
  • 6 β€” More than one type of error occurred πŸ”₯

🧚 COMPATIBILITY 🧚

cshatag writes the user.shatag.ts field with full integer nanosecond precision, while python uses a double for the whole mtime and loses the last few digits. So yeah β€” we're out here being precise, they're out here rounding πŸ˜ŒπŸ’…


πŸ“ AUTHOR πŸ“

Jakob Unterwurzacher <jakobunt@gmail.com>

https://github.com/rfjakob/cshatag


Copyright 2012 Jakob Unterwurzacher. MIT License.


πŸ’œ SEE ALSO πŸ’œ

shatag(1), sha256sum(1), getfattr(1), setfattr(1)


k that's the whole page, bestie 🫢 this one's a Linux manual page, from MAY 2012, and the source is CSHATAG(1) β€” go forth and verify your checksums, mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from