Hello. I'm running tac compiled from the canonical 9.11 release. - Issue #1: '$' seems to be ignored if preceded by certain patterns:
$ printf 1234 | tac -rs '.$' Expected output: 1234 Actual output: 4321 $ printf 1234 | tac -rs '\w$' Expected output: 1234 Actual output: 4321 $ printf 1234 | tac -brs '.$' Expected output: 4123 Actual output: 4321 Note that all of the following behave as expected: $ printf 1x2x3x4x | tac -rs 'x$' 1x2x3x4x $ printf 1x2x3x4x | tac -brs 'x$' x1x2x3x4 $ printf 1234 | tac -rs '$' 1234 $ printf 1234 | tac -rs '^.' 2341 $ printf 1234 | tac -brs '^.' 1234 - Issue #2: input is split into 8192 bytes records if '^' is used: $ for i in 1 2 3; do head -c8192 /dev/zero | tr \\0 $i; done | tac -rs '^' | od -Ax -tx1z Expected output: 0000 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 >1111111111111111< * 2000 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 >2222222222222222< * 4000 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 >3333333333333333< * 6000 Actual output: 0000 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 >3333333333333333< * 2000 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 >2222222222222222< * 4000 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 >1111111111111111< * 6000 Note that '$' behaves as expected here: $ for i in 1 2 3; do head -c8192 /dev/zero | tr \\0 $i; done | tac -rs '$' | od -Ax -tx1z 0000 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 >1111111111111111< * 2000 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 >2222222222222222< * 4000 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 >3333333333333333< * 6000 The exact same issues apply to \' and \` respectively. I've been using tac -rs \\\` as a convenient "delaying" filter (a filter that behaves like cat but consumes all of its input before writing any output) until it broke for inputs exceeding 8192 bytes. I wasn't using \' because it is much slower. If not bugs, there seems to be at least some kind of inconsistencies in the current behavior that needs to be documented, but let me know if I'm missing something. Thanks.
