Bug 731742 - libguestfs should escape special/non-printing characters in debug output
libguestfs should escape special/non-printing characters in debug output
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs (Show other bugs)
6.1
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
:
Depends On: libguestfs_rebase6.3 731744
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-18 10:24 EDT by Richard W.M. Jones
Modified: 2012-06-20 02:59 EDT (History)
3 users (show)

See Also:
Fixed In Version: libguestfs-1.16.2-1.el6
Doc Type: Bug Fix
Doc Text:
No Documentation needed
Story Points: ---
Clone Of:
: 731744 (view as bug list)
Environment:
Last Closed: 2012-06-20 02:59:48 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2011-08-18 10:24:50 EDT
Description of problem:

In seabios-0.6.1.2-4.el6.x86_64 from RHEL 6.2 the BIOS prints
special control characters to clear the screen etc.  Some lame
attempt at a splash screen.

Unfortunately libguestfs in debug mode (LIBGUESTFS_DEBUG=1)
simply echos these characters straight to stderr, meaning that
you see the screen being cleared and so on.

libguestfs should strip or escape these special characters in
its default debug mode.

Also we should document this here:
http://libguestfs.org/guestfs.3.html#guestfs_event_callback

Version-Release number of selected component (if applicable):

libguestfs-1.7.17-26.el6.x86_64

How reproducible:

100%

Steps to Reproduce:
1. Install seabios-0.6.1.2-4.el6.x86_64 (RHEL 6)
2. Install qemu-kvm-0.12.1.2-2.183.el6.x86_64 (RHEL 6)
3. Run guestfish -a /dev/null run -v
  
Actual results:

Observe that early in the debug output the screen is cleared.

Expected results:

The control characters should be escaped.

Additional info:

Since this is annoying rather than serious, I'm going to defer
it to RHEL 6.3 and make it dependent on the rebase bug.
Comment 2 Richard W.M. Jones 2011-12-06 07:08:40 EST
Upstream commit is 06019bc82e107f7715ebc59e491610e06dad1e39.

This is pretty easy to test:

guestfish -a /dev/null -v
><fs> run

[Lots of appliance boot messages]

Now type the command below precisely at the guestfish prompt:

debug sh 'echo -e "\\x01\\x01" >&2'

There are two possible outputs that can happen for libguestfs
in RHEL >= 6.2.  If no escaping is being applied (ie. the bug
is present), then you will see TWO lines of garbage output:




The first line comes from the appliance and is not being
escaped.  The second line is the output of guestfish which
should not be escaped.

If escaping is being applied, then the first line ONLY will
be escaped:

\x1\x1


^ This is the correct output if the bug has been fixed.
Comment 4 Qixiang Wan 2012-02-01 01:45:03 EST
Verified with libguestfs-1.16.2-1.el6.x86_64.

1. Tested as comment 2:
[1]. using libguestfs-1.7.17-26.el6.x86_64:

><fs> debug sh 'echo -e "\\x01\\x01" >&2'
send_to_daemon: 0x15d61b0 g->state = 3, n = 96
recv_from_daemon: 0x15d61b0 g->state = 3, size_rtn = 0x7fff32ad739c, buf_rtn = 0x7fff32ad7390
/bin/sh -c echo -e "\\x01\\x01" >&2


><fs> 

[2]. using libguestfs-1.16.2-1.el6.x86_64

><fs> debug sh 'echo -e "\\x01\\x01" >&2'
libguestfs: send_to_daemon: 96 bytes: 00 00 00 5c | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 4c | 00 00 00 00 | ...
guestfsd: main_loop: new request, len 0x5c
/bin/sh -c echo -e "\\x01\\x01" >&2
\x1\x1
guestfsd: main_loop: proc 76 (debug) took 0.00 seconds
libguestfs: recv_from_daemon: 48 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 4c | 00 00 00 01 | 00 12 34 01 | ...

><fs> 

2. Check with seabios-0.6.1.2-8.el6.x86_64 + qemu-kvm-0.12.1.2-2.209.el6.x86_64:
[1] Before the fix, early in the debug output the screen is cleared.
[2] After the fix, the control characters are escaped as following:
[...]
SeaBIOS (version 0.6.1.2-20111101_081028-x86-007.build.bos.redhat.com)

Probing EDD (edd=off to disable)... ok
\x1b[2J\x1b[2JInitializing cgroup subsys cpuset
[...]
Comment 5 Richard W.M. Jones 2012-04-26 08:16:27 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No Documentation needed
Comment 7 errata-xmlrpc 2012-06-20 02:59:48 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-0774.html

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