Skip to content

Conversation

@chriskuehl
Copy link
Contributor

Fixes #51

This uses the patch from @Ehlers almost verbatim, plus adds a test.

The new behavior is that dumb-init will hand the controlling TTY to its child, if it has one. This fixes the fairly common case where running docker run -ti <image> dumb-init bash produces:

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
root@a75d2eac361b:/# 

With this change, you get job control in the shell (and no warnings printed). The test checks exactly this (outside of Docker, though).

@ghost
Copy link

ghost commented Oct 10, 2016

I'd like to propose some changes to the ioctl in my patch:

The ioctl are using not the correct arguments, see http://man7.org/linux/man-pages/man4/tty_ioctl.4.html, TIOCSCTTY has an int argument and TIOCNOTTY has none. Furthermore I suggest using STDIN_FILENO instead of 0 for the file descriptor.

So I propose to change ioctl(0, TIOCNOTTY, NULL) to ioctl(STDIN_FILENO, TIOCNOTTY) and ioctl(0, TIOCSCTTY, NULL) to ioctl(STDIN_FILENO, TIOCSCTTY, 0).

@chriskuehl
Copy link
Contributor Author

@Ehlers thanks for taking a look! I added a commit with those changes. Does it look right now?

@ghost
Copy link

ghost commented Oct 10, 2016

Look good for me (and for circleci :-)

@chriskuehl chriskuehl merged commit b66cbb0 into Yelp:master Oct 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: cannot set terminal process group (-1): Inappropriate ioctl for device

2 participants