Skip to content

sort: errors on overflowing -k argument but shouldn't #7185

@jfinkels

Description

@jfinkels

Steps to reproduce:

printf "2\n1\n" | sort -k 18446744073709551616

What happens now: uutils sort terminates with an error message:

sort: failed to parse key '18446744073709551616': failed to parse field index '18446744073709551616': number too large to fit in target type

What I expected to happen: GNU sort successfully sorts the input without error:

1
2

Notes: this is causing a failure in the GNU test case tests/sort/sort.pl. I think GNU just uses the maximum possible value of usize if the argument would overflow.

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