Table::new seeded each column width with the header's length in bytes,
while every cell, the header row included, is measured in display
columns. A non-ASCII header therefore widened its column by one space
per extra byte: with LANG=fr_FR.UTF-8, "Utilisé" gets 8 columns instead
of 7, Cyrillic headers come out twice as wide as they should, CJK ones
one and a half times.
The header row already goes through the same width loop as the data
rows, so drop the byte-length seed and let that loop size it.
Closes#15246.
AIX tr has a -A flag that makes it work byte by byte, with ASCII
ranges and character classes instead of the locale's. AIX's own
scripts use it (lslpp -L does), and GNU tr has accepted it since 8.30
without documenting it. Our tr rejected it as an unexpected argument.
This tr never looks at the locale, so it already behaves as if -A
were given. Accept the flag, keep it out of --help as GNU does, and
otherwise ignore it.
Closes#15225.
GNU tr rejects -u, so a script that uses it does not run with GNU tr.
Keep accepting the option for scripts written for FreeBSD and macOS,
but do not advertise it, the same way GNU tr accepts AIX's -A without
listing it.
FreeBSD and macOS tr take -u to guarantee that output is unbuffered,
and scripts written for them use it to pass progress output through a
pipeline as it arrives, e.g. `curl ... 2>&1 | tr -u '\r' '\n'`. uutils
tr rejected the option, so such pipelines failed outright.
On Unix every chunk is already written as soon as it is translated, so
-u has nothing left to do there. Windows still writes through the line
buffered Stdout, so flush it after every chunk when -u is given.
Since 5ec266b (#13494) every input file is opened up front and kept
open until it is read, so sorting more than about 1020 files fails
with "Too many open files" under the usual soft limit of 1024.
Before that commit the inputs were opened and closed once to verify
them and reopened later, which lost data on FIFOs.
Verify the inputs the way GNU sort's check_inputs() does, with
access(2), which holds no descriptor and does not block on a FIFO,
and open each input exactly once when it is reached. On platforms
without access(2) the check opens and closes the file, as before.
Fixes#14419.