Skip to content

head: fails to leave remaining bytes of file available for subsequent commands #7028

@jfinkels

Description

@jfinkels

Environment: Ubuntu 20.04, uutils main branch (git commit dddbc17), GNU coreutils v9.5.218-7e5b6.

Steps to reproduce:

printf "a\nb\n" > f
(head -n1 >/dev/null; cat) < f

What happens now: uutils head outputs nothing.

What I expected to happen: GNU head outputs b\n, as expected.

Notes: this is causing a failure in the GNU test file tests/head/head-pos.sh.

We ran into a similar issue with dd here #3008 which was fixed by opening the file from its raw file descriptor here #4189. Maybe a similar solution can be applied to this issue?

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