From ebc86ae6d76bab3e09484a039ddffcb323a106a3 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 21 Jan 2013 11:14:14 +0000 Subject: [PATCH] Fix checksums-out command (RHBZ#895904). This was broken by the earlier commit 0306c98d319d189281af3c15101c8d343e400f13. This commit also adds a regression test. --- daemon/checksum.c | 3 +-- tests/regressions/Makefile.am | 1 + tests/regressions/rhbz895904.sh | 43 +++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100755 tests/regressions/rhbz895904.sh diff --git a/daemon/checksum.c b/daemon/checksum.c index f16a7c05b..f9ae2a831 100644 --- a/daemon/checksum.c +++ b/daemon/checksum.c @@ -161,8 +161,7 @@ do_checksums_out (const char *csumtype, const char *dir) char *cmd; if (asprintf_nowarn (&cmd, "cd %Q && %s -type f -print0 | %s -0 %s", - str_find, str_xargs, - sysrootdir, program) == -1) { + sysrootdir, str_find, str_xargs, program) == -1) { reply_with_perror ("asprintf"); free (sysrootdir); return -1; diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am index fd4c3103f..4c4815ae7 100644 --- a/tests/regressions/Makefile.am +++ b/tests/regressions/Makefile.am @@ -29,6 +29,7 @@ TESTS = \ rhbz789960.sh \ rhbz790721 \ rhbz811649.sh \ + rhbz895904.sh \ test-noexec-stack.pl tests_not_run = \ diff --git a/tests/regressions/rhbz895904.sh b/tests/regressions/rhbz895904.sh new file mode 100755 index 000000000..644062084 --- /dev/null +++ b/tests/regressions/rhbz895904.sh @@ -0,0 +1,43 @@ +#!/bin/bash - +# libguestfs +# Copyright (C) 2013 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# Regression test for: +# https://bugzilla.redhat.com/show_bug.cgi?id=895904 +# Ensure we have a test of the 'checksums-out' command. + +set -e +export LANG=C + +output=$( +../../fish/guestfish -N fs -m /dev/sda1 <