[retrace-server/f22] fix the invocation of mock shell

Michal Toman mtoman at fedoraproject.org
Wed Mar 11 13:54:37 UTC 2015


commit d5ccd13065bea6c479cc9b8d1db8ee61f6ddf9d1
Author: Michal Toman <michal.toman at gmail.com>
Date:   Wed Mar 11 14:54:34 2015 +0100

    fix the invocation of mock shell

 ...e-server-fix-the-invocation-of-mock-shell.patch | 170 +++++++++++++++++++++
 retrace-server.spec                                |   7 +-
 2 files changed, 176 insertions(+), 1 deletion(-)
---
diff --git a/retrace-server-fix-the-invocation-of-mock-shell.patch b/retrace-server-fix-the-invocation-of-mock-shell.patch
new file mode 100644
index 0000000..4c00155
--- /dev/null
+++ b/retrace-server-fix-the-invocation-of-mock-shell.patch
@@ -0,0 +1,170 @@
+From d344a5ade872ba59ab18fdc73bff1de6ddf1fbc9 Mon Sep 17 00:00:00 2001
+From: Michal Toman <michal.toman at gmail.com>
+Date: Wed, 11 Mar 2015 09:23:36 +0000
+Subject: [PATCH] fix the invocation of mock shell
+
+Formerly mock shell has taken all the excessive arguments
+from the command line and merged them into the resulting
+command executed in the chrooted shell. This changed
+and mock shell now only accepts a single command line
+argument - the whole command line to be forwarded to
+the chrooted shell.
+
+Signed-off-by: Michal Toman <michal.toman at gmail.com>
+---
+ src/lib/retrace.py        | 12 ++++++------
+ src/retrace-server-worker | 24 ++++++++++++------------
+ 2 files changed, 18 insertions(+), 18 deletions(-)
+
+diff --git a/src/lib/retrace.py b/src/lib/retrace.py
+index 772b638..392d1cd 100644
+--- a/src/lib/retrace.py
++++ b/src/lib/retrace.py
+@@ -419,21 +419,21 @@ def run_gdb(savedir):
+ 
+     with open(os.devnull, "w") as null:
+         child = Popen(["/usr/bin/mock", "shell", "--configdir", savedir,
+-                       "--", "ls", "'%s'" % executable],
++                       "--", "ls '%s'" % executable],
+                        stdout=PIPE, stderr=null)
+         output = child.communicate()[0]
+         if output.strip() != executable:
+             raise Exception("The appropriate package set could not be installed")
+ 
+         chmod = call(["/usr/bin/mock", "shell", "--configdir", savedir,
+-                      "--", "/bin/chmod", "a+r", "'%s'" % executable],
++                      "--", "/bin/chmod a+r '%s'" % executable],
+                       stdout=null, stderr=null)
+ 
+         if chmod != 0:
+             raise Exception, "Unable to chmod the executable"
+ 
+         child = Popen(["/usr/bin/mock", "shell", "--configdir", savedir,
+-                       "--", "ls", "'%s'" % EXPLOITABLE_PLUGIN_PATH],
++                       "--", "ls '%s'" % EXPLOITABLE_PLUGIN_PATH],
+                        stdout=PIPE, stderr=null)
+         add_exploitable = child.communicate()[0].strip() == EXPLOITABLE_PLUGIN_PATH
+ 
+@@ -461,13 +461,13 @@ def run_gdb(savedir):
+             raise Exception("Unable to copy GDB launcher into chroot")
+ 
+         chmod = call(["/usr/bin/mock", "--configdir", savedir, "shell",
+-                      "--", "/bin/chmod", "a+rx", "/var/spool/abrt/gdb.sh"],
++                      "--", "/bin/chmod a+rx /var/spool/abrt/gdb.sh"],
+                      stdout=null, stderr=null)
+         if chmod:
+             raise Exception("Unable to chmod GDB launcher")
+ 
+         child = Popen(["/usr/bin/mock", "shell", "--configdir", savedir,
+-                       "--", "su", "mockbuild", "-c", "'/bin/sh /var/spool/abrt/gdb.sh'",
++                       "--", "su mockbuild -c '/bin/sh /var/spool/abrt/gdb.sh'",
+                        # redirect GDB's stderr, ignore mock's stderr
+                        "2>&1"], stdout=PIPE, stderr=null)
+ 
+@@ -712,7 +712,7 @@ def prepare_debuginfo(vmcore, chroot=None, kernelver=None):
+     if chroot:
+         with open(os.devnull, "w") as null:
+             child = Popen(["/usr/bin/mock", "--configdir", chroot, "shell",
+-                           "--", "crash", "-s", vmcore, vmlinux],
++                           "--", "crash -s %s %s" % (vmcore, vmlinux)],
+                            stdin=PIPE, stdout=PIPE, stderr=null)
+     else:
+         child = Popen(["crash", "-s", vmcore, vmlinux], stdin=PIPE, stdout=PIPE, stderr=STDOUT)
+diff --git a/src/retrace-server-worker b/src/retrace-server-worker
+index dd1e10f..931888a 100755
+--- a/src/retrace-server-worker
++++ b/src/retrace-server-worker
+@@ -335,10 +335,10 @@ def start_retrace():
+     retrace_run(25, ["/usr/bin/mock", "init", "--configdir", task.get_savedir()])
+     if CONFIG["UseFafPackages"]:
+         retrace_run(26, ["/usr/bin/mock", "--configdir", task.get_savedir(), "shell", "--",
+-                         "bash", "-c", "'for PKG in /packages/*; do rpm2cpio \\$PKG | " \
+-                         "cpio -muid --quiet; done'"])
++                         "bash -c 'for PKG in /packages/*; "
++                         "do rpm2cpio $PKG | cpio -muid --quiet; done'"])
+     retrace_run(27, ["/usr/bin/mock", "--configdir", task.get_savedir(), "shell",
+-                     "--", "chgrp", "-R", "mockbuild", "/var/spool/abrt/crash"])
++                     "--", "chgrp -R mockbuild /var/spool/abrt/crash"])
+ 
+     # generate backtrace
+     task.set_status(STATUS_BACKTRACE)
+@@ -405,7 +405,7 @@ def mock_find_vmlinux(cfgdir, candidates):
+     with open(os.devnull, "w") as null:
+         for cand in candidates:
+             child = Popen(["/usr/bin/mock", "--configdir", cfgdir, "shell", "--",
+-                           "test", "-f", cand, "&&", "echo", cand], stdout=PIPE, stderr=null)
++                           "test -f %s && echo %s" % (cand, cand)], stdout=PIPE, stderr=null)
+             output = child.communicate()[0].strip()
+             child.wait()
+             if output == cand:
+@@ -517,14 +517,14 @@ def start_vmcore():
+             # generate the log
+             with open(os.devnull, "w") as null:
+                 child = Popen(["/usr/bin/mock", "--configdir", cfgdir, "shell", "--",
+-                               "crash", "--minimal", "-s", vmcore, vmlinux],
++                               "crash --minimal -s %s %s" % (vmcore, vmlinux)],
+                               stdin=PIPE, stdout=PIPE, stderr=null)
+                 kernellog = child.communicate("log\nquit\n")[0]
+                 if child.wait():
+                     log_warn("crash 'log' exitted with %d" % child.returncode)
+ 
+                 child = Popen(["/usr/bin/mock", "--configdir", cfgdir, "shell", "--",
+-                               "crash", "-s", vmcore, vmlinux], stdin=PIPE, stdout=PIPE, stderr=null)
++                               "crash -s %s %s" % (vmcore, vmlinux)], stdin=PIPE, stdout=PIPE, stderr=null)
+                 crash_bt_a = child.communicate("bt -a\nquit\n")[0]
+                 if child.wait():
+                     log_warn("crash 'bt -a' exitted with %d" % child.returncode)
+@@ -533,7 +533,7 @@ def start_vmcore():
+                 crash_kmem_f = None
+                 if CONFIG["VmcoreRunKmem"] == 1:
+                     child = Popen(["/usr/bin/mock", "--configdir", cfgdir, "shell", "--",
+-                                   "crash", "-s", vmcore, vmlinux], stdin=PIPE, stdout=PIPE, stderr=null)
++                                   "crash -s %s %s" % (vmcore, vmlinux)], stdin=PIPE, stdout=PIPE, stderr=null)
+                     crash_kmem_f = child.communicate("kmem -f\nquit\n")[0]
+                     if child.wait():
+                         log_warn("crash 'kmem -f' exitted with %d" % child.returncode)
+@@ -541,7 +541,7 @@ def start_vmcore():
+ 
+                 if CONFIG["VmcoreRunKmem"] == 2:
+                     child = Popen(["/usr/bin/mock", "--configdir", cfgdir, "shell", "--",
+-                                   "crash", "-s", vmcore, vmlinux], stdin=PIPE, stdout=PIPE, stderr=null)
++                                   "crash -s %s %s" % (vmcore, vmlinux)], stdin=PIPE, stdout=PIPE, stderr=null)
+                     crash_kmem_f = child.communicate("set hash off\nkmem -f\nset hash on\nquit\n")[0]
+                     if child.wait():
+                         log_warn("crash 'kmem -f' exitted with %d" % child.returncode)
+@@ -550,28 +550,28 @@ def start_vmcore():
+                 crash_kmem_z = None
+                 if CONFIG["VmcoreRunKmem"] == 3:
+                     child = Popen(["/usr/bin/mock", "--configdir", cfgdir, "shell", "--",
+-                                   "crash", "-s", vmcore, vmlinux], stdin=PIPE, stdout=PIPE, stderr=null)
++                                   "crash -s %s %s" % (vmcore, vmlinux)], stdin=PIPE, stdout=PIPE, stderr=null)
+                     crash_kmem_z = child.communicate("kmem -z\nquit\n")[0]
+                     if child.wait():
+                         log_warn("crash 'kmem -z' exitted with %d" % child.returncode)
+                         crash_kmem_z = None
+ 
+                 child = Popen(["/usr/bin/mock", "--configdir", cfgdir, "shell", "--",
+-                               "crash", "-s", vmcore, vmlinux], stdin=PIPE, stdout=PIPE, stderr=null)
++                               "crash -s %s %s" % (vmcore, vmlinux)], stdin=PIPE, stdout=PIPE, stderr=null)
+                 crash_sys = child.communicate("sys\nquit\n")[0]
+                 if child.wait():
+                     log_warn("crash 'sys' exitted with %d" % child.returncode)
+                     crash_sys = None
+ 
+                 child = Popen(["/usr/bin/mock", "--configdir", cfgdir, "shell", "--",
+-                               "crash", "-s", vmcore, vmlinux], stdin=PIPE, stdout=PIPE, stderr=null)
++                               "crash -s %s %s" % (vmcore, vmlinux)], stdin=PIPE, stdout=PIPE, stderr=null)
+                 crash_sys_c = child.communicate("sys -c\nquit\n")[0]
+                 if child.wait():
+                     log_warn("crash 'sys -c' exitted with %d" % child.returncode)
+                     crash_sys_c = None
+ 
+                 child = Popen(["/usr/bin/mock", "--configdir", cfgdir, "shell", "--",
+-                               "crash", "-s", vmcore, vmlinux], stdin=PIPE, stdout=PIPE, stderr=null)
++                               "crash -s %s %s" % (vmcore, vmlinux)], stdin=PIPE, stdout=PIPE, stderr=null)
+                 crash_foreach_bt = child.communicate("foreach bt\nquit\n")[0]
+                 if child.wait():
+                     log_warn("crash 'foreach bt' exitted with %d" % child.returncode)
+-- 
+2.1.0
+
diff --git a/retrace-server.spec b/retrace-server.spec
index 70a5ce1..82af29c 100644
--- a/retrace-server.spec
+++ b/retrace-server.spec
@@ -3,13 +3,14 @@
 Summary: Application for remote coredump analysis
 Name: retrace-server
 Version: 1.12
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv2+
 Group: Applications/System
 URL: https://fedorahosted.org/abrt/wiki/AbrtRetraceServer
 Source: https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.gz
 Patch0: %{name}-manager-fix-kernelver.patch
 Patch1: %{name}-add-ppc64le-aarch64.patch
+Patch2: %{name}-fix-the-invocation-of-mock-shell.patch
 
 BuildArch: noarch
 
@@ -52,6 +53,7 @@ generation service over a network using HTTP protocol.
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %build
 autoconf
@@ -136,6 +138,9 @@ fi
 %doc COPYING INSTALL README TODO
 
 %changelog
+* Wed Mar 11 2015 Michal Toman <mtoman at fedoraproject.org> 1.12-4
+- fix the invocation of mock shell
+
 * Tue Mar 03 2015 Michal Toman <mtoman at fedoraproject.org> 1.12-3
 - manager.wsgi - fix kernelver handling (harshula at redhat.com)
 - add support for ppc64le and aarch64


More information about the scm-commits mailing list