Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 731742 - libguestfs should escape special/non-printing characters in debug output
Summary: libguestfs should escape special/non-printing characters in debug output
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs
Version: 6.1
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
Depends On: libguestfs_rebase6.3 731744
TreeView+ depends on / blocked
Reported: 2011-08-18 14:24 UTC by Richard W.M. Jones
Modified: 2012-06-20 06:59 UTC (History)
3 users (show)

Fixed In Version: libguestfs-1.16.2-1.el6
Doc Type: Bug Fix
Doc Text:
No Documentation needed
Clone Of:
: 731744 (view as bug list)
Last Closed: 2012-06-20 06:59:48 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0774 0 normal SHIPPED_LIVE Low: libguestfs security, bug fix, and enhancement update 2012-06-19 19:29:50 UTC

Description Richard W.M. Jones 2011-08-18 14:24:50 UTC
Description of problem:

In seabios- 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:

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


How reproducible:


Steps to Reproduce:
1. Install seabios- (RHEL 6)
2. Install qemu-kvm- (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 12:08:40 UTC
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:


^ This is the correct output if the bug has been fixed.

Comment 4 Qixiang Wan 2012-02-01 06:45:03 UTC
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


[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
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 | ...


2. Check with seabios- + qemu-kvm-
[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

Probing EDD (edd=off to disable)... ok
\x1b[2J\x1b[2JInitializing cgroup subsys cpuset

Comment 5 Richard W.M. Jones 2012-04-26 12:16:27 UTC
    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 06:59:48 UTC
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.


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