GNU bug report logs - #32198
tail -f -F unexpected behavior

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Reported by: Matthew Guidry <mguid2088@HIDDEN>; Keywords: notabug; Done: Assaf Gordon <assafgordon@HIDDEN>; Maintainer for coreutils is bug-coreutils@HIDDEN.
bug closed, send any further explanations to 32198 <at> debbugs.gnu.org and Matthew Guidry <mguid2088@HIDDEN> Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) notabug. Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 32198 <at> debbugs.gnu.org:


Received: (at 32198) by debbugs.gnu.org; 18 Jan 2019 21:34:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 18 16:34:06 2019
Received: from localhost ([127.0.0.1]:37085 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gkbmA-0001d3-CG
	for submit <at> debbugs.gnu.org; Fri, 18 Jan 2019 16:34:06 -0500
Received: from mail-pg1-f181.google.com ([209.85.215.181]:37116)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <assafgordon@HIDDEN>)
 id 1gkbm5-0001cJ-QO; Fri, 18 Jan 2019 16:34:02 -0500
Received: by mail-pg1-f181.google.com with SMTP id c25so6651183pgb.4;
 Fri, 18 Jan 2019 13:34:01 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-language:content-transfer-encoding;
 bh=xW38NIHK848cvzD9eajV3BmtsCa+SjkFxLquHZOLzk8=;
 b=J/OmLJMZqxViWtnVDLmVjXrfm4xewssWWprWqtZ0Uhf0P95Lc8C0biUJq7Rn37WPJv
 vH2x7iqGTQSLUjmaoqgQSjcTHVasSZ+8eN8Jfx6Jnwbb5xzPp9Tn2RuMsVymndnWK/qt
 60W77ernvkRoUpKvdVxLinDl1l6JjzeNHxShDoV1UvoTPlJPj41/r9Ldf09TlzB3Cgxz
 JC4Tz23RJc1i2hpLtSt851kj5lP9l5vsjMb26/Qhh5lTixN+ZKlGbYOovIfcphIO/9k3
 rayfTePccipN5APHgooMiRUQexDc+SDNciffjvAlaU5xNUICanirBnKA1265iKHSF62Y
 TB0A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=xW38NIHK848cvzD9eajV3BmtsCa+SjkFxLquHZOLzk8=;
 b=JlEsfZUtiRnlsTKPPfN+8R2uAVlAwOqo8LJD+vTKMKeAms1EQdREZf8nyI5VEmw8hS
 SvpvS/+yEf5fyL3hU7qO625u9MgtqSpmhW75hKUb+1hwH7KUj0lcZJnuikfdKa7vz1xV
 M/PRT4j5/rPOqO7V2TRpFbBDB3w/eSa0ex4trVIYgl9RIo8KLxVftcvPV/2EFzWWi+Ts
 OjpL5tfl4IbRYZV+AMnTRWthV6KRbND2/h4I2sUZMEKK0HT/a1UKoi5MTo8evZunnBeP
 IoP0XJ0YIwa2cnzfLDgwGA0iQu7rhpYgMCq5fyd6Y5GrYMN4u2E/NoVFGtAsn5Uj/ZXu
 TmcA==
X-Gm-Message-State: AJcUukdqpFuP/XY8mfzvjTYoyQ1WTIb6vHSXce+Jxx02+grbHKmLZVC7
 tGWNfIBLE9i7vQaAzRsiDm5PQOo6P4c=
X-Google-Smtp-Source: ALg8bN6tfHpLHmD1au1MV5jHBe6BH0Ntu64DoNizbqF78fOr4oAXbCpZzawjPeWdo7XYEtepnTKJHA==
X-Received: by 2002:a65:448a:: with SMTP id l10mr19341289pgq.387.1547847235350; 
 Fri, 18 Jan 2019 13:33:55 -0800 (PST)
Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38])
 by smtp.googlemail.com with ESMTPSA id
 w5sm7349584pfn.89.2019.01.18.13.33.52
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 18 Jan 2019 13:33:53 -0800 (PST)
Subject: Re: bug#32198: tail -f -F unexpected behavior
To: Matthew Guidry <mguid2088@HIDDEN>, 32198 <at> debbugs.gnu.org
References: <CAG-KojoqeTdw8EmtzytBcKmhgiHuSt+VWN-j9wsr2zi7GjTkGQ@HIDDEN>
From: Assaf Gordon <assafgordon@HIDDEN>
Message-ID: <b8da2660-e7de-455e-29c5-a33460bfe6cc@HIDDEN>
Date: Fri, 18 Jan 2019 14:33:51 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.4.0
MIME-Version: 1.0
In-Reply-To: <CAG-KojoqeTdw8EmtzytBcKmhgiHuSt+VWN-j9wsr2zi7GjTkGQ@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 32198
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

