From owner-freebsd-questions@FreeBSD.ORG Thu Dec 20 10:35:50 2007 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E86E616A46B for ; Thu, 20 Dec 2007 10:35:50 +0000 (UTC) (envelope-from m.boyarov@bsd.by) Received: from mx1.cybernet.by (mail.cybernet.by [212.98.164.131]) by mx1.freebsd.org (Postfix) with ESMTP id A5A1713C4D5 for ; Thu, 20 Dec 2007 10:35:50 +0000 (UTC) (envelope-from m.boyarov@bsd.by) Received: from mx1.cybernet.by (mx1.cybernet.by [127.0.0.10]) by mx1.cybernet.by (Postfix) with ESMTP id 499A0CDF5B8; Thu, 20 Dec 2007 12:31:32 +0200 (EET) Received: from solar.bsd.by (dragonsoul.aichyna.com [87.252.248.30]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.cybernet.by (Postfix) with ESMTP id 304DACDF587; Thu, 20 Dec 2007 12:31:32 +0200 (EET) Received: by solar.bsd.by (Postfix, from userid 1001) id 449BB22860; Thu, 20 Dec 2007 12:35:32 +0200 (EET) X-Comment-To: Mikhail Teterin To: Mikhail Teterin References: <200712192322.lBJNMfps053071@aldan.algebra.com> <200712200458.27988@aldan> <86wsr98ylt.fsf@bsd.by> <200712200516.30702@aldan> From: m.boyarov@bsd.by (Max N. Boyarov) In-Reply-To: <200712200516.30702@aldan> (Mikhail Teterin's message of "Thu, 20 Dec 2007 05:16:30 -0500") X-Mailer: Gnus v5.11/GNU Emacs 22.1 Date: Thu, 20 Dec 2007 12:35:28 +0200 Message-ID: <86ejdh4psf.fsf@bsd.by> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Virus-Scanned: ClamAV Cc: questions@freebsd.org Subject: Re: tail does not exit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2007 10:35:51 -0000 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>>>> "MT" =3D=3D Mikhail Teterin writes: MT> On =D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80 20 =D0=B3=D1=80=D1=83=D0=B4= =D0=B5=D0=BD=D1=8C 2007, Max N. Boyarov wrote: MT> =3D after something writeln to /var/log/messages tail get SIGPIPE MT> But why is that needed for tail to notice? It is trying to output 10 l= ines. MT> After it outputs the very first one of them, awk exits, and the 9 subs= equent=20 MT> lines go into thin air /without tail noticing/. =20 MT> Is not that a bug in itself? Tail write buffer at all, i.e. all 10 lines writes to pipe. $ cat test=20=20=20 line1 line2 line3 line4 line5 line6 line7 line8 line9 line10 line11 tail -f test | awk '{print "Exiting" $1; exit 0}' open("test", O_RDONLY) =3D 3 fstat(3, {st_mode=3DS_IFREG|0644, st_size=3D68, ...}) =3D 0 syscall_477(0, 0x44, 0x1, 0x1, 0x3, 0, 0) =3D 0x28175000 write(1, "line2\nline3\nline4\nline5\nline6\nli"..., 62Exitingline2 ) =3D 62 fstat(3, {st_mode=3DS_ISUID|S_ISVTX|070, st_size=3D0, ...}) =3D 0 syscall_478(0x3, 0, 0, 0x1) =3D 0 syscall_478(0x3, 0, 0, 0) =3D 0 read(3, "line1\nline2\nline3\nline4\nline5\nli"..., 4096) =3D 68 ^^^^^^^^^^^^^^^^^^^^^^ write buff ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ munmap(0x28175000, 68) =3D 0 read(3, "", 4096) =3D 0 kqueue(0x28172d40) =3D 4 syscall_397(0x3, 0xbfbfe44c) =3D 0 kevent(0x4, 0x28205040, 0x1, 0, 0, 0xbfbfe624) =3D 0 kevent(0x4, 0, 0, 0x28205040, 0x1, 0) =3D 1 read(3, "line++\n", 4096) =3D 7 ^^^^^^^^^^^^^^^^^^^^^^ new line added ^^^^^^^^^^^^^^^^^^^^^ fstat(1, {st_mode=3D031545, st_size=3D7596457873570623081, ...}) =3D 0 read(3, "", 4096) =3D 0 write(1, "line++\n", 7) =3D -1 EPIPE (Broken pipe) ^^^^^^^^^ try write ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ =2D-- SIGPIPE (Broken pipe: 13) --- =2D-- SIGPIPE (Broken pipe: 13) --- ^^^^^^^^ exit ^^^^^^^^^^^^^ =2D-=20 Max N. Boyarov --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFHakV0XJXgXMoFno8RAnUaAJ4g0r0TY2Td+Em+4CAboeUrnLPMpACgqt8I Yn6f9ptNcb4YQjv+A8L/sCw= =huQF -----END PGP SIGNATURE----- --=-=-=--