Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
aed27c9
feat: add --debug flag to cksum
naoNao89 Oct 30, 2025
5f571b6
docs: clarify --debug flag is not yet implemented
naoNao89 Oct 30, 2025
6328c51
cksum: implement --debug flag functionality
naoNao89 Oct 30, 2025
90d84e2
fix(cksum): implement proper CPU hardware capability detection for --…
naoNao89 Nov 1, 2025
0e1707c
Merge branch 'main' into fix-cksum-debug-flag
naoNao89 Nov 1, 2025
09efa85
chore: update Cargo.lock after merge
naoNao89 Nov 1, 2025
ed19fad
fix(cksum): implement --debug flag with CPU hardware capability detec…
naoNao89 Nov 1, 2025
c4276f6
chore: update fuzz/Cargo.lock for MSRV 1.85.0 compatibility
naoNao89 Nov 1, 2025
3d194c1
chore: add CPU feature terms to cspell dictionary
naoNao89 Nov 1, 2025
cb704f2
fix(cksum): make cpufeatures dependency target-specific
naoNao89 Nov 1, 2025
4f9f6cc
fix(cksum): exclude Android from cpufeatures to prevent CPUID crash
naoNao89 Nov 1, 2025
d78e7d1
fix(cksum): exclude Android from CPU feature detection tests
naoNao89 Nov 2, 2025
74c4862
fix(cksum): exclude Android from --debug flag tests
naoNao89 Nov 2, 2025
c7361b5
fix(cksum): move cfg attribute before test attribute for Android excl…
naoNao89 Nov 2, 2025
bb284eb
fix(cksum): wrap debug tests in cfg-gated module for Android exclusion
naoNao89 Nov 2, 2025
c552d3a
Fix L10n/Installation Test broken pipe error on macOS
naoNao89 Nov 2, 2025
a521c1b
Remove duplicate '|| true' from l10n.yml
naoNao89 Nov 2, 2025
f49b134
Fix broken pipe error by wrapping echo|head in subshell with || true
naoNao89 Nov 2, 2025
ca5e8ad
fix(cksum): add x86 (32-bit) CPU feature detection support
naoNao89 Nov 2, 2025
80e4237
fix(cksum): exclude Android from CPU debug info printing
naoNao89 Nov 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/uu/cksum/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ cksum-help-status = don't output anything, status code shows success
cksum-help-quiet = don't print OK for each successfully verified file
cksum-help-ignore-missing = don't fail or report status for missing files
cksum-help-zero = end each output line with NUL, not newline, and disable file name escaping
cksum-help-debug = indicate which implementation used

# Error messages
cksum-error-is-directory = { $file }: Is a directory
Expand Down
1 change: 1 addition & 0 deletions src/uu/cksum/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ cksum-help-status = ne rien afficher, le code de statut indique le succès
cksum-help-quiet = ne pas afficher OK pour chaque fichier vérifié avec succès
cksum-help-ignore-missing = ne pas échouer ou signaler le statut pour les fichiers manquants
cksum-help-zero = terminer chaque ligne de sortie avec NUL, pas un saut de ligne, et désactiver l'échappement des noms de fichiers
cksum-help-debug = indiquer quelle implémentation est utilisée
# Messages d'erreur
cksum-error-is-directory = { $file } : Est un répertoire
Expand Down
7 changes: 7 additions & 0 deletions src/uu/cksum/src/cksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ mod options {
pub const IGNORE_MISSING: &str = "ignore-missing";
pub const QUIET: &str = "quiet";
pub const ZERO: &str = "zero";
pub const DEBUG: &str = "debug";
}

/// cksum has a bunch of legacy behavior. We handle this in this function to
Expand Down Expand Up @@ -598,5 +599,11 @@ pub fn uu_app() -> Command {
.help(translate!("cksum-help-zero"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::DEBUG)
.long(options::DEBUG)
.help(translate!("cksum-help-debug"))
.action(ArgAction::SetTrue),
)
.after_help(translate!("cksum-after-help"))
}
27 changes: 27 additions & 0 deletions tests/by-util/test_cksum.rs
Copy link
Contributor

@cakebaker cakebaker Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you implemented something else, but not the --debug functionality from GNU cksum :|

Here is the output I get on my machine when I manually run the first three tests with GNU cksum 9.8:

$ cksum --debug README.md 
cksum: avx512 support not detected
cksum: avx2 support not detected
cksum: using pclmul hardware support
3970598914 9068 README.md
$ cksum --debug -a md5 README.md 
MD5 (README.md) = 15af838487236a3900e77e6b70e4d2a7
$ printf "test" | cksum --debug
cksum: avx512 support not detected
cksum: avx2 support not detected
cksum: using pclmul hardware support
3076352578 4

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean hardware capability detection :v

Original file line number Diff line number Diff line change
Expand Up @@ -2745,3 +2745,30 @@ mod format_mix {
.stderr_contains("cksum: WARNING: 1 line is improperly formatted");
}
}

#[test]
fn test_debug_flag() {
// Test that --debug flag is accepted (no-op for now)
new_ucmd!()
.arg("--debug")
.arg("lorem_ipsum.txt")
.succeeds()
.stdout_is_fixture("crc_single_file.expected");

// Test --debug with algorithm
new_ucmd!()
.arg("--debug")
.arg("-a")
.arg("md5")
.arg("lorem_ipsum.txt")
.succeeds()
.stdout_is_fixture("md5_single_file.expected");

// Test --debug with multiple files
new_ucmd!()
.arg("--debug")
.arg("lorem_ipsum.txt")
.arg("alice_in_wonderland.txt")
.succeeds()
.stdout_is_fixture("crc_multiple_files.expected");
}
Loading