Skip to content

head: an invalid -c value is ignored when -n comes later #15997

Open

Description

@sylvestre

GNU validates every count option, even ones overridden later. uutils only parses the last one.

$ echo a | head -c1-3 -n1; echo $?

GNU:

head: invalid number of bytes: '1-3'
1

uutils prints a and exits 0.

tail --bytes 1,2 --lines 2 has the same problem (GNU: tail: invalid number of bytes: '1,2').

Reported in #15254 (found by a differential fuzzer; reproduced against GNU coreutils 9.12).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions