Subject: bug#60215: tail -c +XX on newer coreutils wants FILE

From: Chris Elvidge <[email-masked]>
Date: Tue, 20 Dec 2022 12:07:10 +0000

On 20/12/2022 09:30, Arkadiusz Miśkiewicz via GNU coreutils Bug Reports 
wrote:
> 
> # echo tessdfdsdsfdsfdsfdsfsdft | tail -c +13
> sfdsfdsfsdft
> # tail --version
> tail (GNU coreutils) 8.32
> Copyright (C) 2020 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later 
> <https://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> 
> Written by Paul Rubin, David MacKenzie, Ian Lance Taylor,
> and Jim Meyering.
> 
> 
> while on newer version:
> 
> $ echo tessdfdsdsfdsfdsfdsfsdft | tail -c +13
> tail: cannot open '+13' for reading: No such file or directory
> $ tail --version
> tail (GNU coreutils) 9.1
> Copyright (C) 2022 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later 
> <https://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> 
> Written by Paul Rubin, David MacKenzie, Ian Lance Taylor,
> and Jim Meyering.
> 
> 
> Looking at NEWS but don't see any behaviour change info, so I guess it's 
> a bug.
> 

Works OK here. -c [+]13 includes the trailing newline (see hexdump below)

$ bash --version
GNU bash, version 5.2.15(1)-release (x86_64-slackware-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ tail --version
tail (GNU coreutils) 9.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Rubin, David MacKenzie, Ian Lance Taylor,
and Jim Meyering.

[0] slack15-a!chris:(pts/1):Tue 20 Dec 2022 11:44 am GMT:/home/chris
$ echo tessdfdsdsfdsfdsfdsfsdft | tail -c +13
sfdsfdsfsdft

[0] slack15-a!chris:(pts/1):Tue 20 Dec 2022 11:45 am GMT:/home/chris
$ echo tessdfdsdsfdsfdsfdsfsdft | tail -c 13
sfdsfdsfsdft

[0] slack15-a!chris:(pts/1):Tue 20 Dec 2022 11:48 am GMT:/home/chris
$ tail -c +13 <<<'tessdfdsdsfdsfdsfdsfsdft'
sfdsfdsfsdft

[0] slack15-a!chris:(pts/1):Tue 20 Dec 2022 11:50 am GMT:/home/chris
$ tail -c13 <<<'tessdfdsdsfdsfdsfdsfsdft'
sfdsfdsfsdft

[0] slack15-a!chris:(pts/1):Tue 20 Dec 2022 11:55 am GMT:/home/chris
$ tail -c13 <<<'tessdfdsdsfdsfdsfdsfsdft' | hexdump -c
0000000   s   f   d   s   f   d   s   f   s   d   f   t  \n
000000d

-- 

Chris Elvidge