[lxc-devel] [lxc/lxc] e73bcb: lxc-attach: attach even without sigwinch handler

GitHub noreply at github.com
Mon Apr 18 17:41:48 UTC 2016


  Branch: refs/heads/stable-2.0
  Home:   https://github.com/lxc/lxc
  Commit: e73bcbbee9bf040512585099cd68677bff02c130
      https://github.com/lxc/lxc/commit/e73bcbbee9bf040512585099cd68677bff02c130
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M src/lxc/console.c
    M src/lxc/console.h
    M src/lxc/lxc_attach.c

  Log Message:
  -----------
  lxc-attach: attach even without sigwinch handler

lxc_console_create() calls lxc_console_peer_default() which in turn calls
lxc_console_sigwinch_init() which sets up the lxc_tty_state struct for the
current pty. Prior to this commit lxc_console_sigwinch_init() would consider
failures to install a SIGWINCH handler fatal and and return NULL. This commit
makes failures to install a SIGWINCH handler non-fatal. In such cases the
lxc_tty_state struct will still be set up but the sigfd member, which contains
the fd which receives SIGWINCH events, will be set to -1. (This also entails
that the sigset_t oldmaks field is meaningless.) Callers of
lxc_console_sigwinch_init() and lxc_console_sigwinch_fini() should thus make
sure that sigfd >= 0 or sigfd != -1 before trying to register a SIGWINCH handler
in e.g. an lxc_mainloop or resetting the sigmask (cf. lxc_attach.c).

These changes also imply that lxc_console_sigwinch_init() only fails with
ENOMEM. Thus, all cases where lxc_console_sigwinch_init() returns NULL are to be
considered fatal. This wasn't the case before this commit.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: d3e3b1885a13dbe97433f11c26dbcc9d70dd9d4f
      https://github.com/lxc/lxc/commit/d3e3b1885a13dbe97433f11c26dbcc9d70dd9d4f
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M src/lxc/console.c
    M src/lxc/console.h
    M src/lxc/lxc_attach.c
    M src/lxc/start.c

  Log Message:
  -----------
  simplify pty allocation and implement pty logging

lxc-attach allocated a pty in a manner that relied on ts->stdinfd and
ts->stdoutfd to be set. We had to resort to a trick to get it working when
output is redirected. The new implementation gets rid of the black magic and
also simplifies the code.

This commit also implements pty logging for lxc-attach. Users will now be able
to log commands and corresponding output to a file given that lxc-attach
allocates a pty.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: 32bf178747090118fc6fcc25ae6550643cd521f8
      https://github.com/lxc/lxc/commit/32bf178747090118fc6fcc25ae6550643cd521f8
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M src/lxc/console.c
    M src/lxc/lxc_attach.c

  Log Message:
  -----------
  use lxc_read_nointr() and lxc_write_nointr()

Using EPOLLHUP to determine when to exit the loop is unreliable. Let's exit
clean when read() returns -1 && errno != EINTR or 0.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: 08be058f9f3dad9ce88583c4fa2a17aae767844c
      https://github.com/lxc/lxc/commit/08be058f9f3dad9ce88583c4fa2a17aae767844c
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M src/lxc/console.c

  Log Message:
  -----------
  fix lxc_console_cb_tty_*()

Clean exit when read() == -1 && errno != EINTR or read() == 0.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: 004fc78469ea7f4752e8216792faa128fded09a3
      https://github.com/lxc/lxc/commit/004fc78469ea7f4752e8216792faa128fded09a3
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M src/lxc/cgfsng.c

  Log Message:
  -----------
  cgfsng: defer to cgfs if needed subsystems are not available

This requires us to check that at cgfsng_ops_init, rather than
cgfs_init.  Cache the hierarchy and cgroup.use info globally
rather than putting it into the per-container info, as cgmanager
does.  This is ok as both cgroup.use and the list of usable
hierarchies are in fact global to a lxc run.

Closes #952

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>


  Commit: 74d4266f734b778dd2abdd03345a825c590ce38b
      https://github.com/lxc/lxc/commit/74d4266f734b778dd2abdd03345a825c590ce38b
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M src/tests/lxc-test-lxc-attach

  Log Message:
  -----------
  adapt lxc-attach tests & add test for pty logging

The current tests for lxc-attach pty allocation and I/O redirection rely on the
standard file descriptors of the test script to refer to a pty. If they do not
the tests are effectively useless with respect to pty allocation. We need a test
environment with the standard file descriptors refering to a pty as well. One
solution is to run this test under the script command.

This commit also adds a test whether pty logging works. This test is only
executed when all standard file descriptors refer to a pty.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: ad87e08c4e98ad271bb895a54efc5cd44b4b5249
      https://github.com/lxc/lxc/commit/ad87e08c4e98ad271bb895a54efc5cd44b4b5249
  Author: staticfox <staticfox at staticfox.net>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M .gitignore

  Log Message:
  -----------
  Ignore temporary files generated by doxygen

Signed-off-by: Matt Ullman <staticfox at staticfox.net>


  Commit: 6ad1226343b309a6a54b54151b4dd2ad61004494
      https://github.com/lxc/lxc/commit/6ad1226343b309a6a54b54151b4dd2ad61004494
  Author: staticfox <staticfox at staticfox.net>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M src/lxc/arguments.c
    M src/lxc/bdev/bdev.c
    M src/lxc/bdev/lxcoverlay.c
    M src/lxc/conf.c
    M src/lxc/confile.c
    M src/lxc/network.c
    M src/lxc/nl.c
    M src/lxc/parse.c
    M src/lxc/utils.c

  Log Message:
  -----------
  Use size_t as an iteration point over int

