Terminal displays wrong characters when write() is used
Alexander Renn
alexander.renn at gmail.com
Mon Jan 21 22:09:20 UTC 2008
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 at Gmail.com
ICQ: 50088883
---
What escape routes are you keeping open that are causing you not to fight as hard?
More information about the freebsd-bugs
mailing list