Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Dec 2007 12:11:26 +0200
From:      m.boyarov@bsd.by (Max N. Boyarov)
To:        Mikhail Teterin <mi+kde@aldan.algebra.com>
Cc:        questions@freebsd.org
Subject:   Re: tail does not exit
Message-ID:  <86wsr98ylt.fsf@bsd.by>
In-Reply-To: <200712200458.27988@aldan> (Mikhail Teterin's message of "Thu, 20 Dec 2007 04:58:27 -0500")
References:  <200712192322.lBJNMfps053071@aldan.algebra.com> <200712191906.16254.mi%2Bmill@aldan.algebra.com> <86r6hixiyn.fsf@bsd.by> <200712200458.27988@aldan>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=
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-----
--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86wsr98ylt.fsf>