#1039042 coreutils: tail: on blockdevs reads the whole thing, doesn't on files of the same size

Package:
coreutils
Source:
coreutils
Description:
GNU core utilities
Submitter:
наб
Date:
2023-06-24 23:21:04 UTC
Severity:
normal
#1039042#5
Date:
2023-06-24 23:17:10 UTC
From:
To:
Dear Maintainer,

$ cp --sparse=always /dev/zvol/filling/store/nabijaczleweli/vm-zoot /tmp/
$ time tail /dev/zvol/filling/store/nabijaczleweli/vm-zoot | b2sum
11d28bd10ad4d4ae652e02aaaa6f59f1ef5ff5f44111e3e3c80d5ae01f666e00f38d626784539b9f095255a246d9b6b56624fd08c8916a10b16e7b5b6560d7f1  -

real    0m17.235s
user    0m1.344s
sys     0m9.693s
$ time tail /tmp/vm-zoot | b2sum
11d28bd10ad4d4ae652e02aaaa6f59f1ef5ff5f44111e3e3c80d5ae01f666e00f38d626784539b9f095255a246d9b6b56624fd08c8916a10b16e7b5b6560d7f1  -

real    0m0.005s
user    0m0.005s
sys     0m0.004s
$ time cat /dev/zvol/filling/store/nabijaczleweli/vm-zoot | tail | b2sum
11d28bd10ad4d4ae652e02aaaa6f59f1ef5ff5f44111e3e3c80d5ae01f666e00f38d626784539b9f095255a246d9b6b56624fd08c8916a10b16e7b5b6560d7f1  -

real    0m17.271s
user    0m1.620s
sys     0m17.504s

Somehow I feel there's no reason that tail couldn't lseek(SEEK_END) on a
blockdev just as well as it can do on a regular file.

Best,
наб