Hello community, here is the log from the commit of package conmon for openSUSE:Factory checked in at 2019-09-25 00:56:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/conmon (Old) and /work/SRC/openSUSE:Factory/.conmon.new.7948 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "conmon" Wed Sep 25 00:56:41 2019 rev:3 rq:731418 version:2.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/conmon/conmon.changes 2019-08-27 15:50:33.419769100 +0200 +++ /work/SRC/openSUSE:Factory/.conmon.new.7948/conmon.changes 2019-09-25 00:56:45.257904095 +0200 @@ -1,0 +2,5 @@ +Mon Sep 16 16:59:28 UTC 2019 - Sascha Grunert <[email protected]> + +- Set masterfd_stdout before registering ctrl_cb + +------------------------------------------------------------------- Old: ---- conmon-2.0.0.tar.xz New: ---- conmon-2.0.1.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ conmon.spec ++++++ --- /var/tmp/diff_new_pack.h8J4cp/_old 2019-09-25 00:56:45.797904174 +0200 +++ /var/tmp/diff_new_pack.h8J4cp/_new 2019-09-25 00:56:45.801904174 +0200 @@ -17,7 +17,7 @@ Name: conmon -Version: 2.0.0 +Version: 2.0.1 Release: 0 Summary: An OCI container runtime monitor License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.h8J4cp/_old 2019-09-25 00:56:45.837904180 +0200 +++ /var/tmp/diff_new_pack.h8J4cp/_new 2019-09-25 00:56:45.837904180 +0200 @@ -2,8 +2,8 @@ <service name="tar_scm" mode="disabled"> <param name="url">https://github.com/containers/conmon</param> <param name="scm">git</param> -<param name="versionformat">2.0.0</param> -<param name="revision">v2.0.0</param> +<param name="versionformat">2.0.1</param> +<param name="revision">v2.0.1</param> </service> <service name="recompress" mode="disabled"> <param name="file">conmon-*.tar</param> ++++++ conmon-2.0.0.tar.xz -> conmon-2.0.1.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conmon-2.0.0/Makefile new/conmon-2.0.1/Makefile --- old/conmon-2.0.0/Makefile 2019-08-09 16:53:57.000000000 +0200 +++ new/conmon-2.0.1/Makefile 2019-09-13 17:34:08.000000000 +0200 @@ -43,6 +43,25 @@ override CFLAGS += $(shell $(PKG_CONFIG) --cflags libsystemd) -D USE_JOURNALD=0 endif +define DOCKERFILE + FROM alpine:latest + RUN apk add --update --no-cache bash make git gcc pkgconf libc-dev glib-dev glib-static + COPY . /go/src/$(PROJECT) + WORKDIR /go/src/$(PROJECT) + RUN make static +endef +export DOCKERFILE + +containerized: bin + $(eval PODMAN ?= $(if $(shell podman -v),podman,docker)) + echo "$$DOCKERFILE" | $(PODMAN) build --force-rm -t conmon-build -f - . + CTR=`$(PODMAN) create conmon-build` \ + && $(PODMAN) cp $$CTR:/go/src/$(PROJECT)/bin/conmon bin/conmon \ + && $(PODMAN) rm $$CTR + +static: + $(MAKE) git-vars bin/conmon PKG_CONFIG='$(PKG_CONFIG) --static' CFLAGS='-static' LDFLAGS='$(LDFLAGS) -s -w -static' LIBS='$(LIBS)' + bin/conmon: src/conmon.o src/cmsg.o src/ctr_logging.o src/utils.o | bin $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) @@ -66,8 +85,7 @@ .PHONY: clean clean: - rm -f bin/conmon src/*.o - rmdir bin + rm -rf bin/ src/*.o .PHONY: install install.bin install.crio install.podman podman crio install: install.bin diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conmon-2.0.0/VERSION new/conmon-2.0.1/VERSION --- old/conmon-2.0.0/VERSION 2019-08-09 16:53:57.000000000 +0200 +++ new/conmon-2.0.1/VERSION 2019-09-13 17:34:08.000000000 +0200 @@ -1 +1 @@ -2.0.0 +2.0.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conmon-2.0.0/src/conmon.c new/conmon-2.0.1/src/conmon.c --- old/conmon-2.0.0/src/conmon.c 2019-08-09 16:53:57.000000000 +0200 +++ new/conmon-2.0.1/src/conmon.c 2019-09-13 17:34:08.000000000 +0200 @@ -116,7 +116,7 @@ {"version", 0, 0, G_OPTION_ARG_NONE, &opt_version, "Print the version and exit", NULL}, {"syslog", 0, 0, G_OPTION_ARG_NONE, &opt_syslog, "Log to syslog (use with cgroupfs cgroup manager)", NULL}, {"log-level", 0, 0, G_OPTION_ARG_STRING, &opt_log_level, "Print debug logs based on log level", NULL}, - {NULL}}; + {NULL, 0, 0, 0, NULL, NULL, NULL}}; #define CGROUP_ROOT "/sys/fs/cgroup" #define OOM_SCORE "-999" @@ -676,7 +676,7 @@ ws.ws_col = width; ret = ioctl(masterfd_stdout, TIOCSWINSZ, &ws); if (ret == -1) { - nwarn("Failed to set process pty terminal size"); + pwarn("Failed to set process pty terminal size"); } } @@ -795,6 +795,11 @@ masterfd_stdin = console.fd; masterfd_stdout = console.fd; + /* now that we've set masterfd_stdout, we can register the ctrl_cb + * if we didn't set it here, we'd risk attempting to run ioctl on + * a negative fd, and fail to resize the window */ + g_unix_fd_add(terminal_ctrl_fd, G_IO_IN, ctrl_cb, NULL); + /* Clean up everything */ close(connfd); @@ -988,7 +993,6 @@ int dummyfd = open(ctl_fifo_path, O_WRONLY | O_CLOEXEC); if (dummyfd == -1) pexit("Failed to open dummy writer for fifo"); - g_unix_fd_add(terminal_ctrl_fd, G_IO_IN, ctrl_cb, NULL); ninfof("terminal_ctrl_fd: %d", terminal_ctrl_fd); return dummyfd; @@ -1072,9 +1076,32 @@ static void do_exit_command() { + pid_t exit_pid; gchar **args; size_t n_args = 0; + if (signal(SIGCHLD, SIG_DFL) == SIG_ERR) { + _pexit("Failed to reset signal for SIGCHLD"); + } + + exit_pid = fork(); + if (exit_pid < 0) { + _pexit("Failed to fork"); + } + + if (exit_pid) { + int ret, exit_status = 0; + + do + ret = waitpid(exit_pid, &exit_status, 0); + while (ret < 0 && errno == EINTR); + + if (exit_status) + _exit(exit_status); + + return; + } + /* Count the additional args, if any. */ if (opt_exit_args) for (; opt_exit_args[n_args]; n_args++) @@ -1292,6 +1319,11 @@ masterfd_stdout = fds[0]; slavefd_stdout = fds[1]; + + /* now that we've set masterfd_stdout, we can register the ctrl_cb + * if we didn't set it here, we'd risk attempting to run ioctl on + * a negative fd, and fail to resize the window */ + g_unix_fd_add(terminal_ctrl_fd, G_IO_IN, ctrl_cb, NULL); } /* We always create a stderr pipe, because that way we can capture @@ -1655,5 +1687,5 @@ if (attach_symlink_dir_path != NULL && unlink(attach_symlink_dir_path) == -1 && errno != ENOENT) pexit("Failed to remove symlink for attach socket directory"); - return EXIT_SUCCESS; + return exit_status; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conmon-2.0.0/src/utils.h new/conmon-2.0.1/src/utils.h --- old/conmon-2.0.0/src/utils.h 2019-08-09 16:53:57.000000000 +0200 +++ new/conmon-2.0.1/src/utils.h 2019-09-13 17:34:08.000000000 +0200 @@ -33,6 +33,14 @@ extern char *log_cid; extern gboolean use_syslog; +#define _pexit(s) \ + do { \ + fprintf(stderr, "[conmon:e]: %s %s\n", s, strerror(errno)); \ + if (use_syslog) \ + syslog(LOG_ERR, "conmon %.20s <error>: %s %s\n", log_cid, s, strerror(errno)); \ + _exit(EXIT_FAILURE); \ + } while (0) + #define pexit(s) \ do { \ fprintf(stderr, "[conmon:e]: %s %s\n", s, strerror(errno)); \
