Skip to content

seq will loop forever on large numbers #1703

@jaggededgedjustice

Description

@jaggededgedjustice

When seq is used to generate very large numbers it will get stuck in an infinite loop.

The gnu coreutils test includes the following check:

seq 999999999999999999999999999999999999999999999999999999999999999999999999999999999 1000000000000000000000000000000000000000000000000000000000000000000000000000000001

The expected output is:

$ seq 999999999999999999999999999999999999999999999999999999999999999999999999999999999 1000000000000000000000000000000000000000000000000000000000000000000000000000000001
999999999999999999999999999999999999999999999999999999999999999999999999999999999
1000000000000000000000000000000000000000000000000000000000000000000000000000000000
1000000000000000000000000000000000000000000000000000000000000000000000000000000001

The actual output is:

$ ./target/debug/coreutils seq 999999999999999999999999999999999999999999999999999999999999999999999999999999999 1000000000000000000000000000000000000000000000000000000000000000000000000000000001 
999999999999999921281879895665782741935503249059183851809998224123064148429897728
999999999999999921281879895665782741935503249059183851809998224123064148429897728
999999999999999921281879895665782741935503249059183851809998224123064148429897728
<repeat forever>

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