Bug 588658

Summary: some guestfish cmds give improper error message when exceeding internal buffer size
Product: [Community] Virtualization Tools Reporter: Pengzhen Cao <pcao>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: mbooth, yuzhang
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-05-12 16:32:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Pengzhen Cao 2010-05-04 08:36:53 UTC
Description of problem:
some guestfish cmds, (like strings, hexdump, strings-e, head-n, tail-n), does not give proper error message when the return msg exceed internal XDR buffer size.

Version-Release number of selected component (if applicable):
libguestfs-1.0.85-1.fc12.3.x86_64


How reproducible:
100%

Steps to Reproduce:
1. run guestfish, add a image, run , mount it
2. run hexdump  /your_file, whre "your_file" is a file larger than 900KB or so.
Or head-n 100000 /long_file

  
Actual results:
error msg:" libguestfs: error: hexdump: guestfsd: failed to encode reply body : Success"

Expected results:
Should be error msg say "file too large" or "exceed buffer limit" etc ,just like "more/cat" cmd

Additional info:

Comment 1 Richard W.M. Jones 2010-05-12 16:32:13 UTC
This is fixed in the latest upstream version of libguestfs:

$ guestfish -N fs -m /dev/sda1
><fs> fill-pattern abcdefg 10000000 /test
><fs> strings /test
libguestfs: error: strings: guestfsd: failed to encode reply body
(maybe the reply exceeds the maximum message size in the protocol?)
><fs> hexdump /test
libguestfs: error: hexdump: guestfsd: failed to encode reply body
(maybe the reply exceeds the maximum message size in the protocol?)
><fs> head /test
libguestfs: error: head: guestfsd: failed to encode reply body
(maybe the reply exceeds the maximum message size in the protocol?)

Comment 2 Richard W.M. Jones 2013-06-03 10:02:36 UTC
Note that 'hexdump -C' compresses repeated patterns.

So to reproduce this, use 'fill-pattern' with a pattern
length that doesn't divide 16.  For example a pattern length
of 2 gives:

><fs> fill-pattern "\xfe\xfd" 900K /foo
><fs> hexdump /foo 
00000000  fe fd fe fd fe fd fe fd  fe fd fe fd fe fd fe fd  |................|
*
000e1000

but a pattern length of 3 (3 does not divide 16) gives:

><fs> fill-pattern "\xfe\xfd\xfc" 900K /foo
><fs> hexdump /foo 
libguestfs: error: hexdump: guestfsd: failed to encode reply body
(maybe the reply exceeds the maximum message size in the protocol?)