Skip to content
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

fcat can't print anything in my system #39

Open
federicotorrielli opened this issue Dec 5, 2020 · 18 comments
Open

fcat can't print anything in my system #39

federicotorrielli opened this issue Dec 5, 2020 · 18 comments

Comments

@federicotorrielli
Copy link

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!

@mre
Copy link
Owner

mre commented Dec 5, 2020

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?

@federicotorrielli
Copy link
Author

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

@federicotorrielli
Copy link
Author

Any update on this?

@mre
Copy link
Owner

mre commented Dec 12, 2020

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?

@federicotorrielli
Copy link
Author

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.

@mre
Copy link
Owner

mre commented Dec 17, 2020

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

@mre
Copy link
Owner

mre commented Mar 6, 2021

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?

@federicotorrielli
Copy link
Author

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!

@mre
Copy link
Owner

mre commented Mar 6, 2021

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.

Anything I'm missing here?

@mre mre reopened this Mar 6, 2021
@kangalio
Copy link

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?

@mre
Copy link
Owner

mre commented Jan 26, 2022

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.

@kangalio
Copy link

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

@mre
Copy link
Owner

mre commented Feb 4, 2022

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
Copy link
Owner

mre commented Feb 4, 2022

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

@whoizit
Copy link

whoizit commented Apr 11, 2022

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

@mre
Copy link
Owner

mre commented Apr 12, 2022

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.

@ConYel
Copy link

ConYel commented Sep 4, 2024

Could maybe fcat work in bsd instead?

@mre
Copy link
Owner

mre commented Sep 4, 2024

Yes, there's a chance. https://man.freebsd.org/cgi/man.cgi?query=splice&sektion=2&apropos=0&manpath=CentOS+7.0
The reason why it worked on Linux was that splice supported files as inputs and stdout as output. That since broke. Nowadays it's way more conservative.

One would have to try if it works on an actual BSD operating system like FreeBSD or OpenBSD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants