Description of problem: # virt-tar -zx Win2003x32 '/Windows/System32/Config' win2003.tgz tgz_out: win2003.tgz: error in chunked encoding at /usr/bin/virt-tar line 238. Version-Release number of selected component (if applicable): libguestfs-1.0.81-2.fc13.x86_64 How reproducible: Reliable. Additional information: Running it with LIBGUESTFS_DEBUG=1 reveals that the real error is because the directory does not exist (well, it does exist, but ntfs-3g can't find it because of the whole ntfs-3g case-(in)sensitivity thing). The real issue therefore is that the error message is incorrect, because the implementation of tgz_out isn't detecting the failure of the tar command. mount -o ro /dev/sda1 /sysroot/ proc 73 (mount_ro) took 0.02 seconds send_to_daemon: 0x2e0a600 g->state = 3, n = 56 recv_from_daemon: 0x2e0a600 g->state = 3, size_rtn = 0x7fff4aeb8d6c, buf_rtn = 0x7fff4aeb8d60 tar -C /sysroot/Windows/System32/Config -zcf - . tar: /sysroot/Windows/System32/Config: Cannot chdir: No such file or directory tar: Error is not recoverable: exiting now /Windows/System32/Config: Success proc 72 (tgz_out) took 0.01 seconds recv_from_daemon: 0x2e0a600 g->state = 3, size_rtn = 0x7fff4aeb8cec, buf_rtn = 0x7fff4aeb8ce0 recv_from_daemon: 0x2e0a600 g->state = 3, size_rtn = 0x7fff4aeb8cec, buf_rtn = 0x7fff4aeb8ce0 tgz_out: win2003.tgz: error in chunked encoding at /usr/bin/virt-tar line 238. closing guestfs handle 0x2e0a600 (state 2) sending SIGTERM to process 10441
Using the case-sensitively correct path works fine: # virt-tar -zx Win2003x32 '/WINDOWS/system32/config' win2003.tgz # ll win2003.tgz -rw-rw-r-- 1 rjones rjones 3587147 2010-01-15 15:26 win2003.tgz
Tip for anyone following this bug. Here is a way to get the right case sensitivity for a path: # echo case-sensitive-path /windows/system32/config | guestfish -i --ro Win2003x32 /WINDOWS/system32/config (Although as I'm sure Matt will be keen to point out, this is something of a hack ...)
This still happens with libguestfs 1.9.18. The error is *not* a protocol/synchronization error. As you can see from the output below, the protocol remains perfectly synchronized. What actually happens is that the tgz-out API call doesn't detect that the underlying tar command has failed and doesn't report the failure error. Example with modern libguestfs: guestfish -d Win7x32 -i -- \ -tgz-out /Windows/System32/Config win.tgz : \ ll / libguestfs: error: file receive cancelled by daemon libguestfs: error: win.tgz: error in chunked encoding total 1834753 drwxrwxrwx 1 root root 0 Sep 19 2010 $Recycle.Bin drwxrwxrwx 1 root root 4096 Nov 1 11:40 . drwxr-xr-x 24 root root 4096 Apr 12 18:28 .. lrwxrwxrwx 2 root root 60 Jul 14 2009 Documents and Settings -> /sysroot//Users [etc]
Still occurs in libguestfs 1.19.64. $ guestfish --ro -a /dev/vg_pin/Win7x32 -i -- -tgz-out /Windows/System32/Config win.tgz : ll / libguestfs: error: file receive cancelled by daemon libguestfs: error: win.tgz: error in chunked encoding total 1834765 drwxrwxrwx 1 root root 0 Sep 19 2010 $Recycle.Bin drwxrwxrwx 1 root root 4096 Nov 1 2011 . drwxr-xr-x 23 500 500 4096 Nov 30 14:52 .. lrwxrwxrwx 2 root root 60 Jul 14 2009 Documents and Settings -> /sysroot/Users drwxrwxrwx 1 root root 0 Jul 14 2009 PerfLogs drwxrwxrwx 1 root root 4096 Jun 1 2011 Program Files drwxrwxrwx 1 root root 4096 Jul 14 2009 ProgramData drwxrwxrwx 1 root root 0 Sep 19 2010 Recovery drwxrwxrwx 1 root root 4096 May 28 2012 System Volume Information drwxrwxrwx 1 root root 0 May 28 2012 Temp drwxrwxrwx 1 root root 4096 Sep 19 2010 Users drwxrwxrwx 1 root root 16384 Oct 12 2011 Windows -rwxrwxrwx 1 root root 24 Jun 10 2009 autoexec.bat -rwxrwxrwx 1 root root 10 Jun 10 2009 config.sys -rwxrwxrwx 1 root root 5052 May 14 2011 fedora.gif -rwxrwxrwx 1 root root 11234 May 14 2011 fedora.png -rwxrwxrwx 1 root root 804995072 Nov 1 2011 hiberfil.sys -rwxrwxrwx 1 root root 1073741824 May 28 2012 pagefile.sys
Looking closely at the code and the protocol, this is essentially "by design". /* Now we must send the reply message, before the file contents. After * this there is no opportunity in the protocol to send any error * message back. Instead we can only cancel the transfer. */ reply (NULL, NULL); while ((r = fread (buf, 1, sizeof buf, fp)) > 0) { if (send_file_write (buf, r) < 0) { pclose (fp); return -1; } } I don't see how this could be fixed except by changing the protocol to allow more information to be passed in a cancel message. Closing this bug as "DEFERRED". We might fix this in the distant future, but for the foreseeable future I'm very wary about making any change to the wire protocol.