-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
stat
: Adds support to read a filename redirected to stdin
#3280
stat
: Adds support to read a filename redirected to stdin
#3280
Conversation
- Canonicalization of `/dev/stdin` which points to stdin file
Could you please add a test to make sure we don't regress? |
Now all instances of `-` will be replaced with real / canonicalized path of `/dev/stdin`
Hi, Reference: rust-lang/rust#95239 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though there is no simple way to test this, I checked out this branch and tested on my machine and it seemed to work as expected. 👍
Thanks! |
* add tests for: uutils#3485 * add test for: uutils#3280
* add tests for: uutils#3485 * add test for: uutils#3280
* fix uutils#3485 * improve the workaround from uutils#3280 * add tests
It was a bit tricky, but it can be tested like this: coreutils/tests/by-util/test_stat.rs Lines 353 to 367 in 122c7d6
|
* fix uutils#3485 * improve the workaround from uutils#3280 * add tests
* fix uutils#3485 * improve the workaround from uutils#3280 * add tests
* fix uutils#3485 * improve the workaround from uutils#3280 * add tests
* fix uutils#3485 * improve the workaround from uutils#3280 * add tests
* fix uutils#3485 * improve the workaround from uutils#3280 * add tests
* fix uutils#3485 * improve the workaround from uutils#3280 * add tests
Explanation:
touch f && stat - < f
creates an empty file and stat after seeing-
tries to find the file which is being redirected to stdin and prints details for that file.Solution:
On detecting
-
, canonicalize/dev/stdin
which will point to the file which is being redirected to stdinNOTE stat doesn't read the content of the file, and this can be verified
Fixes #3241