mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
dd: error if iflag=directory and input is stdin
Make `dd` error if `iflag=directory` and the input file is not a directory, as in : | dd iflag=directory Fixes #5900
This commit is contained in:
parent
54bc3cf944
commit
d9b3b3ef67
2 changed files with 26 additions and 7 deletions
|
@ -1728,7 +1728,26 @@ fn test_iflag_directory_fails_when_file_is_passed_via_std_in() {
|
|||
.args(&["iflag=directory", "count=0"])
|
||||
.set_stdin(std::process::Stdio::from(File::open(filename).unwrap()))
|
||||
.fails()
|
||||
.stderr_contains("standard input: not a directory");
|
||||
.stderr_only("dd: setting flags for 'standard input': Not a directory\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
fn test_iflag_directory_passes_when_dir_is_redirected() {
|
||||
new_ucmd!()
|
||||
.args(&["iflag=directory", "count=0"])
|
||||
.set_stdin(std::process::Stdio::from(File::open(".").unwrap()))
|
||||
.succeeds();
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
fn test_iflag_directory_fails_when_file_is_piped_via_std_in() {
|
||||
new_ucmd!()
|
||||
.arg("iflag=directory")
|
||||
.pipe_in("")
|
||||
.fails()
|
||||
.stderr_only("dd: setting flags for 'standard input': Not a directory\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue