Skip to content

cat fast path (splice on linux) does not work for 0 size files #9609

@jendap

Description

@jendap

Cat has fast path using splice system call. Unfortunately it does not work for many "file systems" reporting wrong file size.

In particular I have fuse file system returning incorrect size (zero or otherwise). It should be fine since one should treat file size on linux as a hint and read until EOF. That is what gnu cat does. It is also what uutils do in slow path! The fast path calling splice will stop at whatever file size is returned in stat. It is inconsistent and break stuff. Can we disable it please?

BTW: It works for cat /proc/self/stat which also report 0 size. The reason is probably for it somewhere in splice.c. But we're not going to change syscall behavior anyway. Calling the syscall in rust code looks fine, right?

BTW: I can see workaround if you really want to keep the splice around. But it is already quite a lot of code to do the splice. Is it worth even more hacks?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions