split: honor $TMPDIR for temp files

* bootstrap.conf: Depend on tmpdir rather than tmpfile,
as the standard tmpfile() doesn't honor $TMPDIR.
* src/split.c (copy_to_tmpfile): Adjust to call temp_stream() rather
than tmpfile();
* NEWS: Mention the improvement.
This commit is contained in:
Pádraig Brady 2023-07-18 18:55:30 +01:00
parent 1b86b70dd5
commit 464be62df6
4 changed files with 7 additions and 3 deletions

2
NEWS
View File

@ -68,6 +68,8 @@ GNU coreutils NEWS -*- outline -*-
split now uses more tuned access patterns for its potentially large input.
This was seen to improve throughput by 5% when reading from SSD.
split now supports a configurable $TMPDIR for handling any temporary files.
tac now falls back to '/tmp' if a configured $TMPDIR is unavailable.

View File

@ -274,7 +274,7 @@ gnulib_modules="
time_rz
timer-time
timespec
tmpfile
tmpdir
tzset
uname
unicodeio

View File

@ -396,6 +396,7 @@ src_arch_SOURCES = src/uname.c src/uname-arch.c
src_cut_SOURCES = src/cut.c src/set-fields.c
src_numfmt_SOURCES = src/numfmt.c src/set-fields.c
src_split_SOURCES = src/split.c src/temp-stream.c
src_tac_SOURCES = src/tac.c src/temp-stream.c
src_tail_SOURCES = src/tail.c src/iopoll.c

View File

@ -40,6 +40,7 @@
#include "quote.h"
#include "sig2str.h"
#include "sys-limits.h"
#include "temp-stream.h"
#include "xbinary-io.h"
#include "xdectoint.h"
#include "xstrtol.h"
@ -279,8 +280,8 @@ CHUNKS may be:\n\
static off_t
copy_to_tmpfile (int fd, char *buf, idx_t bufsize)
{
FILE *tmp = tmpfile ();
if (!tmp)
FILE *tmp;
if (!temp_stream (&tmp, nullptr))
return -1;
off_t copied = 0;
off_t r;