RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 889276 - virsh reports no error message when using empty string as arguments for some command options
Summary: virsh reports no error message when using empty string as arguments for some ...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.5
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 894447 1002490 (view as bug list)
Depends On:
Blocks: 894447
TreeView+ depends on / blocked
 
Reported: 2012-12-20 16:50 UTC by Chris Evich
Modified: 2014-04-04 20:59 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 894447 (view as bug list)
Environment:
Last Closed: 2014-04-04 20:59:18 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Chris Evich 2012-12-20 16:50:33 UTC
Description of problem:
When operating within the virsh shell (as opposed to executing single virsh command), error text is often printed with invalid commands or failed operations.  However, in one case the 'net-create' command does not print any error.  Although executing it as a single virsh command does exit(1).  This is a devition from it's RHEL 5 behavior where it does print an error message in both cases (command-line and in-shell)

Version-Release number of selected component (if applicable):
0.9.10-21.el6_3.6

How reproducible:
100%

Steps to Reproduce:
1. virsh
2. net-create ""
  
Actual results:
Blank line then 'virsh#' prompt is presented

Expected results:
Similar to RHEL 5, an error message is printed:

error: command 'net-create' requires <file> option

Additional info:
Bug discovered with libvirt autotest

Comment 2 RHEL Program Management 2012-12-24 06:52:34 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 3 Chris Evich 2013-01-07 15:48:11 UTC
Re-proposed for 6.5

Comment 4 Alex Jia 2013-01-08 02:17:07 UTC
It should be a common issue for virsh command, and I can confirm this question on 
libvirt-0.10.2-14.el6.x86_64, for example,

[root@201 autotest]# virsh net-create ""

[root@201 autotest]# echo $?
1

[root@201 autotest]# virsh domblkstat foo ''

[root@201 autotest]# echo $?
1

And I can't also find a error message in libvirtd.log.

Comment 5 Alex Jia 2013-01-08 02:35:50 UTC
The shell programming should parse single/double quotation firstly, so users probably need to use '\' to escape these special characters, for instance,

[root@201 autotest]# virsh domblkstat foo \'\'
error: Failed to get block stats foo ''
error: invalid argument: invalid path: ''

And I can see a expected error message in libvirtd.log:

<slice>

2013-01-08 02:21:12.012+0000: 10249: debug : virDrvSupportsFeature:1505 : conn=0x7fb6340096b0, feature=9
2013-01-08 02:21:12.012+0000: 10242: debug : virDomainBlockStatsFlags:7280 : dom=0x7fb630056f30, (VM: name=foo-2, uuid=cae86633-904f-1c90-6bc4-9c579f70e699), disk='', params=(nil), nparams=0, flags=4
2013-01-08 02:21:12.018+0000: 10242: debug : virDomainFree:2281 : dom=0x7fb630056f30, (VM: name=foo-2, uuid=cae86633-904f-1c90-6bc4-9c579f70e699)
2013-01-08 02:21:12.019+0000: 10241: debug : virDrvSupportsFeature:1505 : conn=0x7fb6340096b0, feature=9
2013-01-08 02:21:12.019+0000: 10244: debug : virDomainBlockStatsFlags:7280 : dom=0x7fb63c132680, (VM: name=foo-2, uuid=cae86633-904f-1c90-6bc4-9c579f70e699), disk='', params=0x7fb63c299e80, nparams=8, flags=4
2013-01-08 02:21:12.019+0000: 10244: error : qemuDomainBlockStatsFlags:8626 : invalid argument: invalid path: ''
2013-01-08 02:21:12.019+0000: 10244: debug : virDomainFree:2281 : dom=0x7fb63c132680, (VM: name=foo-2, uuid=cae86633-904f-1c90-6bc4-9c579f70e699)
2013-01-08 02:21:12.021+0000: 10239: debug : virConnectClose:1449 : conn=0x7fb6340096b0

</slice>

Maybe, we just need to document this for users.

Comment 6 Eric Blake 2013-01-08 13:34:22 UTC
(In reply to comment #5)
> The shell programming should parse single/double quotation firstly, so users
> probably need to use '\' to escape these special characters, for instance,
> 
> [root@201 autotest]# virsh domblkstat foo \'\'
> error: Failed to get block stats foo ''
> error: invalid argument: invalid path: ''

That's a different argument.  Libvirt is properly rejecting single quotes, what it is not rejecting is an empty string argument.  It should be consistent and reject both, since it really should not be possible to create a disk with an empty string name.

> 
> Maybe, we just need to document this for users.

No, it is more than just a documentation bug, although it is still a corner case and not the most urgent of fixes.

Comment 7 Chris Evich 2013-01-11 18:51:49 UTC
Found the domblkstat command has similar behavior, opened Bug # 894447 to cover that in case solution is different.

Comment 8 Peter Krempa 2013-01-14 13:51:59 UTC
This is a widespread issue. virsh isn't reporting errors on empty strings. I'm rephrasing the summary to fix all the issues to avoid additional bugs.

Comment 9 Peter Krempa 2013-01-14 13:52:13 UTC
*** Bug 894447 has been marked as a duplicate of this bug. ***

Comment 10 Chris Evich 2013-01-24 15:19:18 UTC
(In reply to comment #8)
> This is a widespread issue. virsh isn't reporting errors on empty strings.
> I'm rephrasing the summary to fix all the issues to avoid additional bugs.

Worse actually because it use to (in version shipped with RHEL5).  This could lead someone to (superficially) believe an operation fails on RHEL 5 but works on RHEL 6 (unless they check the exit code).

Comment 11 Chris Evich 2013-01-28 17:59:46 UTC
Add 'domid' to the list of virsh commands with this erronous behavior in RHEL 6.

Comment 12 Chris Evich 2013-01-28 18:16:54 UTC
virsh dominfo is another one.

Comment 13 Peter Krempa 2013-01-28 18:22:44 UTC
I posted a big series that should kill all improper access of strings in virsh:

http://www.redhat.com/archives/libvir-list/2013-January/msg01438.html

Comment 14 Peter Krempa 2013-02-04 13:37:39 UTC
The issues should be fixed upstream by commits:

fbe2d49 virsh-secret: Refactor error paths
05af594 virsh-nwfilter: Update nwfilter commands to use vshCommandOptStringReq
b2e8585 virsh-snapshot: Update snapshot commands to use vshCommandOptStringReq
351f7a2 virsh-snapshot: Refactor cmdSnapshotDumpXML
e9dc073 virsh-nodedev: Refactor error paths, error messages and whitespace
7c5c51d virsh-nodedev: Update node device commands to use vshCommandOptStringReq
56dc64c virsh-interface: Update interface commands to use vshCommandOptStringReq
4e31e73 virsh-network: Update network commands to use vshCommandOptStringReq
edbdc45 virsh-host: Update host commands to use vshCommandOptStringReq
fa956d9 virsh-domain: Update domain commands to use vshCommandOptStringReq
f605be8 virsh-domain-monitor: Update domain commands to use vshCommandOptStringReq
1daa4ba virsh-volume: Update volume commands to use vshCommandOptStringReq
98007c8 virsh-pool: Update pool commands to use vshCommandOptStringReq
41b5e84 virsh: Add helper to request string arguments with error reporting

in version: v1.0.2-38-gfbe2d49

Comment 16 Jiri Denemark 2013-09-04 13:41:44 UTC
*** Bug 1002490 has been marked as a duplicate of this bug. ***

Comment 19 RHEL Program Management 2014-04-04 20:59:18 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.


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