-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
chmod: make a test environment-agnostic #8525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
GNU testsuite comparison: |
df7575e to
0b67ada
Compare
|
GNU testsuite comparison: |
|
clippy complains about a useless conversion: |
|
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: |
| 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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was failing on mac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
run ssh, it might break with: