cat,comm,expand,unexpand: remove is_dir() pre-checks to let read() report errors #10891
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.
This PR is based on the investigation of the read-error gnu test failures. Even though we correctly identify that the test is trying to use a directory we are failing the test because the error coming from the read function is different. This led me down the path to discover that we actually do not need to do additional stat checks to check if we are trying to read a directory because that is handled by read() and it is the expectation that we rely on the read() checks to provide the error message.
Every utility in this PR already had integration tests for validating that the error message matches the GNU error message and I have made them more exact by also validating error code and making it stderr_is instead of stderr_contains.
There will probably be two more PR's basically the same as this one for the other utilities