From bc90f0d718f8eda2bbb91c655b7db5d09f269d25 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Thu, 16 Jul 2026 09:59:02 +0900 Subject: [PATCH] split: allow writing to symlink to nonseekable --- src/uu/split/src/platform/unix.rs | 7 +++++-- tests/by-util/test_split.rs | 12 ++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/uu/split/src/platform/unix.rs b/src/uu/split/src/platform/unix.rs index ebba18fd77a..dd9798539a9 100644 --- a/src/uu/split/src/platform/unix.rs +++ b/src/uu/split/src/platform/unix.rs @@ -186,8 +186,11 @@ fn create_or_truncate_output_file(input: &OsStr, filename: &OsStr) -> Result Err(open_file_error(filename, e)), + _ => Ok(file), + } } Err(e) => Err(open_file_error(filename, e)), } diff --git a/tests/by-util/test_split.rs b/tests/by-util/test_split.rs index ffe256100fe..a9e36f2c5a5 100644 --- a/tests/by-util/test_split.rs +++ b/tests/by-util/test_split.rs @@ -132,6 +132,18 @@ fn test_invalid_arg() { new_ucmd!().arg("--definitely-invalid").fails_with_code(1); } +#[test] +#[cfg(target_os = "linux")] +fn test_split_to_non_seekable() { + let (at, mut ucmd) = at_and_ucmd!(); + at.symlink_file("/dev/stdout", "xaa"); + + ucmd.args(&["-"]) + .pipe_in("string") + .succeeds() + .stdout_is("string"); +} + #[test] fn test_split_non_existing_file() { new_ucmd!()