]> git.ipfire.org Git - thirdparty/coreutils.git/commit
tac: handle short reads on input
authorPádraig Brady <P@draigBrady.com>
Mon, 31 Jul 2023 11:41:26 +0000 (12:41 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 31 Jul 2023 17:55:19 +0000 (18:55 +0100)
commit779f34e180fdcabddb24acc2829410ce8ed50fd1
tree2a7b81d22c96b4b76992ffd8bf79a7ceb8e2034d
parenta102826245505986bf336b87e081f1fdb44469d8
tac: handle short reads on input

This can be reproduced by getting the read() above 2G,
which induces a short read, thus triggering the erroneous failure.

  $ truncate -s 5G 5G

  $ cat 5G | TMPDIR=$PWD tac | wc -c
  tac: /tmp/tacFt7txA: read error: Illegal seek
  0

With the fix in place we now get:

  $ cat 5G | TMPDIR=$PWD src/tac | wc -c
  5368709120

* src/tac.c (tac_seekable): Use full_read() to handle short reads.
* NEWS: Mention the bug fix.
Reported at https://bugs.debian.org/1042546
NEWS
src/tac.c