On 22/06/2023 21:14, наб wrote:
Package: coreutils
Version: 9.1-1
Severity: normal

Dear Maintainer,

-- >8 --
$ ls -l sel.c
-rw-rw-r-- 1 nabijaczleweli users 193 Jun 24  2021 sel.c
$ tail -c +200 -f sel.c
tail: sel.c: file truncated
#include <selinux/selinux.h>
#include <stdio.h>
int main() {
        printf("%d\n", is_selinux_enabled());
        char * con = 0x12345;
        printf("%d\n", getcon(&con));
        printf("%s\n", con);
        freecon(con);
}
(now it sleeps and processes -f normally)
-- >8 --

This is, obviously, wrong. Not least because sel.c wasn't truncated,
but also because the #include is byte 1, not 200.

tail is using a heuristic here and determines
the file was truncated in this case and thus shows
the whole contents of the "new" file.

The particular race significant here was discussed at:
https://lists.gnu.org/r/bug-textutils/2003-05/msg00007.html

cheers,
Pádraig

Reply via email to