X-Loop: help-debbugs@HIDDEN Subject: bug#19765: tail -F stops watching when read permissions are removed Resent-From: Stephane Chazelas <stephane.chazelas@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-coreutils@HIDDEN Resent-Date: Wed, 04 Feb 2015 10:23:01 +0000 Resent-Message-ID: <handler.19765.B.14230453466701 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 19765 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 19765 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.14230453466701 (code B ref -1); Wed, 04 Feb 2015 10:23:01 +0000 Received: (at submit) by debbugs.gnu.org; 4 Feb 2015 10:22:26 +0000 Received: from localhost ([127.0.0.1]:33443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1YIx6I-0001k1-8f for submit <at> debbugs.gnu.org; Wed, 04 Feb 2015 05:22:26 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35958) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <stephane.chazelas@HIDDEN>) id 1YIx6G-0001jp-Tp for submit <at> debbugs.gnu.org; Wed, 04 Feb 2015 05:22:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <stephane.chazelas@HIDDEN>) id 1YIx6A-00020J-TZ for submit <at> debbugs.gnu.org; Wed, 04 Feb 2015 05:22:19 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:49932) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <stephane.chazelas@HIDDEN>) id 1YIx6A-0001zr-Qv for submit <at> debbugs.gnu.org; Wed, 04 Feb 2015 05:22:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37673) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <stephane.chazelas@HIDDEN>) id 1YIx69-00062z-BY for bug-coreutils@HIDDEN; Wed, 04 Feb 2015 05:22:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <stephane.chazelas@HIDDEN>) id 1YIx66-0001pT-5T for bug-coreutils@HIDDEN; Wed, 04 Feb 2015 05:22:17 -0500 Received: from mail-we0-x22d.google.com ([2a00:1450:400c:c03::22d]:53454) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <stephane.chazelas@HIDDEN>) id 1YIx65-0001o6-T6 for bug-coreutils@HIDDEN; Wed, 04 Feb 2015 05:22:14 -0500 Received: by mail-we0-f173.google.com with SMTP id w62so840059wes.4 for <bug-coreutils@HIDDEN>; Wed, 04 Feb 2015 02:22:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:content-transfer-encoding:user-agent; bh=wkhz79CxpPoYaU0UZxeu7ssoP0sZkopoi/kx9Ydd9fc=; b=wAXp5pL9mhwxPKDUPV+uzjGMf/g04n7vdO394CRmeWVQW4Ia9x8m8kBg8Rqsi3wNIT 4KbQI4j/0BedI37BwNqOp8QBhcolUJsgz0DGbzl6IQlxyIBtyIZhABg4dcEkP3nJ/uGB d9uOu883qADEjqO2lfyW5jNsfmtiub8wmMPzON3e43jYjfPoQTAy3XTvzG6HlqHFBRG4 lFlsOp9lLlIQIZ12ZsiWfpr2BnosX8XSKZ6W4b2ta4NCNarvzGnPYi2TkI6mb6hk7ASA TxxnyTtdTcUWvtX8upBsREypx8PNBi4KtQntmy44Hqu9xbGhtzcAXnZRARzpbVxo3Ubj hd6A== X-Received: by 10.180.37.197 with SMTP id a5mr43784955wik.2.1423045333206; Wed, 04 Feb 2015 02:22:13 -0800 (PST) Received: from chaz.gmail.com (5ec33bc9.skybroadband.com. [94.195.59.201]) by mx.google.com with ESMTPSA id eb10sm2539515wib.13.2015.02.04.02.22.12 for <bug-coreutils@HIDDEN> (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 04 Feb 2015 02:22:12 -0800 (PST) Date: Wed, 4 Feb 2015 10:22:11 +0000 From: Stephane Chazelas <stephane.chazelas@HIDDEN> Message-ID: <20150204102211.GB6648@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.15 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.0 (----) When watchnig a file by name with "tail -F", if read permissions are removed, tail stops watching even though it has a file descriptor open on the file. With inotify: $ : > file $ tail -F file & [1] 20796 $ exec 3>> file $ echo 1 >&3 1 $ chmod 0 file tail: % cannot watch ‘file’: Permission denied tail: ‘file’ has become inaccessible: Permission denied $ echo 2 >&3 ## not detected at this point $ chmod +r file tail: ‘file’ has become accessible # new content not displayed yet. $ echo 3 >&3 1 ## all lines displayed 2 3 Without inotify: $ : > file $ tail -F ---disable-inotify file & [1] 20903 $ exec 3>> file $ echo 1 >&3 1 $ chmod 0 file $ echo 2 >&3 2 # not detected yet $ tail: ‘file’ has become inaccessible: Permission denied $ echo 3 >&3 $ chmod +r file $ tail: ‘file’ has become accessible 1 2 3 (same except there's a delay before tail detects the file is no longer readable). Note that the file in that case is still accessible, one can still do a stat() on it to check that the file is still the same one. That's different from when one of the directory components becomes unreadable/unsearchable, in which case tail can't tell if it's still reading the right file as in: tail -F foo/bar & chmod 0 foo There, tail still has an open file descriptor to foo/bar, but can't tell if it still points to the "foo/bar" file, so it's acceptable for it to stop watching in that case. With inotify though, it doesn't unless the file attributes are changed (chmod...) or the file is renamed. I think I'll raise a separate bug report for that and directory components being renamed. [tested with git head] -- Stephane
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Stephane Chazelas <stephane.chazelas@HIDDEN> Subject: bug#19765: Acknowledgement (tail -F stops watching when read permissions are removed) Message-ID: <handler.19765.B.14230453466701.ack <at> debbugs.gnu.org> References: <20150204102211.GB6648@HIDDEN> X-Gnu-PR-Message: ack 19765 X-Gnu-PR-Package: coreutils Reply-To: 19765 <at> debbugs.gnu.org Date: Wed, 04 Feb 2015 10:23:01 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-coreutils@HIDDEN If you wish to submit further information on this problem, please send it to 19765 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 19765: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D19765 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#19765: tail -F stops watching when read permissions are removed Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady <P@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-coreutils@HIDDEN Resent-Date: Thu, 05 Feb 2015 13:08:02 +0000 Resent-Message-ID: <handler.19765.B19765.142314167823581 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 19765 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Stephane Chazelas <stephane.chazelas@HIDDEN>, 19765 <at> debbugs.gnu.org Received: via spool by 19765-submit <at> debbugs.gnu.org id=B19765.142314167823581 (code B ref 19765); Thu, 05 Feb 2015 13:08:02 +0000 Received: (at 19765) by debbugs.gnu.org; 5 Feb 2015 13:07:58 +0000 Received: from localhost ([127.0.0.1]:34583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1YJMA1-00068H-NS for submit <at> debbugs.gnu.org; Thu, 05 Feb 2015 08:07:58 -0500 Received: from mail2.vodafone.ie ([213.233.128.44]:59413) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <P@HIDDEN>) id 1YJM9y-000681-RI for 19765 <at> debbugs.gnu.org; Thu, 05 Feb 2015 08:07:55 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmoFAChq01RtTD0E/2dsb2JhbABagwaDXU/CbYJPAoElQwEBAQEBfYQNAQUjDwFWCw0LAgIFFgsCAgkDAgECAUUGAQwIAQGILQG/U4VpkEkBCyCBIY5egmiBQQWZVYEhhB0LjAoig24+gnMBAQE Received: from unknown (HELO localhost.localdomain) ([109.76.61.4]) by mail2.vodafone.ie with ESMTP; 05 Feb 2015 13:07:47 +0000 Message-ID: <54D36B22.6080803@HIDDEN> Date: Thu, 05 Feb 2015 13:07:46 +0000 From: =?UTF-8?Q?P=C3=A1draig?= Brady <P@HIDDEN> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 References: <20150204102211.GB6648@HIDDEN> In-Reply-To: <20150204102211.GB6648@HIDDEN> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.15 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: 0.0 (/) On 04/02/15 10:22, Stephane Chazelas wrote: > When watchnig a file by name with "tail -F", if read permissions > are removed, tail stops watching even though it has a file > descriptor open on the file. > > With inotify: > > $ : > file > $ tail -F file & > [1] 20796 > $ exec 3>> file > $ echo 1 >&3 > 1 > $ chmod 0 file > tail: % cannot watch ‘file’: Permission denied > tail: ‘file’ has become inaccessible: Permission denied > $ echo 2 >&3 ## not detected at this point > $ chmod +r file > tail: ‘file’ has become accessible > # new content not displayed yet. > $ echo 3 >&3 > 1 ## all lines displayed > 2 > 3 > > Without inotify: > > $ : > file > $ tail -F ---disable-inotify file & > [1] 20903 > $ exec 3>> file > $ echo 1 >&3 > 1 > $ chmod 0 file > $ echo 2 >&3 > 2 # not detected yet > $ tail: ‘file’ has become inaccessible: Permission denied > > $ echo 3 >&3 > $ chmod +r file > $ tail: ‘file’ has become accessible > 1 > 2 > 3 > > (same except there's a delay before tail detects the file is no longer > readable). > > Note that the file in that case is still accessible, one can > still do a stat() on it to check that the file is still the same > one. That's different from when one of the directory components > becomes unreadable/unsearchable, in which case tail can't tell > if it's still reading the right file as in: > > tail -F foo/bar & > chmod 0 foo > > There, tail still has an open file descriptor to foo/bar, but > can't tell if it still points to the "foo/bar" file, so it's > acceptable for it to stop watching in that case. > > With inotify though, it doesn't unless the file attributes are > changed (chmod...) or the file is renamed. I think I'll raise a > separate bug report for that and directory components being > renamed. > > [tested with git head] > Handling of files that only change perms is awkward. In the inotify case we don't close the associated watch descriptor so continue to process events, though ignore them as we've closed the file. Another problem in this situation with inotify is that write events between the chmod a-r and a+r are lost, thus not outputting new data until the next write event. Another larger problem in this situation with and without inotify is that the whole file is output, when tail outputs next. That's documented as a FIXME-maybe in the code. thanks, Pádraig.
Received: (at control) by debbugs.gnu.org; 23 Oct 2018 01:45:10 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 22 21:45:10 2018 Received: from localhost ([127.0.0.1]:36568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1gElks-0001wm-5u for submit <at> debbugs.gnu.org; Mon, 22 Oct 2018 21:45:10 -0400 Received: from mail-it1-f175.google.com ([209.85.166.175]:55574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <assafgordon@HIDDEN>) id 1gElkq-0001pR-Fj for control <at> debbugs.gnu.org; Mon, 22 Oct 2018 21:45:08 -0400 Received: by mail-it1-f175.google.com with SMTP id c23-v6so26500itd.5 for <control <at> debbugs.gnu.org>; Mon, 22 Oct 2018 18:45:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:message-id:date:user-agent:mime-version:content-language :content-transfer-encoding; bh=LnhGQNZJC+0CeZqi8roVKZguFl6EWgl0mX67yOaEh+g=; b=Tiy78of29TUotWJ9Ab4+JDy6IwBPJrhIxlw5bsXDFo60lMA/hdmVYKpt42n9W1BX6B JXtX6NVcvf/U0ZbGA5mLs/u9g40mh7Ak6Mv2pDBUl53oX3i421DXueBB5TEXpNwD31IZ gehcIpkPgFNeSyGWsUB053RSxqrbCWtOxPXjWrgO08C8uO743MJG5e34mEgMQvmPQV5v sqyc/C01yLCuG8EK3Opj/fJkv5xHyRv01iuh4ojn9ETz7bHCXhh7r6RfbrD2QM2kmfNT SMWDm6+5xbMGVrn8o0WyOfvST9P16uGLM4GrigwoFlT/v4U5Gnq8AttJXTI3QKkrltsx /OKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=LnhGQNZJC+0CeZqi8roVKZguFl6EWgl0mX67yOaEh+g=; b=NQ2C0bp4mhEEWgmE2Y+Gx/HrFBtAFksR41LHD0BWhtZrvnlLl68b8K0wfzg/wtiHxq xwSa+PU60djxIlsEsfaP/T7c8zivA4VHehUl5jp3aT+0y+c91GTMOiOEZ8ksYZqzeqno tVNiBCwR9OvTPcg3EF3pvSLOjls4squyddeYKyaA3KDXkV6E7hpgr8tXVh6kQCFCc01E mm+667+mbAoCsFd74WR+2n+rwLVlqZ7+qwRLFCaNCYrxazqAccV3T3tlqnYEdu7dn8JE gb/pMkLoOD02d9zT6VOWZ15NI1Kgo4t4adWYekRUOpJ8gBSaUGggL/lsUjUXS4Tcs9gm jc0g== X-Gm-Message-State: AGRZ1gKdW4Pn4M5rlusxo0tUZ7oRH2xUwLiToOHRNF1g6y9zsd77X1cb a5FupSugI5fMwA5BHQglMkXj+SUC X-Google-Smtp-Source: AJdET5etrdcaQAkD/LU2L+MYPgv8jR0qf9snGxi/ZUZ1tAeNCdzIEsHKI7R6NpCpZRfRk0pwwkTWyA== X-Received: by 2002:a24:6c14:: with SMTP id w20-v6mr3415698itb.103.1540259102489; Mon, 22 Oct 2018 18:45:02 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id e78-v6sm6298412itc.4.2018.10.22.18.45.01 for <control <at> debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Oct 2018 18:45:01 -0700 (PDT) To: control <at> debbugs.gnu.org From: Assaf Gordon <assafgordon@HIDDEN> Message-ID: <35c22f46-e641-7e98-fa9c-4865f5d0e455@HIDDEN> Date: Mon, 22 Oct 2018 19:45:00 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: severity 19765 wishlist [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.166.175 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (assafgordon[at]gmail.com) 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: control 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 (+) severity 19765 wishlist
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.