Bug 895904
Summary: | checksums-out fail to compute the checksums of all regular files in directory | ||
---|---|---|---|
Product: | [Community] Virtualization Tools | Reporter: | Richard W.M. Jones <rjones> |
Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> |
Status: | CLOSED UPSTREAM | QA Contact: | |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | unspecified | CC: | bfan, dyasny, leiwang, mbooth, moli, qguan, wshi |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | 892275 | Environment: | |
Last Closed: | 2013-01-21 11:15:50 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 892275 |
Description
Richard W.M. Jones
2013-01-16 09:06:13 UTC
A one line reproducer is: $ guestfish -N fs -m /dev/sda1 -- mkdir /test : touch /test/file : mkdir /test/subdir : checksums-out crc /test - libguestfs: error: file receive cancelled by daemon libguestfs: error: /dev/stdout: error in chunked encoding Adding the -v option shows that we're running a completely bogus command: cd find && xargs -type f -print0 | /sysroot/test -0 cksum sh: line 0: cd: find: No such file or directory /test: Success (where did 'cd find' come from ...?) The problem is this hunk which is bogus. (The other problem being that we have no test that covers this.) commit 0306c98d319d189281af3c15101c8d343e400f13 Author: Olaf Hering <olaf> Date: Thu Aug 30 20:51:27 2012 +0200 daemon: collect list of called external commands guestfsd calls many different tools. Keeping track of all of them is error prone. This patch introduces a new helper macro to put the command string into its own ELF section: GUESTFSD_EXT_CMD(C_variable, command_name); This syntax makes it still possible to grep for used command names. The actual usage of the collected list could be like this: objcopy -j .guestfsd_ext_cmds -O binary daemon/guestfsd /dev/stdout | tr '\0' '\n' | sort -u The resulting output will be used to tell mkinitrd which programs to copy into the initrd. Signed-off-by: Olaf Hering <olaf> RWMJ: - Move str_vgchange at request of author. - Fix snprintf call in daemon/debug.c [...] diff --git a/daemon/checksum.c b/daemon/checksum.c index 2cc4a2b..f2e040d 100644 --- a/daemon/checksum.c +++ b/daemon/checksum.c @@ -150,7 +153,8 @@ do_checksums_out (const char *csumtype, const char *dir) } char *cmd; - if (asprintf_nowarn (&cmd, "cd %Q && find -type f -print0 | xargs -0 %s", + if (asprintf_nowarn (&cmd, "cd %Q && %s -type f -print0 | %s -0 %s", + str_find, str_xargs, sysrootdir, program) == -1) { reply_with_perror ("asprintf"); free (sysrootdir); Fixed upstream + regression test: https://github.com/libguestfs/libguestfs/commit/ebc86ae6d76bab3e09484a039ddffcb323a106a3 |