Directory checks are expected to occur during the file read not before
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
We have around 12 utilities that are failing the misc/read-error gnu tests and its because we have separate checks in our utilities that check first if a input is a directory. We added this because there was a GNU test that checked this, but this causes a mismatch in behavior when a directory is provided and there is a read error, since GNU seemingly relies on the error message from read to indicate to users that its a directory.
Whats great about this is that for most utilities it simply means that we can just delete the directory check since we already provide the correct error messages during the read, but for some the fix is a bit more involved. I think just deleting the is_dir checks and error messages is the ideal path since it will match gnu edge cases better in general and will allow us to remove a bunch of code. I think to resolve this issue though we should make sure that every is_dir check we remove, we make sure there is a existing regression test to make sure the error message still stays the same.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the utilities with separate is_dir checks and compare their behavior against the misc/read-error GNU tests. Review each existing regression test for directory read errors, remove only the checks that duplicate read-time handling, and ensure every affected utility still reports the expected error message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100