1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-16 19:56:17 +00:00

Merge pull request #3066 from jfinkels/dd-skip-beyond-file

dd: show warning if skipping past end of input
This commit is contained in:
Sylvestre Ledru 2022-02-12 11:34:06 +01:00 committed by GitHub
commit 090fb07361
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 13 deletions

View file

@ -657,6 +657,19 @@ fn test_seek_bytes() {
.stdout_is("\0\0\0\0\0\0\0\0abcdefghijklm\n");
}
/// Test for skipping beyond the number of bytes in a file.
#[test]
fn test_skip_beyond_file() {
new_ucmd!()
.args(&["bs=1", "skip=5", "count=0", "status=noxfer"])
.pipe_in("abcd")
.succeeds()
.no_stdout()
.stderr_contains(
"'standard input': cannot skip to specified offset\n0+0 records in\n0+0 records out\n",
);
}
#[test]
fn test_seek_do_not_overwrite() {
let (at, mut ucmd) = at_and_ucmd!();