Description of problem: (Found by infernix on IRC) The 'tar-out' command does not quote the directory name properly, meaning that if it contains spaces (or worse, shell meta-characters) those are not handled properly. Reproducer: guestfish -v -N fs -m /dev/sda1 <<EOF mkdir "/foo bar" tar-out "/foo bar" /tmp/test.tar EOF The command will fail, and in the verbose messages you will see: ..... tar -C /sysroot/foo bar -cf - . tar: /sysroot/foo: Cannot chdir: No such file or directory tar: Error is not recoverable: exiting now pclose: /foo bar: Success guestfsd: mainlibguestfs: error: file receive cancelled by daemon libguestfs: error: /tmp/test.tar: error in chunked encoding ..... Notice that the tar -C option is not properly quoted, so it is passed as two parameters to tar. Version-Release number of selected component (if applicable): 1.16 - not able to test, but based on code inspection: no 1.18 - no 1.20 - YES 1.21 - YES
The commit which introduced this error was: https://github.com/libguestfs/libguestfs/commit/c78ec7e085e99bfddd0509dece72bf6a8d0188ce which was also backported to the stable-1.20 branch: https://github.com/libguestfs/libguestfs/commit/1bd81388e02be2e46c24f700217be32786d3ae1a The error was introduced as part of the fix for RHBZ#908322.
The fix for bug 908322 also broke the base64-out command in the same way: guestfish -v -N fs -m /dev/sda1 <<EOF touch "/foo bar" base64-out "/foo bar" /tmp/test.b64 EOF In the verbose output for this command you will see: ..... base64 /sysroot/foo bar base64: extra operand '/sysroot/foo' Try 'base64 --help' for more information. pclose: /foo bar: Success guestfsd: main_loop: proc 243 (base64_out) took 0.00 seconds libguestfs: error: file receive cancelled by daemon libguestfs: error: /tmp/test.b64: error in chunked encoding ..... which is the same kind of problem as for tar.
Fixed upstream: https://github.com/libguestfs/libguestfs/commit/c5f356a60351dd51cbd3a9aabcac2cd40562f36a (fix) https://github.com/libguestfs/libguestfs/commit/cc93840d31e440e64e27ee13df3afd134ef2e68f (regression test)