1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-21 11:16:16 +02:00

tac: fall back to /tmp if $TMPDIR is unavailable

This also refactors temp_stream() to its own module,
in preparation for use by split.

* src/tac.c: Refactor temp_stream() out to ...
* src/temp-stream.c: ... A new module mostly refactored from tac,
but uses tmpdir to more robustly support $TMPDIR,
while falling back to /tmp if not available.
* src/temp-stream.h: The new module interface.
* src/local.mk: Reference the new module from tac.
* tests/tac/tac.pl: Adjust to non failing missing $TMPDIR.
* po/POTFILES.in: Reference the new module with translatable strings.
* NEWS: Mention the user visible improvements to tac TMPDIR handling.
This commit is contained in:
Pádraig Brady
2023-07-18 15:39:05 +01:00
parent 47e1388d6f
commit 1b86b70dd5
7 changed files with 179 additions and 123 deletions

View File

@@ -74,9 +74,7 @@ my @Tests =
['pipe-bad-tmpdir',
{ENV => "TMPDIR=$bad_dir"},
{IN_PIPE => "a\n"},
{ERR_SUBST => "s,'$bad_dir': .*,...,"},
{ERR => "$prog: failed to create temporary file in ...\n"},
{EXIT => 1}],
{OUT=>"a\n"}],
# coreutils-8.5's tac would double-free its primary buffer.
['double-free', {IN=>$long_line}, {OUT=>$long_line}],