This cleans up some sign-compare warnings as well as avoids any
possibilities of unintended signed offsets for indices during
iteration.

Signed-off-by: Matt Ullman <staticfox at staticfox.net>


  Commit: 0627ac1559958a6161579f0d2647326b92027652
      https://github.com/lxc/lxc/commit/0627ac1559958a6161579f0d2647326b92027652
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M src/lxc/lxc_create.c

  Log Message:
  -----------
  lxc-create: fix -B best option

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: 54e478606b53e5983aba84c1f6619d55923ff605
      https://github.com/lxc/lxc/commit/54e478606b53e5983aba84c1f6619d55923ff605
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M doc/lxc-attach.sgml.in

  Log Message:
  -----------
  lxc-attach: add logging option to manpage

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: 3421ec289d783cb5d9f3dada429ad2860ede7ee2
      https://github.com/lxc/lxc/commit/3421ec289d783cb5d9f3dada429ad2860ede7ee2
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M src/lxc/lxc_destroy.c

  Log Message:
  -----------
  lxc-destroy: avoid double print

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: 3dfe1009b4dd157ab70d8101c12cd9e76109118d
      https://github.com/lxc/lxc/commit/3dfe1009b4dd157ab70d8101c12cd9e76109118d
  Author: Evgeni Golov <evgeni at debian.org>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M configure.ac

  Log Message:
  -----------
  nicer date format and support for SOURCE_DATE_EPOCH in LXC_GENERATE_DATE

Using $(date) for LXC_GENERATE_DATE has various flaws:
* formating depends on the locale of the system we execute configure on
* the output is not really a date but more a timestamp

Let's use $(date --utc '+%Y-%m-%d') instead.

While at it, also support SOURCE_DATE_EPOCH [1] to make the build
reproducible

[1] https://reproducible-builds.org/specs/source-date-epoch/

Signed-off-by: Evgeni Golov <evgeni at debian.org>


  Commit: de3c507c777e322a13724c9fdf4fb85df8a7d31f
      https://github.com/lxc/lxc/commit/de3c507c777e322a13724c9fdf4fb85df8a7d31f
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M src/lxc/cgfsng.c
    M src/lxc/cgroup.c

  Log Message:
  -----------
  cgfsng: don't require that systemd subsystem be mounted

Note that is_crucial_subsystem still lists name=systemd.  That is
used in cgfs and cgmanager.  Cgmanager is typically setup to create
name=systemd, so it is ok.  cgfs uses is_crucial_subsystem() only
to decide whether failure to create or chown a directory should be
terminal.  That's ok, because (a) if name=systemd is not mounted then
we won't hit that, and (b) if name=systemd is mounted, then we'd
really still like to set it up for containers.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>


  Commit: d683847986364025be2eb9b70e59491425e4fd16
      https://github.com/lxc/lxc/commit/d683847986364025be2eb9b70e59491425e4fd16
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M src/lxc/lxc_attach.c

  Log Message:
  -----------
  lxc-attach: error on -L/--pty-log + redirection

pty logging only works correctly when stdout and stderr refer to a pty. If they
do not, we do not dup2() them and lxc_console_cb_con() will never write to the
corresponding log file descriptor.

When redirection on stdout and stderr is used we can safely assume that the user
is already logging to a file or /dev/null and creating an additional pty log
doesn't seem to make sense.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: e6487e89824c184f99bf3478122aa3bc2bed86d8
      https://github.com/lxc/lxc/commit/e6487e89824c184f99bf3478122aa3bc2bed86d8
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M src/tests/lxc-test-lxc-attach

  Log Message:
  -----------
  only execute last test when we are a pty

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: 66188b02b8009075a2e0e2b89a14688c50565bf4
      https://github.com/lxc/lxc/commit/66188b02b8009075a2e0e2b89a14688c50565bf4
  Author: Evgeni Golov <evgeni at debian.org>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M config/init/sysvinit/lxc-containers.in
    M config/init/sysvinit/lxc-net.in

  Log Message:
  -----------
  add missing lsb headers to sysvinit scripts

original patch by Daniel Baumann

closes #308

Signed-off-by: Evgeni Golov <evgeni at debian.org>


  Commit: 8d3b3b77bb00c9a0998f1a02ae7cd57fbf7d99c6
      https://github.com/lxc/lxc/commit/8d3b3b77bb00c9a0998f1a02ae7cd57fbf7d99c6
  Author: Aron Podrigal <aronp at guaranteedplus.com>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M src/python-lxc/lxc/__init__.py

  Log Message:
  -----------
  Fixed python-lxc reference to var before assignment

```
>>> c = lxc.Container('ct')
>>> c.create('debian', args=('-r', 'jessie'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/lxc/__init__.py", line 229, in
create
    template_args['args'] = tuple(tmp_args)
UnboundLocalError: local variable 'tmp_args' referenced before
assignment
```

Signed-off-by: Aron Podrigal <aronp at guaranteedplus.com>


  Commit: 0eb12ed50454dc5310fd415ecd36ab77d4895aa0
      https://github.com/lxc/lxc/commit/0eb12ed50454dc5310fd415ecd36ab77d4895aa0
  Author: Evgeni Golov <evgeni at debian.org>
  Date:   2016-04-18 (Mon, 18 Apr 2016)

  Changed paths:
    M config/init/systemd/lxc.service.in

  Log Message:
  -----------
  drop obsolete syslog.target from lxc.service.in

the target is obsolete since systemd v38 which everybody should have.

original patch by Daniel Baumann

Signed-off-by: Evgeni Golov <evgeni at debian.org>


Compare: https://github.com/lxc/lxc/compare/823765e50bf4...0eb12ed50454


More information about the lxc-devel mailing list