Skip to content
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

ls: use libc::{major, minor} to calculate device number #4120

Merged

Conversation

SteveLauC
Copy link
Contributor

At the time of #2145, major and minor have not been added to libc, so we have to manually calculate the device number.

And those functions have been added (rust-lang/libc#2937) so that we can employ them.

BTW, I called cargo fmt on this file, but I didn't see rustfmt.toml in this project, so if you guys don't like it, feel free to ask to to discard the format changes.

Ref: #2140

src/uu/ls/src/ls.rs Outdated Show resolved Hide resolved
@sylvestre
Copy link
Sponsor Contributor

I love simplifications :)

@SteveLauC SteveLauC force-pushed the ls/device-number-use-major-minor-from-libc branch from 09d30e9 to 2bb75a9 Compare November 9, 2022 09:10
src/uu/ls/src/ls.rs Outdated Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented Nov 9, 2022

GNU testsuite comparison:

GNU test failed: tests/misc/timeout. tests/misc/timeout is passing on 'main'. Maybe you have to rebase?

@SteveLauC
Copy link
Contributor Author

Test Android builds (28, default, x86) failed on a cp test, which seems unrelated to this PR:

failures:

---- test_cp::test_cp_parents_2_dirs stdout ----
current_directory_resolved: 
mkdir_all: /data/data/com.termux/files/usr/tmp/.tmp1DCT2X/a/b/c
mkdir: /data/data/com.termux/files/usr/tmp/.tmp1DCT2X/d
run: /data/data/com.termux/files/home/coreutils/target/debug/coreutils cp -a --parents a/b/c d
thread 'test_cp::test_cp_parents_2_dirs' panicked at 'Command was expected to succeed.
stdout = 
 stderr = cp: Permission denied (os error 13)
', tests/common/util.rs:176:9


failures:
    test_cp::test_cp_parents_2_dirs

test result: FAILED. 2325 passed; 1 failed; 31 ignored; 0 measured; 0 filtered out; finished in 215.43s

error: test failed, to rerun pass `--test tests`
error: 1 target failed:
    `--test tests`
Error: The process '/bin/sh' failed with exit code 101

And sadly I have no idea about the failure in Run GNU tests...

@sylvestre
Copy link
Sponsor Contributor

both of them aren't your fault ... noise :(

@sylvestre sylvestre merged commit 7d8ec3b into uutils:main Nov 9, 2022
@sylvestre
Copy link
Sponsor Contributor

thanks!

@SteveLauC SteveLauC deleted the ls/device-number-use-major-minor-from-libc branch November 9, 2022 10:29
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.

None yet

2 participants