Skip to content

dd: various issues related to the i64::MAX boundary #12964

@zhw2101024

Description

@zhw2101024

Running gnu dd with skip=i64::MAX produces different output depending on the infile:
dd if=infile of=outfile bs=1 skip=9223372036854775807
infile is empty:

> infile
dd if=infile of=outfile bs=1 skip=9223372036854775807

gnu output:

dd: error reading 'infile': Invalid argument
0+0 records in
0+0 records out
0 bytes copied, 3.6689e-05 s, 0.0 kB/s

infile is not empty:

echo > infile
dd if=infile of=outfile bs=1 skip=9223372036854775807

gnu output:

dd: infile: cannot skip to specified offset
dd: error reading 'infile': Invalid argument
0+0 records in
0+0 records out

running gnu dd with seek=i64::MAX produces different output if the infile is not empty:
infile contain 1 byte:

echo > infile
dd if=infile of=outfile bs=1 seek=9223372036854775807

gnu output:

dd: error writing 'outfile': Invalid argument
1+0 records in
0+0 records out
0 bytes copied, 3.5892e-05 s, 0.0 kB/s

infile contain 2 bytes && seek = i64::MAX:
same with infile containing 1 byte

infile contain 2 bytes && seek = i64::MAX-1:

echo a > infile
dd if=infile of=outfile bs=1 seek=9223372036854775806

gnu output:

dd: error writing 'outfile': Invalid argument
2+0 records in
1+0 records out
1 byte copied, 4.7712e-05 s, 21.0 kB/s

The uutils dd output following in all above situations:
dd: IO error: Invalid input

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions