Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: problems using a pty
Hello. What wait channel is the slave process waiting on? Can you
try this test on a 4.x system? The reason I ask is that it sounds like you
might be running into a variation of the bug I found with the pty code in
5.x and -current about 8 months ago. There was a typo in kern_pty.c which
caused the slave to be reading on the wrong wait channel. the problem
didn't exist in 4.x because the bug was introduced when the pty code was
made mp safe. If you test on a 4.x system and it works, then it's a bug in
the pty code, if not, then it's probably something in your test.
Just my thoughts.
-Brian
On Feb 12, 11:39pm, Brett Lymn wrote:
} Subject: problems using a pty
}
} Hi,
}
} For a while I have been working on an automated tester for libcurses.
} What I have done is have two processes that talk to each other over a
} couple of pipes and a pty - one process is the test director, it reads
} a command file which is a sequence of curses routines to call, the
} routines plus parameters are passed over a pipe to the slave process
} which calls the curses routine with the given parameters and passes
} back the return code (and possibly other returns) via another pipe to
} the directory. The pty is the stdin/stdout/stderr for the slave, the
} director monitors it's end of the pty for output from the slave and
} verifies this output against expected output, flagging any
} differences.
}
} I have this all functioning and can do things like create a window in
} curses, write to it and perform a refresh and get the expected
} output. Doing this exercises all the pipes and the pty, they all seem
} to be doing the right things. Where things come unstuck is when I ask
} curses to read input - the director can feed input down the pty, that
} is fine *but* I never get data back on my pipe from the slave even
} though truss is telling me the slave wrote to the pipe. After a lot
} of digging around I found that things seem to go weird when the slave
} sets stdin to cbreak() mode. If instead of doing, for example, a
} getstr() curses call (which will call cbreak() in it's guts), I just
} do a gets() then things work fine, the writes the slave does to the
} pipe back to the master get to the master, everything is happy. As
} soon as I put a call to cbreak() before the gets() call then things
} break.
}
} I am using forkpty to create the pipe and slave process, I provide a
} copy of the current terminals struct termios to the pty but the
} problem still persists. I tried gdb, that claims the slave is inside
} ioctl - presumably the cbreak() call. I have tried a couple of the
} pty ioctls to see if they help like TIOCPKT and TIOCREMOTE but they
} either had no effect or made things worse.
}
} Is this a bug with pty or am I not doing something right again?
}
} --
} Brett Lymn
} "Warning:
} The information contained in this email and any attached files is
} confidential to BAE Systems Australia. If you are not the intended
} recipient, any use, disclosure or copying of this email or any
} attachments is expressly prohibited. If you have received this email
} in error, please notify us immediately. VIRUS: Every care has been
} taken to ensure this email and its attachments are virus free,
} however, any loss or damage incurred in using this email is not the
} sender's responsibility. It is your responsibility to ensure virus
} checks are completed before installing any data sent in this email to
} your computer."
}
}
>-- End of excerpt from Brett Lymn
Home |
Main Index |
Thread Index |
Old Index