-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pty
command doesn't handle SIGTSTP correctly
#375
Comments
I double-checked the beta branch and using the legacy build system the same failure occurs:
|
I expect the test in pty.sh to fail in OpenBSD because it uses I tried and failed to write a test that would reproduce the problem where /bin/sleep restarts nanosleep() after SIGTSTP. I did have trouble getting pty to send ^Z at the correct time. It is possible for pty to type ^Z before sleep becomes the terminal's foreground process. This ^Z sends SIGTSTP to ksh, before or after ksh sets its SIGTSTP handler. If before, then ksh gets suspended and /bin/sleep never runs. If after, then ksh ignores SIGTSTP and runs /bin/sleep. I sent ^Z at the correct time with this test. First, I put
I need ^Z to suspend /bin/sleep, so I use
|
Disable /etc/ksh.kshrc so it can't change PS1 or other environment variables; such changes can break the tests. Switch from `seq 100` to `{1..100}` because OpenBSD has no seq(1) command. Remove TODO comments and enable tests in pty.sh. Some tests use stty(1); these should work even if stty(1) is not a builtin. This enables the test for att#375
This is moot since we've decided to drop the |
Apparently, pty doens't handle SIGTSTP correctly: att#375 #45 (comment) src/cmd/ksh93/tests/pty.sh: - Disable the 'process/terminal group exercise' regression test, which depends on correct SIGTSTP handling, until pty can be fixed. Closes #45.
While working on changing the Meson build system to also build the
pty
command so its associated unit tests could be run I noticed something interesting. There is one test for \cZ to suspend the current process. Theksh
command handles that situation correctly. That is, if you run something like/bin/sleep 30
and press \cZ the sleep is suspended. The standalonepty
command results in the blocking syscall of the command being resumed rather than suspending the process.Here is a
strace
of /bin/sleep (substituted for theless
command in that unit test to simplify the problem):Notice that the nanosleep is restarted. What should happen is this:
TBD is what
pty
is doing wrong in setting up the environment such that the libc syscall trampoline code is incorrectly deciding to restart the interrupted syscall. Note that this happens on both BSD and GNU Linux.The text was updated successfully, but these errors were encountered: