]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
doc: document sort -o F F danger
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 23 Feb 2016 07:48:36 +0000 (23:48 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 23 Feb 2016 07:49:09 +0000 (23:49 -0800)
Problem reported by Yanyan Jiang 蒋炎岩 in: http://bugs.gnu.org/22769
* doc/coreutils.texi (sort invocation):
Mention possibility of 'sort -o F F' data loss during crashes.

doc/coreutils.texi

index 01791be5b16f8fa86c26a4823da682eaecd615f6..a07e46ef10dcdf958c4aaabe440e426c1a80bf18 100644 (file)
@@ -4384,9 +4384,12 @@ silently uses a smaller value.
 @cindex overwriting of input, allowed
 Write output to @var{output-file} instead of standard output.
 Normally, @command{sort} reads all input before opening
-@var{output-file}, so you can safely sort a file in place by using
+@var{output-file}, so you can sort a file in place by using
 commands like @code{sort -o F F} and @code{cat F | sort -o F}@.
-However, @command{sort} with @option{--merge} (@option{-m}) can open
+However, it is often safer to output to an otherwise-unused file, as
+data may be lost if the system crashes or @command{sort} encounters
+an I/O or other serious error while a file is being sorted in place.
+Also, @command{sort} with @option{--merge} (@option{-m}) can open
 the output file before reading all input, so a command like @code{cat
 F | sort -m -o F - G} is not safe as @command{sort} might start
 writing @file{F} before @command{cat} is done reading it.