maint: sort: style adjustment to help clarify size determination

* src/sort.c (default_sort_size): Move physmem code "down" to first use.
maint: suppress echoing of sc_THANKS_in_duplicates implementation

* cfg.mk (sc_THANKS_in_duplicates): Suppress the echoing of these
commands run during `make syntax-check`
maint: refactor common mode bits used to create files

* src/system.h (MODE_RW_UGO): The new refactored define (666).
* src/mkfifo.c: Use the new define.
* src/mknod.c: Likewise.
* src/split.c: Likewise.
* src/system.h: Likewise.
* src/touch.c: Likewise.
* src/truncate.c: Likewise.

Suggested-by: Jim Meyering
split: ensure output doesn't overwrite input

* src/split.c (create): Check if output file is the
same inode as the input file.
* tests/split/guard-input: New test case.
* tests/Makefile.am: Reference new test case.
* NEWS: Mention the fix.

Improved-by: Jim Meyering
Reported-by: François Pinard
doc: document multiplier for dd number options like count=N

* src/dd.c (usage): Add "N" to the description of multipliers.
* doc/coreutils.texi (dd invocation): Likewise.
maint: avoid a static analysis warning in csplit

The Canalyze static code analyzer correctly surmised
that there is a use-after-free bug in free_buffer()
at the line "struct line *n = l->next", if that
function is called multiple times.

This is not a runtime issue since a list of lines
will not be present in the !lines_found case.

* src/csplit.c (free_buffer): Set list head to NULL so
that this function can be called multiple times.
(load_buffer): Remove a redundant call to free_buffer().

Reported-by: Xu Zhongxing
doc: improve sample backup script

* doc/coreutils.texi (cp invocation): Make the backup script exit
with an accurate reflection of any failure.
Also, add --preserve=all.

Improved-by: Bernhard Voelker
stat,tail: recognize new file system type: aufs

* src/stat.c (human_fstype) [__linux__]: Add a 'case' for the new
remote file system type: aufs (0x61756673).
* NEWS (New features): Mention stat -f.
(Bug fixes): Mention it for tail -f.
Reported by Michael Mol in http://bugs.gnu.org/11823
maint: avoid false-positive syntax-check failure due to fail=0 in .texi

* cfg.mk (exclude_file_name_regexp--sc_prohibit_fail_0): Exempt
all .texi files.
maint: avoid a -Wunsed-but-set warning on some systems

* src/stty.c (main): Mark speed_was_set as possibly unused,
as is the case when CIBAUD is undefined (on ppc64 GNU/Linux
for example).
Reported-by: Stefano Lattarini
maint: sc_prohibit_fail_0: update a stale comment

* cfg.mk (sc_prohibit_fail_0): Following on from
commit v8.0-79-g71c2f88, update the comment to match.
sort: avoid redundant processing with inaccessible inputs or output

* src/sort.c (check_inputs): A new function to verify all inputs
are accessible before further processing.
(check_output): A new function to open or create a specified
output file, before futher processing.
(stream_open): Adjust to truncating the previously opened
output file rather than opening directly.
(avoid_trashing_input): Optimize to stat the output file
descriptor, rather than the file name.
(main): Call the new functions to check accessibility of
inputs and output, before processing starts.
* tests/misc/sort: Adjust to the changed error message.
* tests/misc/sort-merge-fdlimit: Account for the earlier opened
file descriptor of the specified output file.
* tests/misc/sort-exit-early: A new test to exercise the improvements.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the improvement.

Suggested-by: Bernhard Voelker
sort: simplify -o handling to avoid fdopen, assert

* src/sort.c (outfd): Remove.  All uses replaced by STDOUT_FILENO.
(stream_open): When writing, use stdout rather than fdopen.
(move_fd_or_die): Renamed from dup2_or_die, with the added functionality
of closing its first argument.  All uses changed.
(avoid_trashing_input): Special case for !outfile no longer needed.
(check_output): Arrange for standard output to go to the file,
rather than storing the fd in outfd.
sort: fix exit-status typo

* src/sort.c (stream_open): EXIT_FAILURE -> SORT_FAILURE.
Suggested by Pádraig Brady in <http://bugs.gnu.org/11816#34>.
maint: fix minor bugs in helper program, setuidgid

* src/setuidgid.c (main): Fix two error-before-usage calls not to exit.
Exit with status SETUIDGID_FAILURE (not EXIT_FAILURE) consistently.
maint: add syntax-check rule to help avoid misuse of EXIT_FAILURE

* cfg.mk (sc_some_programs_must_avoid_exit_failure): New rule,
to help us avoid using EXIT_FAILURE in programs like sort, ls, nohup,
timeout, env, etc. that use different exit codes in many cases.
date: fails to diagnose invalid input

date -d "$(printf '\xb0')" would print 00:00:00 with today's date
rather than diagnosing the invalid input.  Now it reports this:
date: invalid date '\260'
* gnulib: Update submodule to latest for fixed parse-datetime.y.
* tests/misc/date [invalid-high-bit-set]: New test.
* NEWS (Bug fixes): Mention it.
* bootstrap, tests/init.sh: Also update to latest.
Reported by Peter Evans in http://bugs.gnu.org/11843
doc: fix spacing

* doc/coreutils.texi: Use right amount of spacing after punctuation.
doc: document leap seconds better

* doc/coreutils.texi (touch invocation, Time conversion specifiers)
(Options for date, Examples of date): Index "leap seconds" and
improve their documentation a bit.
tests: sort-merge-fdlimit: reduce the limit by one

* tests/misc/sort-merge-fdlimit: As a consequence of commit
v8.17-34-g59daf05, we can reduce the descriptor limit by one.