ls: implement device symbol and id#2145
Merged
sylvestre merged 5 commits intouutils:masterfrom May 8, 2021
Merged
Conversation
Collaborator
Author
|
Looks like the |
Contributor
|
@tertsdiepraam yeah, would you mind opening a bug about this? |
Contributor
|
Could you please fix |
Collaborator
Author
|
Seems like that other PR was not successful then :( I'll try again soon! |
Contributor
|
Could you please fix the conflict? thanks |
Collaborator
Author
|
Should be all good now! Only code cov failed due to an unrelated test. |
Contributor
|
conflicting again with the recent pr :( sorry |
Collaborator
Author
|
No problem! I was expecting that to happen :) |
sylvestre
reviewed
May 8, 2021
| let dev: u64 = metadata.rdev(); | ||
| let major = (dev >> 8) as u8; | ||
| let minor = dev as u8; | ||
| return format!("{}, {}", major, minor); |
Contributor
There was a problem hiding this comment.
is it expected that we don't have tests for this?
Collaborator
Author
There was a problem hiding this comment.
Yeah, I wasn't sure how to test that. If you know a way to create (or mock?) devices in the test suite I'd be happy to add some tests!
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.
Closes #2140
This is a quick fix to show the correct symbols for character device and block device, fifo and pipe special files and show the minor and major id numbers of devices. I'm not sure how to test this, so any ideas on that are welcome!
The id numbers are not spaced correctly yet, because that would require a bit of a rewrite of the
longformat. I would rather do that in another PR (which should also fix #2139). This is what it looks like now:and here is what it should eventually look like: