From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 15 08:35:59 2015 Received: (at submit) by debbugs.gnu.org; 15 Aug 2015 12:35:59 +0000 Received: from localhost ([127.0.0.1]:56289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZQagp-0006by-Do for submit@debbugs.gnu.org; Sat, 15 Aug 2015 08:35:59 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36275) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZQagm-0006bp-SB for submit@debbugs.gnu.org; Sat, 15 Aug 2015 08:35:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZQagl-0003PV-Rr for submit@debbugs.gnu.org; Sat, 15 Aug 2015 08:35:56 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:45830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQagl-0003PJ-Ps for submit@debbugs.gnu.org; Sat, 15 Aug 2015 08:35:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQagl-00025g-2i for bug-coreutils@gnu.org; Sat, 15 Aug 2015 08:35:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZQagh-0003Ot-U4 for bug-coreutils@gnu.org; Sat, 15 Aug 2015 08:35:55 -0400 Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]:38738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQagh-0003Oj-Ny for bug-coreutils@gnu.org; Sat, 15 Aug 2015 08:35:51 -0400 Received: by wicja10 with SMTP id ja10so43402932wic.1 for ; Sat, 15 Aug 2015 05:35:50 -0700 (PDT) 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:user-agent; bh=GdrYln70Jg/j52f5hqKsa1HSjVRSdlMZ/AxlSJG0gAE=; b=RF4C+FsBuyvDVVImwAIkLcyNq+vP4MnZoG0MQDM/WQi8Ox6RYVgBK2qHYBJVYRkVY9 FPnP4FgDmQIP+8z4n6Fz03MFdtCYMrKSYOVOzozgPnnXYVPZCVbEEaxF30rTQGkNOgbb DVFJK5DeH7sHZk4WNkj4LorvlK8vPXWTX45ZTZVXM0iDnmCIkdnurGz8JFdRc5NPblMZ jobX5VZfayqvYok912EAWUbj596HKBmQx0lEszF7NBnru91gXE+pJYaoeB+WOORLzpVU XTB14EdvAWro59+ZDFJPg6WOXAvb497yyChExIznfJ8mjN/qP6HS0bXN/8rRtr1mTZ9O IIDA== X-Received: by 10.194.60.11 with SMTP id d11mr9470290wjr.143.1439642150770; Sat, 15 Aug 2015 05:35:50 -0700 (PDT) Received: from chaz.gmail.com (05448dab.skybroadband.com. [5.68.141.171]) by smtp.gmail.com with ESMTPSA id x6sm7624815wiy.6.2015.08.15.05.35.49 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 15 Aug 2015 05:35:49 -0700 (PDT) Date: Sat, 15 Aug 2015 13:35:48 +0100 From: Stephane Chazelas To: bug-coreutils@gnu.org Subject: tail -f: inotify being used on non-regular files Message-ID: <20150815123346.GA6625@chaz.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hello, it seems on Linux, GNU tail -f uses inotify to check if data is available even for those types of files where inotify doesn't work. For instance, when running: tail -fn+1 /dev/tty Then press 1234 $ tail -fn+1 /dev/tty 1 1 ^D2 2 ^D3 4 upon the first tail installs an inotify watcher on /dev/tty and tries another read loop. But upon the second , it waits on the inotify watch which will never return because inotify doesn't work on device files. So while 1 and 2 are being displayed, 3 and 4 and anything afterwards are not. That shouldn't be too big of a problem because it's unlikely one would use tail -f on a device and not many devices may return multiple eofs like tty devices do. AFAIK, pipes and sockets can't return more than one eof. But I suppose if one ever wants to use tail -f on non-regular files, that would be for some that do exhibit a multiple-eof behaviour. Work around for now is the undocumented ---disable-inotify option. -- Stephane From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 25 22:14:18 2015 Received: (at 21265) by debbugs.gnu.org; 26 Aug 2015 02:14:18 +0000 Received: from localhost ([127.0.0.1]:38459 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUQED-0004Bp-N5 for submit@debbugs.gnu.org; Tue, 25 Aug 2015 22:14:17 -0400 Received: from mail2.vodafone.ie ([213.233.128.44]:7615) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUQEB-0004Bf-Jm for 21265@debbugs.gnu.org; Tue, 25 Aug 2015 22:14:16 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Am8FALcg3VVtT42t/2dsb2JhbABdgklSgQHDcYJYAoE5TAEBAQEBAYELhCQBAQQyAVYLDQsJFAIPCQMCAQIBRQYBDAgBAYguAbkOjxkBCyCLV4URhCwBBJU3ikGDexWHLQyRPCaDfz2CfwEBAQ Received: from unknown (HELO localhost.localdomain) ([109.79.141.173]) by mail2.vodafone.ie with ESMTP; 26 Aug 2015 03:13:59 +0100 Message-ID: <55DD20E7.5060607@draigBrady.com> Date: Wed, 26 Aug 2015 03:13:59 +0100 From: =?windows-1252?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Stephane Chazelas , 21265@debbugs.gnu.org Subject: Re: bug#21265: tail -f: inotify being used on non-regular files References: <20150815123346.GA6625@chaz.gmail.com> In-Reply-To: <20150815123346.GA6625@chaz.gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 21265 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 15/08/15 13:35, Stephane Chazelas wrote: > Hello, > > it seems on Linux, GNU tail -f uses inotify to check if data is > available even for those types of files where inotify doesn't > work. > > For instance, when running: > > tail -fn+1 /dev/tty > > Then press 1234 > > $ tail -fn+1 /dev/tty > 1 > 1 > ^D2 > 2 > ^D3 > 4 > > upon the first tail installs an inotify watcher on > /dev/tty and tries another read loop. But upon the second > , it waits on the inotify watch which will never return > because inotify doesn't work on device files. So while 1 and 2 > are being displayed, 3 and 4 and anything afterwards are not. > > That shouldn't be too big of a problem because it's unlikely one > would use tail -f on a device and not many devices may return > multiple eofs like tty devices do. AFAIK, pipes and sockets > can't return more than one eof. > > But I suppose if one ever wants to use tail -f on non-regular > files, that would be for some that do exhibit a multiple-eof > behaviour. > > Work around for now is the undocumented ---disable-inotify > option. Yes, quite the edge case. I notice both with and without inotify there is a similar issue (for different reasons) when multiple devices are specified: tail ---dis -f /dev/tty /dev/tty I.E. we generally can't deal with this case in either case, though it probably makes sense in any case to avoid inotify for device nodes? BTW, in the inotify case, theoretically the kernel should be returning an error if the watch events are not supported? The same argument applies that the kernel should return and error when adding a watch on pseudo file systems like /proc? To work around that, we'd have to get real kludgy and see were the files on a "dummy" file system or something. Though tail -f /proc files in either mode is not that useful, so probably not worrying about that case. thanks, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 26 07:20:05 2015 Received: (at 21265) by debbugs.gnu.org; 26 Aug 2015 11:20:06 +0000 Received: from localhost ([127.0.0.1]:38590 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUYkP-0008JM-2V for submit@debbugs.gnu.org; Wed, 26 Aug 2015 07:20:05 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:33398) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUYkM-0008J6-78 for 21265@debbugs.gnu.org; Wed, 26 Aug 2015 07:20:03 -0400 Received: by wijn1 with SMTP id n1so20878564wij.0 for <21265@debbugs.gnu.org>; Wed, 26 Aug 2015 04:20:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=Spz2Nz0cOjAx85sC4cZUr9yX5ASqUoO3H9Etr8EjV8Y=; b=sr9H+fvF3X+HUgwaKNtsnQRj/MPigLpLaIeK4tdVQCzgRX2j5KU5X6X7fRfZfCCSqR xxE6Jo961eaX7LIwXvVM438kh7VHaFPSshffkC/pZAFS46gs/2rX0pzLwitcBG4LWYA9 rgQHtGcAe276WL7i6oYK/lUN9X1qr6RuOJplVg3XxUhb7Y0uOQS7u4mVzig2/jVT7t/2 E9zDt9JqE4I4RY3D3/AXLukaeA4RWhV/JoYmrhJyf9hCbrQBrFRvN4etQeYdejCV0w2/ d1oBaKuniSoX4H+MJLPj5CTTjTT31en731OIQK4wn/pxZOl/e87+/N31w0C0Y/i3E6Lq u1Ng== X-Received: by 10.181.12.20 with SMTP id em20mr12147781wid.28.1440588001440; Wed, 26 Aug 2015 04:20:01 -0700 (PDT) Received: from chaz.gmail.com (05448dab.skybroadband.com. [5.68.141.171]) by smtp.gmail.com with ESMTPSA id o3sm3359682wjx.16.2015.08.26.04.19.59 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 26 Aug 2015 04:20:00 -0700 (PDT) Date: Wed, 26 Aug 2015 12:19:59 +0100 From: Stephane Chazelas To: =?iso-8859-1?Q?P=E1draig?= Brady Subject: Re: bug#21265: tail -f: inotify being used on non-regular files Message-ID: <20150826111959.GA5103@chaz.gmail.com> References: <20150815123346.GA6625@chaz.gmail.com> <55DD20E7.5060607@draigBrady.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <55DD20E7.5060607@draigBrady.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21265 Cc: 21265@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) 2015-08-26 03:13:59 +0100, Pádraig Brady: [...] > I notice both with and without inotify > there is a similar issue (for different reasons) > when multiple devices are specified: > > tail ---dis -f /dev/tty /dev/tty > > I.E. we generally can't deal with this case in either case, > though it probably makes sense in any case to avoid inotify > for device nodes? > > BTW, in the inotify case, theoretically the kernel should be returning > an error if the watch events are not supported? > > The same argument applies that the kernel should return > and error when adding a watch on pseudo file systems like /proc? > To work around that, we'd have to get real kludgy and see > were the files on a "dummy" file system or something. > Though tail -f /proc files in either mode is not that useful, > so probably not worrying about that case. [...] All very good points. Many files in /proc, /sys... can only be read reliably in one read() operation anyway, and doing tail -f on them would give you garbage even if it worked. I guess the best approach would be to only use inotify for regular files, address blocking files (pipe, devices...) when several files are being watched with poll() and/or non-blocking IO, or alarm()/timers or threads, and document the other issues. Or not do anything and just document those limitations as they are mostly edge cases. -- Stephane From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 24 16:57:36 2018 Received: (at 21265) by debbugs.gnu.org; 24 Oct 2018 20:57:36 +0000 Received: from localhost ([127.0.0.1]:40611 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFQDf-0001m0-Oj for submit@debbugs.gnu.org; Wed, 24 Oct 2018 16:57:35 -0400 Received: from mail-pg1-f177.google.com ([209.85.215.177]:42397) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFQDd-0001li-Mh; Wed, 24 Oct 2018 16:57:34 -0400 Received: by mail-pg1-f177.google.com with SMTP id i4-v6so2896947pgq.9; Wed, 24 Oct 2018 13:57:33 -0700 (PDT) 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=Yd1zVGQZ0pQQt9AkgQU8Iku5XOv38RuJDurqjstQuH0=; b=DEtp0o4cn7lzxzVigj6ekxbTptvbN5EJCouOYGNd6GjuvTD0RTAyWzd5Cs8D2jotZg 1Hpx4zYahSe7RFMCOjwNnzNfuGBaPpfntVDKjGDQ8R8W+hFEqAstCYuIQRPhS7qf0LqL Kk0BFhAv2JblU7z8cHjFDsBtkRfwOMAFg49HUA/2YSfLVQimiP1al4uEGkTLYUer2A+E 5N1gVLEyfcNxFAnZJUjYHWdgX84EwXFrPFkHsYdx1FWkYNA8VEfH2VIrz7mz0wa1acQ8 2pTlRmLsfN4sN8//R3yGs+O3uTX7dq57cKYqfFryovSElHzRA+/oSNGp53kn5aoSRGYe fL7A== 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=Yd1zVGQZ0pQQt9AkgQU8Iku5XOv38RuJDurqjstQuH0=; b=iZhgghjQZjn93Y85PdYc8cW9q5yb1LZYatM9UGATTQrr391mZnw4WPON7ULNsaMF6y sEiwaPQGzK6QCJktsFc/nMj3XMio5NyCmk8B1qKa2TibcJaxmgiQepgqVOwDaM3lVegB x7GqCbsJokFyOnEmGFxHYF6nkiVL61bHKU/h7n8e9iKMeW9RuFKknnPYfEhuuUNQcZMk PfG6hMbxqIngw8BXDmJiV7SDJm2rPV84BZYqnC2xzkwsOkJVQKngPwhtrVn0VJ83JLJ/ l/O62cJxegHFkeNcW5fKphfrq8ME8cVEkcMg/cc9G0IFFB6BiVPJsA5jMHOtaKotEhpW xpvA== X-Gm-Message-State: AGRZ1gLLDklQyO3rHQ4cBLhWVIvowbJP4bgeYwhjamCO6+XDYynFxN+5 bOiiO7x0RX/FRy/2uRBMq0Aki2sV9V8= X-Google-Smtp-Source: AJdET5c6xqnalhqsplA5Up4aMUjjVICAHK8v+3DMcZxlcj1BKpRiWH8rRbci9xU3UX82+pBZs4EWrg== X-Received: by 2002:a62:d405:: with SMTP id a5-v6mr4063495pfh.174.1540414647036; Wed, 24 Oct 2018 13:57:27 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id 3-v6sm6207834pga.12.2018.10.24.13.57.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 13:57:25 -0700 (PDT) Subject: Re: bug#21265: tail -f: inotify being used on non-regular files To: 21265@debbugs.gnu.org References: <20150815123346.GA6625@chaz.gmail.com> <55DD20E7.5060607@draigBrady.com> <20150826111959.GA5103@chaz.gmail.com> From: Assaf Gordon Message-ID: <4634019f-3465-a88d-88ff-a9d5e57a966b@gmail.com> Date: Wed, 24 Oct 2018 14:57:24 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20150826111959.GA5103@chaz.gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 21265 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 21265 wontfix close 21265 stop (triaging old bugs) On 26/08/15 05:19 AM, Stephane Chazelas wrote: > 2015-08-26 03:13:59 +0100, Pádraig Brady: > [...] >> >> The same argument applies that the kernel should return >> and error when adding a watch on pseudo file systems like /proc? >> To work around that, we'd have to get real kludgy and see >> were the files on a "dummy" file system or something. [...] >> Though tail -f /proc files in either mode is not that useful, >> so probably not worrying about that case. > [...] > > All very good points. > > Many files in /proc, /sys... can only be read reliably in one read() > operation anyway, and doing tail -f on them would give you > garbage even if it worked. Given the above, and no further comments in 3 years, I'm closing this bug. -assaf From unknown Tue Aug 19 23:13:42 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 22 Nov 2018 12:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator