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: device number for BSDs and solarishOS #4841

Merged
merged 5 commits into from May 11, 2023

Conversation

SteveLauC
Copy link
Contributor

With libc#2999 merged, we can finally add device numbers support to other platforms:)

What does this PR do

  1. Add ls -l device number support for BSDs and SolarishOS
    1. FreeBSD
    2. DragonFlyBSD
    3. NetBSD
    4. OpenBSD
    5. Illumos
    6. Solaris

For the list in this comment, Redox does not have these major/minor things(yet, I guess), other platforms are all supported, so we can close #2140.

@sylvestre
Copy link
Sponsor Contributor

It would be nice to have tests for this. At least freebsd

@SteveLauC
Copy link
Contributor Author

It would be nice to have tests for this. At least freebsd

Yes, I agree:) Will do this later

Comment on lines 3415 to 3420
let dev_dir = read_dir("/dev").unwrap();
// let's use the first device for test
let blk_dev = dev_dir
.map(|res_entry| res_entry.unwrap())
.find(|entry| entry.file_type().unwrap().is_block_device())
.expect("Expect a block device");
Copy link
Contributor Author

@SteveLauC SteveLauC May 7, 2023

Choose a reason for hiding this comment

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

I originally wanted to use the block device that the $PWD is on, finding that there is no portable way to do it programmatically, so let's just use the first block device under /dev

@@ -3393,3 +3393,42 @@ fn test_tabsize_formatting() {
.succeeds()
.stdout_is("aaaaaaaa bbbb\ncccc dddddddd");
}

#[cfg(any(
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

isn't it just unix ? :)

Copy link
Contributor Author

@SteveLauC SteveLauC May 7, 2023

Choose a reason for hiding this comment

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

They contain most UNIX OSes, but there are exceptions like haiku, Redox

refers to libc/src/unix

@SteveLauC
Copy link
Contributor Author

For ubuntu/i686 CI tests, the test panicked at Expect a block device, which means there is no block device under their /dev, this is kinda weird, have any idea why this happened?

@github-actions
Copy link

github-actions bot commented May 7, 2023

GNU testsuite comparison:

Congrats! The gnu test tests/tail-2/inotify-dir-recreate is no longer failing!

@SteveLauC
Copy link
Contributor Author

Android is removed from the test as we don't have permission to read /dev

@SteveLauC
Copy link
Contributor Author

Tests passed, friendly ping @sylvestre, can I trouble u for another review:)

@sylvestre sylvestre merged commit 452be5a into uutils:main May 11, 2023
44 checks passed
@SteveLauC SteveLauC deleted the device_number branch May 11, 2023 10:59
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.

ls: show device details
2 participants