tags 32198 notabug
close 32198
stop

Hello,

It seems your message has not been replied to in a long while.
Sorry about that.

On 2018-07-18 8:24 a.m., Matthew Guidry wrote:
> I was doing some experimentation with nano v2.9.3 and tail,
> watching the output of tail after saving in nano and encountered some
> strange behavior.

This is not a bug at all (not in tail nor in nano).

It is the result of updating a file in-place (i.e. changing existing
bytes) which 'tail' already consumed.

> I had two terminals open side by side; one with nano and one with tail.
> I opened a file called test.txt in nano and saved with ^w in the first
> terminal.
> I went to the second terminal and ran tail -f test.txt to watch the file.
> 
> I went back to the nano terminal and returned twice and saved.
> The tail terminal reports this change properly.
> With the file still open in nano, I write any number of characters and save.
> 
> The tail terminal reports this change But skips the first character.
To better see what happens, open a third terminal,
and run the following command (after initially saving the file):

     watch -n1 od -tc test.txt

Which will show the content of the file, updated once a second.

I will use a similar but slightly different flow:

1. When you first save (in nano) the file, it is empty.
The "od" terminal will show:

     0000000

2. Type "12345" (don't press ENTER), and save (ctrl-O).
The "od" terminal will show:

    0000000  1   2   3   4   5  \n
    0000006

The "tail" terminal will show:

    12345

AND the cursor in the "tail" terminal will go to the next line
(as there is a newline in the file).


3. Still in nano, on the same line, type "67890" (don't press ENTER),
and save (CTRL-O).
The "od" terminal will show:

   0000000   1   2   3   4   5   6   7   8   9   0  \n
   0000011

The "tail" terminal will show:

   12345
   7890

Here, the "6" character was not displayed by "tail".
The reason is that that character in offset 6 of the file used to be a
newline, and "tail" already consumed it.
When the line was changed, nano went back and changed existing data in
the file (or re-wrote the file completely - not sure about the 
implementation). "tail" has no way to detect that or "go back" in the file.

This is a carefully constructed example, where the data change is
small enough so that that "tail" almost doesn't notice it.

If you make larger changes, or delete some parts of the file,
nano will rewrite the file completely and "tail" will issue a warning 
such as:
     tail: test.txt: file truncated
and then re-read the file.

As such I'm closing this as "not a bug", but discussion can continue
by replying to this thread.

regards,
  - assaf












Information forwarded to bug-coreutils@HIDDEN:
bug#32198; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 Jul 2018 15:20:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 18 11:20:38 2018
Received: from localhost ([127.0.0.1]:47096 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ffoFq-0007o4-5W
	for submit <at> debbugs.gnu.org; Wed, 18 Jul 2018 11:20:38 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41749)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mguid2088@HIDDEN>) id 1ffnNP-0006Oa-GU
 for submit <at> debbugs.gnu.org; Wed, 18 Jul 2018 10:24:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mguid2088@HIDDEN>) id 1ffnNJ-0001Ja-Gw
 for submit <at> debbugs.gnu.org; Wed, 18 Jul 2018 10:24:18 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: *
X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_50,
 FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,T_DKIM_INVALID
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:44452)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <mguid2088@HIDDEN>) id 1ffnNJ-0001JR-CE
 for submit <at> debbugs.gnu.org; Wed, 18 Jul 2018 10:24:17 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:60945)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mguid2088@HIDDEN>) id 1ffnNI-0008CM-Av
 for bug-coreutils@HIDDEN; Wed, 18 Jul 2018 10:24:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mguid2088@HIDDEN>) id 1ffnNH-0001IT-G7
 for bug-coreutils@HIDDEN; Wed, 18 Jul 2018 10:24:16 -0400
Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:46057)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <mguid2088@HIDDEN>) id 1ffnNH-0001Hd-7d
 for bug-coreutils@HIDDEN; Wed, 18 Jul 2018 10:24:15 -0400
