run-program :pty doesn't provide /dev/tty for the child

Bug #778513 reported by Nikodemus Siivola
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Triaged
Low
Unassigned

Bug Description

I have a hard time figuring out when one would not want /dev/tty to be available when running under a pty.

Changed in sbcl:
assignee: nobody → Nikodemus Siivola (nikodemus)
status: Triaged → In Progress
Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

Patch sans testing on "exotic" systems like OpenBSD and Solaris and test-cases on github.

  https://github.com/nikodemus/SBCL/commit/834b6771526c19841b0929849fcbab98c06bd737

Will merge after freeze (and test-cases, etc.)

Revision history for this message
Josh Elsasser (josh-elsasser) wrote :

This won't build on OpenBSD since the BSD version of setpgrp() takes arguments. It should be fine to just delete the setpgrp() call since setpgid(0, getpid()) goes the same thing, and is actually portable.

I would actually question why the setpgid or setpgrp call is needed at all if we are unconditionally calling setsid() now. It would seem to be a no-op with all the ifdefs removed.

Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

This version: https://github.com/nikodemus/sbcl/tree/wip-pty-setup

works on Linux, but fails some of the new tests on OS X.

In (RUN-PROGRAM PTY 2) the parent gets "from-parent" instead of "got=from-parent", and in (RUN-PROGRAM PTY 3) no error output ends up in the string stream.

Haven't dug deeper yet.

I'm also pretty sure this will not work right on OpenBSD given the run-program.c uses login_tty there, which causes the pty to be use for all stdin, stdout, stderr -- whereas part of the point here is to allow childs who have the pty available as /dev/tty, but for whom isatty(stdin) is false.

Douglas Katzman (dougk)
Changed in sbcl:
assignee: Nikodemus Siivola (nikodemus) → nobody
status: In Progress → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.