8000 `tail`: piped or redirected input on windows and android platforms is not implemented · Issue #3881 · uutils/coreutils · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tail: piped or redirected input on windows and android platforms is not implemented #3881

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

Closed
Joining7943 opened this issue Aug 27, 2022 · 2 comments · Fixed by #3965
Closed
Labels

Comments

@Joining7943
Copy link
Contributor

When input comes from a pipe or fifo on windows and android platforms there is no output and no processing of that input, at all. This is part of the problem when determining if the input is a fifo, pipe, file etc. A related issue is #3845. The if check here

if display_name.is_stdin() && path_is_tailable {

fails because path_is_tailable resolves to false because the check in path.is_tailable()

self.is_file() || self.exists() && self.metadata().unwrap().is_tailable()

returns false. On windows platforms (and I assume on android platforms, too) the statement self.is_file() || self.exists() = false resolves to false. This leads to the input not handled and silently ignored, since the if ... else if .. else if chain above misses an else branch, where I would at least expect an error message. To me, the determination of tailable and if a path is fifo, pipe looks broken and is scattered over a 2000 lines file. Wouldn't it be clearer to determine with which kind of input and files we're dealing with right from the start when parsing the settings, store what we've found in a struct or enum and then handle all cases? Looking at this big tail file. refactoring tail.rs to be clearer would help resolving the different handling of input on different platforms.

Joining7943 added a commit to Joining7943/uutil-coreutils that referenced this issue Aug 27, 2022
@jhscheer
8000 Copy link
Contributor

On windows platforms (and I assume on android platforms, too) the statement self.is_file() || self.exists() = false resolves to false. This leads to the input not handled and silently ignored, since the if ... else if .. else if chain above misses an else branch, where I would at least expect an error message.

Handling piped or redirected input for tail was added only recently with the primary focus on Linux in order to pass the GNU test suite.

To me, the determination of tailable and if a path is fifo, pipe looks broken and is scattered over a 2000 lines file.

PRs to improve and expand this functionality to other platforms are of course always welcome.

If you decide to work on this, please keep in mind to also activate the tests regarding piped input in tests_tail.rs for the platform you chose. Right now they only run on Linux.

Wouldn't it be clearer to determine with which kind of input and files we're dealing with right from the start when parsing the settings, store what we've found in a struct or enum and then handle all cases?

Keep in mind that the status, e.g. if a path is tailable or not, can change during runtime with --follow.

@Joining7943
Copy link
Contributor Author

Keep in mind that the status, e.g. if a path is tailable or not, can change during runtime with --follow.
...
If you decide to work on this, please keep in mind to also activate the tests regarding piped input in tests_tail.rs for the platform you chose. Right now they only run on Linux.

Thanks for the tip.

I can try adding windows to the functionality of tail, at least with regard of piped input. I currently don't have a working android or macos environment for testing.

@Joining7943 Joining7943 changed the title tail: piped or redirected input on windows and android platforms is broken tail: piped or redirected input on windows and android platforms is not implemented Aug 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0