From owner-freebsd-questions@FreeBSD.ORG Thu Dec 20 10:11:49 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 AF02D16A417 for ; Thu, 20 Dec 2007 10:11:49 +0000 (UTC) (envelope-from m.boyarov@bsd.by) Received: from mx1.cybernet.by (mx1.cybernet.by [212.98.164.131]) by mx1.freebsd.org (Postfix) with ESMTP id 6DDE913C457 for ; Thu, 20 Dec 2007 10:11:49 +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 12839CDF5BC; Thu, 20 Dec 2007 12:07:31 +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 8BC2DCDF5BB; Thu, 20 Dec 2007 12:07:30 +0200 (EET) Received: by solar.bsd.by (Postfix, from userid 1001) id 9842622860; Thu, 20 Dec 2007 12:11:30 +0200 (EET) X-Comment-To: Mikhail Teterin To: Mikhail Teterin References: <200712192322.lBJNMfps053071@aldan.algebra.com> <200712191906.16254.mi+mill@aldan.algebra.com> <86r6hixiyn.fsf@bsd.by> <200712200458.27988@aldan> From: m.boyarov@bsd.by (Max N. Boyarov) In-Reply-To: <200712200458.27988@aldan> (Mikhail Teterin's message of "Thu, 20 Dec 2007 04:58:27 -0500") X-Mailer: Gnus v5.11/GNU Emacs 22.1 Date: Thu, 20 Dec 2007 12:11:26 +0200 Message-ID: <86wsr98ylt.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:11:49 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable >>>>> "MT" =3D=3D Mikhail Teterin writes: [...] MT> I'm sorry, this does not make sense to me. Starting with an empty MT> file, as you do in 1), /may/ make tail not notice, that awk went MT> away, because tail has nothing to write to stdout. MT> But /var/log/messages is not empty, and awk -- in my example -- would MT> exit upon seeing the very first line of its input (tail's output). MT> Yet tail fails to notice, that its subsequent output (starting with the MT> second line) is written to nowhere... MT> Why? Because nothing writeln to /var/log/messages =20 $ sh -x /tmp/x.sh=20 + + tail -f /var/log/messages=20=20 awk {print "Exiting"; exit 0} Exiting + echo Exited Exited + exit 0 after something writeln to /var/log/messages tail get SIGPIPE open("/var/log/messages",O_RDONLY,0666) =3D 3 (0x3) fstat(3,{mode=3D-rw-r--r-- ,inode=3D141327,size=3D4997,blksize=3D4096}) =3D= 0 (0x0) mmap(0x0,4997,PROT_READ,MAP_SHARED,3,0x0) =3D 672616448 (0x28175000) Exiting write(1,"Dec 20 11:59:04 solar kernel: da"...,1090) =3D 1090 (0x442) fstat(3,{mode=3D-rw-r--r-- ,inode=3D141327,size=3D4997,blksize=3D4096}) =3D= 0 (0x0) lseek(3,0x0,SEEK_CUR) =3D 0 (0x0) lseek(3,0x1000,SEEK_SET) =3D 4096 (0x1000) read(3,"kernel: da1: 1.000MB/s transfers"...,4096) =3D 901 (0x385) munmap(0x28175000,4997) =3D 0 (0x0) read(3,0x28204000,4096) =3D 0 (0x0) kqueue(0x28172d40,0x4,0xa,0x0,0x28201088,0x1) =3D 4 (0x4) fstatfs(0x3,0xbfbfe44c,0x2815fe98,0x28172d40,0x0,0x2806dee4) =3D 0 (0x0) kevent(4,{0x3,EVFILT_READ,EV_ADD|EV_ENABLE|EV_CLEAR,0,0x0,0x0},1,0x0,0,{0.0= 00000000}) =3D 0 (0x0) kevent(4,0x0,0,{0x3,EVFILT_READ,EV_CLEAR,0,0x3e,0x0},1,0x0) =3D 1 (0x1) read(3,"Dec 20 12:06:27 solar su: BAD SU"...,4096) =3D 62 (0x3e) fstat(1,{mode=3Dp--------- ,inode=3D0,size=3D0,blksize=3D4096}) =3D 0 (0x0) read(3,0x28204000,4096) =3D 0 (0x0) write(1,"Dec 20 12:06:27 solar su: BAD SU"...,62) ERR#32 'Broken pipe' SIGNAL 13 (SIGPIPE) =2D-=20 Max N. Boyarov --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFHaj/SXJXgXMoFno8RAvy7AJ9Qlt1EvgHjYFHlhZirFzxLmJls3QCfePsk 6Hk6N74RQObkY3xeVow9Zm8= =Yt4Q -----END PGP SIGNATURE----- --=-=-=--