chmod: make a test environment-agnostic#8525
Merged
cakebaker merged 1 commit intouutils:mainfrom Aug 30, 2025
Merged
Conversation
|
GNU testsuite comparison: |
df7575e to
0b67ada
Compare
|
GNU testsuite comparison: |
Contributor
|
clippy complains about a useless conversion: |
cakebaker
reviewed
Aug 28, 2025
|
GNU testsuite comparison: |
run ssh, it might break with: ---- test_chmod::test_chmod_umask_expected stdout ---- thread 'test_chmod::test_chmod_umask_expected' panicked at tests/by-util/test_chmod.rs:240:5: assertion `left == right` failed: Unexpected umask value: expected 022 (octal), but got 002. Please adjust the test environment. left: 2 right: 18 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
GNU testsuite comparison: |
cakebaker
reviewed
Aug 30, 2025
| assert_eq!( | ||
| current_umask, 0o022, | ||
| "Unexpected umask value: expected 022 (octal), but got {current_umask:03o}. Please adjust the test environment.", | ||
| current_umask, system_umask as u32, |
Contributor
There was a problem hiding this comment.
Hm, maybe I'm missing something. What's the reason for the conversion (and the corresponding allow(clippy::cast_lossless)? Both libc::umask and uucore::mode::get_umask return a u32 value and so no conversion is necessary.
Contributor
Author
There was a problem hiding this comment.
it was failing on mac
Contributor
Author
There was a problem hiding this comment.
Checking coreutils v0.1.0 (/Users/runner/work/coreutils/coreutils)
error: casts from `u16` to `u32` can be expressed infallibly using `From`
--> tests/by-util/test_chmod.rs:247:24
|
247 | current_umask, system_umask as u32,
| ^^^^^^^^^^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
= note: `-D clippy::cast-lossless` implied by `-D clippy::pedantic`
= help: to override `-D clippy::pedantic` add `#[allow(clippy::cast_lossless)]`
help: use `u32::from` instead
|
247 - current_umask, system_umask as u32,
247 + current_umask, u32::from(system_umask),
|
error: could not compile `coreutils` (test "tests") due to 1 previous error
Error: Final attempt failed. Child_process exited with error code 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
run ssh, it might break with: