Trivial reproduction:

$ true | tac - -
tac: cannot create temporary file in `/tmp': Invalid argument

This is present in coreutils 8.14.

The cause is the way "template" is reused in copy_to_temp().  The
"XXXXXX" suffix is clobbered by the first call to mkstemp(), so the
next call returns EINVAL.

It looks like the intent is to call mkstemp() at most once and then
reuse that file; for example, record_or_unlink_tempfile() will delete
at most one file on exit.



Reply via email to