Bug 1281577

Summary: virt-inspector --xpath segfault on attribute get
Product: [Community] Virtualization Tools Reporter: Richard Tollerton <rich.tollerton>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: low Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: ptoscano, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-13 19:00:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Richard Tollerton 2015-11-12 20:42:56 UTC
`virsh dumpxml dom | xmlstarlet sel -t -v '//domain/devices/interface[1]/mac/@address'` does what I'd expect and prints out the MAC. But `virsh dumpxml dom | virt-inspector --xpath '//domain/devices/interface[1]/mac/@address'` segfaults.

Stack trace:

#0  0x00007ffff6fb7ac4 in free () from /usr/lib/libc.so.6
#1  0x00007ffff75538d9 in xmlFreeNodeList () from /usr/lib/libxml2.so.2
#2  0x00007ffff7553696 in xmlFreeDoc () from /usr/lib/libxml2.so.2
#3  0x0000000000409dcc in guestfs_int_cleanup_xmlFreeDoc (ptr=0x7fffffffdc28)
    at cleanup.c:87
#4  0x0000000000409be2 in do_xpath (
    query=0x7fffffffe1a6 "//domain/devices/interface[1]/mac/@address")
    at inspector.c:805
#5  0x0000000000406f30 in main (argc=3, argv=0x7fffffffddd8) at inspector.c:250


Running version 1.30.4 on archlinux.

Comment 1 Richard W.M. Jones 2015-11-12 22:15:30 UTC
I can reproduce this on 1.31.25 too.

Comment 2 Richard W.M. Jones 2015-11-12 22:43:35 UTC
Patch posted:
https://www.redhat.com/archives/libguestfs/2015-November/msg00133.html

Comment 3 Richard Tollerton 2015-11-13 18:48:16 UTC
I've validated the fix in a build from master.

Comment 4 Richard W.M. Jones 2015-11-13 19:00:21 UTC
Fixed in 1.31.26.