Following commit v9.3-92-g1b86b70dd
$TMPDIR is part of the interface and an important behavioral
characteristic of a command, which should be documented.

* doc/coreutils.texi (split invocation): Mention $TMPDIR is honored.
(tac invocation): Likewise.
* src/split.c (usage): Likewise.
* src/tac.c (usage): Likewise.
---
 doc/coreutils.texi | 12 ++++++++++--
 src/split.c        |  4 ++++
 src/tac.c          |  3 +++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index e0ff401e2..d31c80859 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -1837,6 +1837,11 @@ I.e., input and output items are delimited with ASCII 
NUL.
 On systems like MS-DOS that distinguish between text and binary files,
 @command{tac} reads and writes in binary mode.
 
+@vindex TMPDIR
+Non-seekable input is buffered to @env{$TMPDIR}, defaulting to @file{/tmp},
+if the @env{TMPDIR} environment variable is not set
+or the location is not available.
+
 @exitstatus
 
 Example:
@@ -3346,10 +3351,13 @@ are not split even if they overlap a partition, the 
files written
 can be larger or smaller than the partition size, and even empty
 if a line/record is so long as to completely overlap the partition.
 
+@vindex TMPDIR
 When the input is a pipe or some other special file where the size
 cannot easily be determined, there is no trouble for @samp{r} mode
-because the size of the input is irrelevant.  For other modes, such an
-input is first copied to a temporary to determine its size.
+because the size of the input is irrelevant.  For other modes,
+such an input's size is determined by first copying to @env{$TMPDIR},
+or @file{/tmp} if the @env{TMPDIR} environment variable is not set
+or the location is not available.
 
 @optItem{split,-a,@w{ }@var{length}}
 @optItemx{split,--suffix-length,=@var{length}}
diff --git a/src/split.c b/src/split.c
index d383f1ef9..58a880b28 100644
--- a/src/split.c
+++ b/src/split.c
@@ -268,6 +268,10 @@ CHUNKS may be:\n\
   l/K/N   output Kth of N to standard output without splitting lines/records\n\
   r/N     like 'l' but use round robin distribution\n\
   r/K/N   likewise but only output Kth of N to standard output\n\
+"), stdout);
+      fputs (_("\n\
+-n (except -nr) will buffer to $TMPDIR, defaulting to /tmp,\n\
+if the input size cannot easily be determined.\n\
 "), stdout);
       emit_ancillary_info (PROGRAM_NAME);
     }
diff --git a/src/tac.c b/src/tac.c
index e04933159..000cad1af 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -133,6 +133,9 @@ Write each FILE to standard output, last line first.\n\
 "), stdout);
       fputs (HELP_OPTION_DESCRIPTION, stdout);
       fputs (VERSION_OPTION_DESCRIPTION, stdout);
+      fputs (_("\n\
+Non-seekable input is buffered to $TMPDIR, defaulting to /tmp.\n\
+"), stdout);
       emit_ancillary_info (PROGRAM_NAME);
     }
   exit (status);
-- 
2.52.0


Reply via email to