Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@naoNao89
Copy link
Contributor

This PR implements the --debug flag for cksum, split from the original PR #8948.

What's included:

  • --debug CLI argument with help text
  • Localization for English and French
  • Tests covering single file, multiple files, and algorithm combinations

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 30, 2025

CodSpeed Performance Report

Merging #9088 will not alter performance

Comparing naoNao89:fix-cksum-debug-flag (e19b34e) with main (997d956)

Summary

✅ 123 untouched
⏩ 5 skipped1

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cksum/cksum is no longer failing!

Copy link
Contributor

@cakebaker cakebaker left a comment

Choose a reason for hiding this comment

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

Can you please add a hint to the help text that the debug functionality is not yet implemented? To make it visible to the user that it is a no-op. Otherwise the PR looks good.

@naoNao89
Copy link
Contributor Author

@cakebaker Updated! ✅

Added the clarification to the help text as requested:

English:

--debug    indicate which implementation used (not yet implemented)

French:

--debug    indiquer quelle implémentation est utilisée (pas encore implémenté)

This follows the same pattern used by other utilities in the codebase (cp, mkdir, split) for indicating unimplemented features.

The test still passes:

test test_cksum::test_debug_flag ... ok

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cksum/cksum is no longer failing!

@sylvestre
Copy link
Contributor

Why not implementing it?

@naoNao89 naoNao89 marked this pull request as draft October 30, 2025 11:25
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cksum/cksum is no longer failing!

@naoNao89 naoNao89 marked this pull request as ready for review October 30, 2025 18:09
naoNao89 added a commit to naoNao89/coreutils that referenced this pull request Nov 1, 2025
…debug flag

- Add cpufeatures dependency to workspace dependencies (Cargo.toml)
- Create new hardware.rs module with CPU feature detection (AVX512, AVX2, PCLMUL, VMULL)
- Integrate hardware detection into cksum.rs with startup execution
- Update localization strings (en-US.ftl, fr-FR.ftl) to reflect new behavior
- Update tests to verify CPU detection messages instead of algorithm names
- Fix clippy warnings (use_self, uninlined_format_args)
- Ensure fmt compliance

This fixes PR uutils#9088 by correctly implementing GNU cksum's --debug flag behavior,
which outputs CPU hardware capability detection messages to stderr, not algorithm names.
@github-actions
Copy link

github-actions bot commented Nov 1, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

github-actions bot commented Nov 1, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@naoNao89 naoNao89 force-pushed the fix-cksum-debug-flag branch 3 times, most recently from e99e61e to c4276f6 Compare November 1, 2025 13:46
@github-actions
Copy link

github-actions bot commented Nov 1, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

github-actions bot commented Nov 1, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

1 similar comment
@github-actions
Copy link

github-actions bot commented Nov 1, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

naoNao89 added a commit to naoNao89/coreutils that referenced this pull request Nov 1, 2025
The cpufeatures crate executes the x86 CPUID instruction to detect CPU features
(AVX512, AVX2, PCLMUL). On the Android x86_64 emulator (QEMU-based), this
instruction crashes the adb process with exit code 137 (SIGKILL).

This fix excludes Android from the cpufeatures dependency and provides safe
fallback implementations that return false for CPU feature detection on Android.

Fixes: Android CI job failure with exit code 137
Resolves: PR uutils#9088 Android x86_64 emulator crash
@github-actions
Copy link

github-actions bot commented Nov 1, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

naoNao89 added a commit to naoNao89/coreutils that referenced this pull request Nov 2, 2025
The test functions test_cpu_features_detection, test_cpu_features_cached, and
test_cpu_features_on_x86_64 call CpuFeatures::detect() which executes the x86
CPUID instruction. On the Android x86_64 emulator, this crashes the adb process
with exit code 137 (SIGKILL).

This fix adds #[cfg(not(target_os = "android"))] attributes to these tests
to prevent them from running on Android, where the CPUID instruction is not
supported by the emulator.

Fixes: Android CI test failure with exit code 137
Resolves: PR uutils#9088 Android x86_64 emulator crash during tests
@github-actions
Copy link

github-actions bot commented Nov 2, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

naoNao89 added a commit to naoNao89/coreutils that referenced this pull request Nov 2, 2025
The --debug flag tests call CpuFeatures::detect() which executes the x86 CPUID
instruction. On the Android x86_64 emulator, this crashes the adb process with
exit code 137 (SIGKILL).

This fix excludes the debug flag tests from Android builds by adding
#[cfg(not(target_os = "android"))] attributes to:
- test_debug_flag()
- test_debug_with_algorithms()

These tests are not needed on Android since the --debug flag functionality
is not critical for the Android build, and the CPUID instruction is not
available on the emulator.

Fixes: Android CI job failure with exit code 137
Resolves: PR uutils#9088 Android x86_64 emulator crash during tests
@github-actions
Copy link

github-actions bot commented Nov 2, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

1 similar comment
@github-actions
Copy link

github-actions bot commented Nov 2, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

github-actions bot commented Nov 2, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@naoNao89 naoNao89 force-pushed the fix-cksum-debug-flag branch from c8bdf7e to ca5e8ad Compare November 2, 2025 11:39
@github-actions
Copy link

github-actions bot commented Nov 2, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@naoNao89 naoNao89 force-pushed the fix-cksum-debug-flag branch 5 times, most recently from 437db3e to 159dab1 Compare November 3, 2025 17:32
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)

@naoNao89 naoNao89 force-pushed the fix-cksum-debug-flag branch from 159dab1 to 22f93d1 Compare November 3, 2025 18:34
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

Copy link
Collaborator

Choose a reason for hiding this comment

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

We should agree on a common implementation to put in uucore for it to be reused for the --debug flag of wc (see #9144)

@naoNao89 naoNao89 marked this pull request as draft November 6, 2025 07:57
@naoNao89 naoNao89 closed this by deleting the head repository Nov 6, 2025
@naoNao89 naoNao89 reopened this Nov 7, 2025
@github-actions
Copy link

github-actions bot commented Nov 7, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

@github-actions
Copy link

github-actions bot commented Nov 8, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

Copy link
Collaborator

@RenjiSann RenjiSann left a comment

Choose a reason for hiding this comment

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

I insist on creating a common interface in uucore for retrieving hardware information.

Additionally, it seems that this PR does not fix GNU's cksum.sh test anymore :/

…ction

- Add --debug flag to cksum for displaying CPU hardware capabilities
- Implement CPU feature detection for x86 (32-bit and 64-bit), aarch64, and loongarch64
- Add target-specific cpufeatures dependency (excluded on Android)
- Add comprehensive benchmarks for cksum performance
- Add CPU debug info printing with proper Android exclusion
- Update localization strings for new --debug flag
- Add test fixtures for crc32b algorithm validation
@sylvestre sylvestre force-pushed the fix-cksum-debug-flag branch from d8939a5 to e19b34e Compare November 10, 2025 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants