Bug 957797 - tar-out and base64-out quoting error
Summary: tar-out and base64-out quoting error
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: libguestfs
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 957772
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-04-29 14:33 UTC by Richard W.M. Jones
Modified: 2013-05-22 03:18 UTC (History)
4 users (show)

Fixed In Version: libguestfs-1.20.6-2.fc18
Doc Type: Bug Fix
Doc Text:
Clone Of: 957772
Environment:
Last Closed: 2013-05-22 03:18:27 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2013-04-29 14:33:26 UTC
+++ This bug was initially created as a clone of Bug #957772 +++

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

--- Additional comment from Richard W.M. Jones on 2013-04-29 09:51:32 EDT ---

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.

--- Additional comment from Richard W.M. Jones on 2013-04-29 09:54:27 EDT ---

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.

--- Additional comment from Richard W.M. Jones on 2013-04-29 10:31:58 EDT ---

Fixed upstream:
https://github.com/libguestfs/libguestfs/commit/c5f356a60351dd51cbd3a9aabcac2cd40562f36a (fix)
https://github.com/libguestfs/libguestfs/commit/cc93840d31e440e64e27ee13df3afd134ef2e68f (regression test)

Comment 1 Fedora Update System 2013-04-29 19:16:42 UTC
libguestfs-1.20.6-2.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/libguestfs-1.20.6-2.fc18

Comment 2 Fedora Update System 2013-04-30 03:26:35 UTC
Package libguestfs-1.20.6-2.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing libguestfs-1.20.6-2.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-6996/libguestfs-1.20.6-2.fc18
then log in and leave karma (feedback).

Comment 3 Fedora Update System 2013-05-22 03:18:27 UTC
libguestfs-1.20.6-2.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.