Date: Mon, 21 Jan 2008 23:39:37 +0200 From: Alexander Renn <alexander.renn@gmail.com> To: freebsd-bugs@freebsd.org Subject: Terminal displays wrong characters when write() is used Message-ID: <16210302838.20080121233937@gmail.com>
next in thread | raw e-mail | index | archive | help
Hello, I played a little bit with my expect script and a /usr/bin/tee program: $ expect my-expect-script | tee logfile The interesting thing is that the output on the terminal did not match the contents in the file. Some blocks of characters were missing on the terminal while they were present in the file "logfile". I tested this in konsole KDE terminal and also via remote ssh putty terminal and the results were identical. The other interesting thing is that everything works as it should work if I do things this way: $ expect my-expect-script | tee logfile > logifle2 In this case logfile and logifle2 are identical. When I do "cat logfile" and "cat logfile2" files loog just as they should be. I thought that the problem could be in /usr/bin/tee so I tried to put the fflush() after the write() in tee.c and I rebuilt it and it did not help. I also tried to decrease the buffer size from 8*1024 to 1024 and to 64 bytes and it did not help neither. My expect script does not output any unprintable characters, but even if it did - should it be the problem? Is it a problem of using write() for writing to stdout?.. I tried doing $ expect my-expect-script | tee logfile on one terminal and $ tail -f logifle on another terminal and everything worked OK. I think that tee should output characters just like tail does?.. -- Best regards, Alexander Renn E-mail/Jabber: Alexander.Renn@Gmail.com ICQ: 50088883 --- What escape routes are you keeping open that are causing you not to fight as hard?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?16210302838.20080121233937>