diff options
| author | Collin Funk <collin.funk1@gmail.com> | 2025-10-23 21:27:53 -0700 |
|---|---|---|
| committer | Collin Funk <collin.funk1@gmail.com> | 2025-10-25 12:59:08 -0700 |
| commit | 2b3eb795c85633a4b808df44d19a4a9be5976c10 (patch) | |
| tree | 535d3652f01ccb3f7b1c0834bf45acbd3f9b9e3f /tests | |
| parent | maint: remove unnecessary ignore_value usage (diff) | |
| download | coreutils-2b3eb795c85633a4b808df44d19a4a9be5976c10.tar.gz coreutils-2b3eb795c85633a4b808df44d19a4a9be5976c10.zip | |
sort: use the more efficient posix_spawn to invoke --compress-program
* NEWS: Mention the improvement. Mention that 'sort' will continue
without compressing temporary files if the program specified by
--compress-program cannot be executed.
* doc/coreutils.texi (sort invocation): Document the behavior when the
program specified by --compress-program cannot be executed.
* src/sort.c: Include spawn.h.
(MAX_FORK_TRIES_COMPRESS, MAX_FORK_TRIES_DECOMPRESS): Remove definition.
(MAX_TRIES_COMPRESS, MAX_TRIES_DECOMPRESS): New definitions based on
MAX_FORK_TRIES_COMPRESS and MAX_FORK_TRIES_DECOMPRESS.
(async_safe_die): Remove function.
(posix_spawn_file_actions_move_fd): New function.
(pipe_fork): Remove function.
(pipe_child): New function based on pipe_fork. Return an error number
instead of a pid. Use posix_spawnp instead of calling fork and expecting
the caller to exec.
(maybe_create_temp): Call pipe_child instead of pipe_fork. Print a
warning to standard error if --compress-program cannot be executed and
the error is different than the previous call. Remove code for the child
process.
(open_temp): Remove code for the child process. Improve error message.
* tests/sort/sort-compress.sh: Add a test case for when the program
specified by --compress-program does not exist.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/sort/sort-compress.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/sort/sort-compress.sh b/tests/sort/sort-compress.sh index 3d60582fd..773e34006 100755 --- a/tests/sort/sort-compress.sh +++ b/tests/sort/sort-compress.sh @@ -69,4 +69,13 @@ compare exp out || fail=1 test -f ok || fail=1 rm -f dzip ok +# Check the behavior of 'sort' when the program specified by --compress-program +# does not exist. +cat <<\EOF > exp-err +sort: could not run compress program 'missing': No such file or directory +EOF +sort --compress-program=missing -S 1k in > out 2> err || fail=1 +compare exp out || fail=1 +compare exp-err err || fail=1 + Exit $fail |
