NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/53996: tip(1) fails to handle EOF on stdin
The following reply was made to PR bin/53996; it has been noted by GNATS.
From: Andreas Gustafsson <gson%gson.org@localhost>
To: Valery Ushakov <uwe%stderr.spb.ru@localhost>
Cc: gnats-bugs%NetBSD.org@localhost
Subject: Re: bin/53996: tip(1) fails to handle EOF on stdin
Date: Fri, 22 Feb 2019 19:37:08 +0200
Valery,
You didn't answer my question: what purpose do you need the test case for?
> >From your description it sounded like the minimized test case should
> be like a couple lines of python, like, in pseudocode
>
> spawn("tip")
> close_pty()
>
> and since you work with pexpect you presumably already know how these
> "spawn" and "close_pty" are really spelled, so it shouldn't be that
> much of a trouble.
>
> Is it more involved then that?
Yes, it is more involved than that.
Assuming "dty0c" in your /etc/remote is pointing to a working serial
port (which it happens to do on my system), the following test case
should work. Save this as test.py:
import pexpect
import sys
import time
import os
child = pexpect.spawn("sh", ["-c", "trap '' HUP && ktrace tip dty0c"], logfile = sys.stdout)
child.expect("onnected");
time.sleep(1)
os.close(child.child_fd)
time.sleep(1)
Then run the following as root:
python2.7 test.py
kdump
kdump will show an a large number of system calls writing 0xFF
characters to the serial port:
19467 1 tip CALL write(3,0x7f7fffffdc0f,1)
19467 1 tip GIO fd 3 wrote 1 bytes
"\M^?"
19467 1 tip RET write 1
19467 1 tip CALL write(3,0x7f7fffffdc0f,1)
19467 1 tip GIO fd 3 wrote 1 bytes
"\M^?"
19467 1 tip RET write 1
and ktrace.out will keep growing until you kill the tip
processes.
--
Andreas Gustafsson, gson%gson.org@localhost
Home |
Main Index |
Thread Index |
Old Index