Received: by mail-wr1-x429.google.com with SMTP id c4-v6so4875564wrs.12
 for <bug-coreutils@HIDDEN>; Wed, 18 Jul 2018 07:24:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:from:date:message-id:subject:to;
 bh=pQOFUUyG4a3YaP89ehjP8p0a9do7ZT67RIOn7XYtJlU=;
 b=pdbL/4fvkdiTYiedaqpJD04XeC2yu7jt5/h2G2ASHcGUkLMEacQEZsJWb+wbu0hm7Z
 HzWCxnXEFTJ0knGaDd0b7aG3Uf/Ocr0aUy6t5r6+Wan+nyPthCAgEZf8JUYXutvBL0M+
 TSrqqnbBWBN1+Jc7bAIdWa+zmGqSmtKhot6H8wyTQ5OOkF1ch/D6gn6MiciahxhaDVqj
 YbK9VKmmAf5XAcU/kQvC2WSI4mvJ9zov5mpBtEIDsltGBWEE6gJoN6LrYh6fw0LDNtjQ
 AYNym6NVeJl2K0OBRcJ09GrKBDubWr0ZeoEHRD2HhiZ4G2VuAFGqpCtWodQO6lHSIHcz
 ELwg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=pQOFUUyG4a3YaP89ehjP8p0a9do7ZT67RIOn7XYtJlU=;
 b=h9ktHM0m43MdgG0PlVNL7a/xk5RHgYskVqIthpve1oIlJZ9NYkn209SEpux2ZobdAd
 jMm8iEGgKkUPXbnvZvKOIwTCQYjB2tvOptwtidDAIOPo35XNrRJp0rNlF7h5CHwLS+SX
 EZ3XEosYv5hTRbpEwABrJEG915NYD+28xEPDKKeVB5TcaNbmmmhIVw3XXlpOqI1R1F79
 hZEYmje9rCDZIyoqLbX+1TbqVHLDhTVyONEbsjq3QKuFcV33E2GPm8b/p3i4fEcEMDwP
 WrGyS2vMopIsCpU40a25ri/73ez62iL+xJopMUannPnPXUnnhcEzERyLolDP5hAWtHn3
 LDnQ==
X-Gm-Message-State: AOUpUlFMxvhHNZkNoWAy3UnE1dyMGi5xQ7f9+FVVbE1WUDdK2xZb2n98
 xAyMFppkrB0HSkf8WbTqmNm9GYckDCltST2Q+GA=
X-Google-Smtp-Source: AAOMgpc7a4mvON5ThM1rZ2ECejwHF+MrZya34a9CQ3fYdI4y9nn/urzmf5mc2UzT7TN20xeJSa+aSDL6xzcTgP3jvcY=
X-Received: by 2002:adf:dfcd:: with SMTP id
 q13-v6mr4542249wrn.113.1531923853483; 
 Wed, 18 Jul 2018 07:24:13 -0700 (PDT)
MIME-Version: 1.0
From: Matthew Guidry <mguid2088@HIDDEN>
Date: Wed, 18 Jul 2018 09:24:02 -0500
Message-ID: <CAG-KojoqeTdw8EmtzytBcKmhgiHuSt+VWN-j9wsr2zi7GjTkGQ@HIDDEN>
Subject: tail -f -F unexpected behavior
To: bug-coreutils@HIDDEN
Content-Type: multipart/alternative; boundary="0000000000001c20b7057146d1fd"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -3.8 (---)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Wed, 18 Jul 2018 11:20:37 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.8 (----)

--0000000000001c20b7057146d1fd
Content-Type: text/plain; charset="UTF-8"

This is for tail v8.28 encountered on Ubuntu 18.04.

I was doing some experimentation with nano v2.9.3 and tail,
watching the output of tail after saving in nano and encountered some
strange behavior.

I had two terminals open side by side; one with nano and one with tail.
I opened a file called test.txt in nano and saved with ^w in the first
terminal.
I went to the second terminal and ran tail -f test.txt to watch the file.

I went back to the nano terminal and returned twice and saved.
The tail terminal reports this change properly.
With the file still open in nano, I write any number of characters and save.

The tail terminal reports this change But skips the first character. I also
tested this with -F.

This may not be an issue because it only happens when using the
write(ctrl-o, ctrl-s) in nano and not closing the file.

I have reproduced this on two machines.

--0000000000001c20b7057146d1fd
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">This is for tail v8.28 encountered on Ubuntu 18.04.<div><b=
r></div><div>I was doing some experimentation with nano v2.9.3 and tail,</d=
iv><div>watching the output of tail after saving in nano and encountered so=
me strange behavior.</div><div><br></div><div>I had two terminals open side=
 by side; one with nano and one with tail.</div><div>I opened a file called=
 test.txt in nano and saved with ^w in the first terminal.</div><div>I went=
 to the second terminal and ran tail -f test.txt to watch the file.</div><d=
iv><br></div><div>I went back to the nano terminal and returned twice and s=
aved.</div><div>The tail terminal reports this change properly.</div><div>W=
ith the file still open in nano, I write any number of characters and save.=
</div><div><br></div><div>The tail terminal reports this change But skips t=
he first character. I also tested this with -F.</div><div><br></div><div>Th=
is may not be an issue because it only happens when using the write(ctrl-o,=
 ctrl-s) in nano and not closing the file.</div><div><br></div><div>I have =
reproduced this on two machines.</div><div><br></div><div><br></div></div>

--0000000000001c20b7057146d1fd--




Acknowledgement sent to Matthew Guidry <mguid2088@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#32198; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 18 Jan 2019 21:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.