[lxc-devel] [lxc/lxc] 6bdbc9: utils: backport set_stdfds()

GitHub noreply at github.com
Wed Nov 29 11:54:09 UTC 2017


  Branch: refs/heads/stable-1.0
  Home:   https://github.com/lxc/lxc
  Commit: 6bdbc920ec709d112e8ab84ba6dbdd5bb39d2b70
      https://github.com/lxc/lxc/commit/6bdbc920ec709d112e8ab84ba6dbdd5bb39d2b70
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-11-29 (Wed, 29 Nov 2017)

  Changed paths:
    M src/lxc/utils.c
    M src/lxc/utils.h

  Log Message:
  -----------
  utils: backport set_stdfds()

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 797bcba3ebe54d3651f245c2d8b5671fc35e8c37
      https://github.com/lxc/lxc/commit/797bcba3ebe54d3651f245c2d8b5671fc35e8c37
  Author: LiFeng <lifeng68 at huawei.com>
  Date:   2017-11-29 (Wed, 29 Nov 2017)

  Changed paths:
    M src/lxc/console.c

  Log Message:
  -----------
  console: clean tty state + return 0 on peer exit

In the past, if the console client exited, lxc_console_cb_con return 1. And
the lxc_poll will exit, the process will wait at waitpid. At this moment, the
process could not handle any command (For example get the container state
LXC_CMD_GET_STATE or stop the container LXC_CMD_STOP.).

I think we should clean the tty_state and return 0 in this case. So, we can use
the lxc-console to connect the console of the container. And we will not exit
the function lxc_polland we can handle the commands by lxc_cmd_process

Reproducer prior to this commit:
- open a new terminal, get the tty device name by command tty /dev/pts/6
- set lxc.console.path = /dev/pts/6
- start the container and the ouptut will print to /dev/pts/6
- close /dev/pts/6
- try an operation e.g. getting state with lxc-ls and lxc-ls will hang

Closes #1787.

Signed-off-by: LiFeng <lifeng68 at huawei.com>
Acked-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 27807cc824ce4c31edb858db20545f882010f238
      https://github.com/lxc/lxc/commit/27807cc824ce4c31edb858db20545f882010f238
  Author: Li Feng <lifeng68 at huawei.com>
  Date:   2017-11-29 (Wed, 29 Nov 2017)

  Changed paths:
    M src/lxc/console.c

  Log Message:
  -----------
  DO NOT add the handles of adjust winsize when the 'stdin' is not a tty

Signed-off-by: Li Feng <lifeng68 at huawei.com>


  Commit: d1ea3f93f6f2cbbb138030cb718603c2d2a6f0aa
      https://github.com/lxc/lxc/commit/d1ea3f93f6f2cbbb138030cb718603c2d2a6f0aa
  Author: Li Feng <lifeng68 at huawei.com>
  Date:   2017-11-29 (Wed, 29 Nov 2017)

  Changed paths:
    M src/lxc/console.c

  Log Message:
  -----------
  Fix memory leak of 'lxc_tty_state'

Signed-off-by: Li Feng <lifeng68 at huawei.com>


  Commit: 74941f9a3376e2a854ad449d1d65436013704e34
      https://github.com/lxc/lxc/commit/74941f9a3376e2a854ad449d1d65436013704e34
  Author: Li Feng <lifeng68 at huawei.com>
  Date:   2017-11-29 (Wed, 29 Nov 2017)

  Changed paths:
    M src/lxc/start.c

  Log Message:
  -----------
  start: dup std{in,out,err} to pty slave

In the case the container has a console with a valid slave pty file descriptor
we duplicate std{in,out,err} to the slave file descriptor so console logging
works correctly.
Also, we should become session leader.

Closes #1646.
Closes #1951.

Signed-off-by: Li Feng <lifeng68 at huawei.com>
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


Compare: https://github.com/lxc/lxc/compare/908ff6ec8581...74941f9a3376


More information about the lxc-devel mailing list