coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

Rework tail plateform module to tackle #2873

Open anastygnome opened this issue 3 years ago • 6 comments

For the moment, these are just performance improvements (using the right name, not checking if the fd is negative as that can't be in rust, using the libc value)

The goal of this is to tackle #2873 more easily later on.

anastygnome avatar Jul 08 '22 14:07 anastygnome

@sylvestre trying to use isatty on stdin to do the stdin in is_pipe_or_fifo check results in a not implemented error on occasions. I had to use fstat is this a known phenomenon or not ? @tertsdiepraam

anastygnome avatar Jul 18 '22 15:07 anastygnome

I haven't seen that before. Which isatty were you using? libc, nix or the atty crate?

tertsdiepraam avatar Jul 19 '22 10:07 tertsdiepraam

The problem is at the libc level, I've tried all three

When piping in /dev/null (or stdin was closed), the problem occurred.

anastygnome avatar Jul 19 '22 10:07 anastygnome

Interesting, I can't check for myself right now, but what was the exact error?

tertsdiepraam avatar Jul 19 '22 11:07 tertsdiepraam

Interesting, I can't check for myself right now, but what was the exact error?

It panics with a not yet implemented, which I don't get as we're using it for other utils.

@sylvestre failures are unrelated, so we can merge this, I'll change it to use atty when this will be sorted out or we can just leave this open

anastygnome avatar Jul 19 '22 12:07 anastygnome

Interesting, I can't check for myself right now, but what was the exact error?

@tertsdiepraam @jhscheer This error was due to the not inplemented handling of block devices, it turns out isatty mistakenly reports that stdin is a terminal because rust reopens stdin as /dev/null which is a block device

@jhscheer here's an in-depth post on how to implement this case, which I put here for reference.
https://superuser.com/a/1267407

anastygnome avatar Jul 19 '22 19:07 anastygnome