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
[-- Attachment #1 --]
>>>>> "MT" == 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
$ sh -x /tmp/x.sh
+ + tail -f /var/log/messages
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) = 3 (0x3)
fstat(3,{mode=-rw-r--r-- ,inode=141327,size=4997,blksize=4096}) = 0 (0x0)
mmap(0x0,4997,PROT_READ,MAP_SHARED,3,0x0) = 672616448 (0x28175000)
Exiting
write(1,"Dec 20 11:59:04 solar kernel: da"...,1090) = 1090 (0x442)
fstat(3,{mode=-rw-r--r-- ,inode=141327,size=4997,blksize=4096}) = 0 (0x0)
lseek(3,0x0,SEEK_CUR) = 0 (0x0)
lseek(3,0x1000,SEEK_SET) = 4096 (0x1000)
read(3,"kernel: da1: 1.000MB/s transfers"...,4096) = 901 (0x385)
munmap(0x28175000,4997) = 0 (0x0)
read(3,0x28204000,4096) = 0 (0x0)
kqueue(0x28172d40,0x4,0xa,0x0,0x28201088,0x1) = 4 (0x4)
fstatfs(0x3,0xbfbfe44c,0x2815fe98,0x28172d40,0x0,0x2806dee4) = 0 (0x0)
kevent(4,{0x3,EVFILT_READ,EV_ADD|EV_ENABLE|EV_CLEAR,0,0x0,0x0},1,0x0,0,{0.000000000}) = 0 (0x0)
kevent(4,0x0,0,{0x3,EVFILT_READ,EV_CLEAR,0,0x3e,0x0},1,0x0) = 1 (0x1)
read(3,"Dec 20 12:06:27 solar su: BAD SU"...,4096) = 62 (0x3e)
fstat(1,{mode=p--------- ,inode=0,size=0,blksize=4096}) = 0 (0x0)
read(3,0x28204000,4096) = 0 (0x0)
write(1,"Dec 20 12:06:27 solar su: BAD SU"...,62) ERR#32 'Broken pipe'
SIGNAL 13 (SIGPIPE)
--
Max N. Boyarov
[-- Attachment #2 --]
-----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>
