From: Pádraig Brady
Date: Thu, 18 Dec 2025 23:54:52 +0000 (+0000) Subject: doc: split,tac: document $TMPDIR usage X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7be8402e1e36a04b757de66a76f18cf9e31a53ff;p=thirdparty%2Fcoreutils.git doc: split,tac: document $TMPDIR usage 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. --- diff --git a/doc/coreutils.texi b/doc/coreutils.texi index e0ff401e2b..d31c808595 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 d383f1ef90..58a880b28e 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 e049331592..000cad1af0 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);