fcat icon indicating copy to clipboard operation
fcat copied to clipboard

fcat can't print anything in my system

Open federicotorrielli opened this issue 4 years ago • 18 comments

Hi, maybe it's some dependency that dependabot broke but my fcat is not working anymore, it gives me this error: fcat Thanks in advance for the support!

federicotorrielli avatar Dec 05 '20 10:12 federicotorrielli

Strange. That means it has problems reading from the kernel buffer or printing to the screen. Can you try a few different files? What is your kernel version and linux distribution?

mre avatar Dec 05 '20 11:12 mre

I'm using ArcoLinux with 5.9.11-arch2-1 kernel, it gives the error on every file, even in the /home folder.

federicotorrielli avatar Dec 05 '20 11:12 federicotorrielli

Any update on this?

federicotorrielli avatar Dec 12 '20 09:12 federicotorrielli

Unfortunately not from my side. Don't know how to debug this as I don't have any system to debug the issue. 😟 Can you try on a different distribution if you have any at hand?

mre avatar Dec 12 '20 12:12 mre

All right! So, I did some test on a lot of distros in these days. Here's my report:

On every distribution with linux 5.9.* and 5.10.* fcat does not work BUT on every linux 5.8 and 5.4 does work without any problem. So I guess the problem is really something that has to be related to the latest linux versions. Tell me if you need more testing, I'll be glad to do so.

federicotorrielli avatar Dec 16 '20 16:12 federicotorrielli

This is utterly confusing... and a bit scary. So it sounds like something changed/broke in 5.9 (most likely changed).

mre avatar Dec 17 '20 14:12 mre

Why was that closed? I'd still say it would be interesting to know the reason why it is not working. Perhaps someone wants to pick this up in the future?

mre avatar Mar 06 '21 10:03 mre

Well, my bad. I close issues that are more than 2 months old, because it always means that a project is currently inactive. And also the issue seems related to the new kernels so people stick with bat (which is also using the splice feature) because it's currently active and has newer features. Can you re-open the issue? I'm currently on mobile and there's no choice to open it again here. Thanks!

federicotorrielli avatar Mar 06 '21 10:03 federicotorrielli

bat uses splice? That's news to me. I couldn't find any hint in the source code, only two issues, one closed and the other open but stalled.

  • https://github.com/sharkdp/bat/issues/1112
  • https://github.com/sharkdp/bat/issues/194

Anything I'm missing here?

mre avatar Mar 06 '21 22:03 mre

It seems like stdout doesn't count as a pipe anymore for some reason

fcat file.txt | cat works, fcat file.txt does not. This seems to be a common issue, e.g. someone on StackOverflow using splice from C. It was mentioned that this issue starts with Linux 5.9, so maybe this is related?

kangalio avatar Jan 26 '22 18:01 kangalio

I looked through the 5.9 changelog and could only find this patch, which describes a deadlock in combination with splice. Can't find much else. Maybe somebody with more kernel experience can verify.

mre avatar Jan 26 '22 22:01 mre

Oops, I meant to add this link to my last sentence http://archive.lwn.net:8080/linux-kernel/202105071116.638258236E@keescook/t/

kangalio avatar Jan 26 '22 22:01 kangalio

So does that mean we have to ask on the Linux Kernel mailing list if they can add back support for splice for our use-case? 😅

mre avatar Feb 04 '22 11:02 mre

I doubt they would if it's not on their roadmap already, which probably would mean this project is dead. 😆

mre avatar Feb 04 '22 11:02 mre

same for me ArtixLinux (ArchLinux based), Linux 5.17.1-zen1-1-zen

❯ rustc -V          
rustc 1.62.0-nightly (1f7fb6413 2022-04-10)

❯ cargo install fcat
    Updating crates.io index
  Downloaded fcat v0.1.0
  Downloaded 1 crate (317.3 KB) in 1.70s
  Installing fcat v0.1.0
  Downloaded bitflags v0.9.1
  Downloaded nix v0.9.0
  Downloaded 2 crates (115.5 KB) in 1.78s
   Compiling libc v0.2.122
   Compiling bitflags v0.9.1
   Compiling cfg-if v0.1.10
   Compiling void v1.0.2
   Compiling nix v0.9.0
   Compiling fcat v0.1.0
    Finished release [optimized] target(s) in 32.79s
  Installing /home/user/.cargo/bin/fcat
   Installed package `fcat v0.1.0` (executable `fcat`)

❯ fcat --help       
thread 'main' panicked at 'fcat: --help: No such file or directory: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/fcat-0.1.0/src/main.rs:15:39
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

❯ fcat yggdrasil.conf 
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Sys(EINVAL)', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/fcat-0.1.0/src/main.rs:43:15
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

whoizit avatar Apr 11 '22 23:04 whoizit

Not gonna lie, it's looking pretty bleak for this project. Newer kernels changed the behavior of splice and that broke our use-case. 😕 Unless we find a workaround (or convince the maintainers to find a solution in the Kernel) this project can't be fixed.

mre avatar Apr 12 '22 00:04 mre