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 639587 - virsh freecell' prints the available amount of memory even if an invalid cellno is specified.
Summary: virsh freecell' prints the available amount of memory even if an invalid cell...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.1
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-10-02 11:39 UTC by Humble Chirammal
Modified: 2018-11-14 19:51 UTC (History)
8 users (show)

Fixed In Version: libvirt-0.8.7-11.el6
Doc Type: Bug Fix
Doc Text:
The "virsh freecell" command could be run with an invalid (non-integer) argument without error, and the free memory for node 0 would still be printed. The validity of the argument is now checked, and an error message is now printed when an invalid value is detected.
Clone Of:
Environment:
Last Closed: 2011-05-19 13:22:16 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0596 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-05-18 17:56:36 UTC

Description Humble Chirammal 2010-10-02 11:39:23 UTC
Description of problem:


The command #virsh freecell" prints the available amount of memory even if
an invalid cellno is specified. Please see below.

# virsh freecell foo0000
0: 3121480 kB

As you see, it works well even if an invalid cellno "foo" is
specified. According to virsh's man page, freecell accepts nothing
but cellno as its argument. If anything but cellno is specified,
"virsh freecell" should report an error message as well as general
commands. 

It seems that a "virsh" bug .

Version-Release number of selected component:

Red Hat Enterprise Linux Version Number: 6
Release Number: snapshot13
Architecture: x86_64
Kernel Version: kernel-2.6.32-70.el6.x86_64
Related Package Version: libvirt-client-0.8.1-27.el6.x86_64

How reproducible:

Always

Steps to reproduce:


1. Just run "virsh freecell" with an invalid cellno.
# virsh freecell foo

Actual Results:
"virsh freecell" prints the available amount of memory.

Expected Results:
"virsh freecell" fails with an error message.

--Humble

Comment 9 Min Zhan 2011-03-11 07:30:46 UTC
Verified with Passed with below environment:
libvirt-0.8.7-11.el6
qemu-kvm-0.12.1.2-2.150.el6
kernel-2.6.32-120.el6
# uname -a
Linux dhcp-65-85.nay.redhat.com 2.6.32-120.el6.x86_64 #1 SMP Mon Mar 7 11:59:40 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

Steps:

# virsh freecell
Total: 5994588 kB

# virsh freecell --cellno 0
0: 5990484 kB

# virsh freecell foo000
error: unexpected data 'foo000'

# virsh freecell foo
error: unexpected data 'foo'

# virsh freecell 0
error: unexpected data '0'


----------------
I can reproduce this bug with libvirt-0.8.1-27.el6.x86_64.

Comment 10 Min Zhan 2011-04-18 07:10:19 UTC
Verified with Passed with below environment:
libvirt-0.8.7-17.el6
qemu-kvm-0.12.1.2-2.158.el6.x86_64
# uname -a
Linux localhost.localdomain 2.6.32-131.0.1.el6.x86_64 #1 SMP Tue Apr 12 16:40:23 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux

And there is a bug 693963 tracking problem below:

# virsh freecell --cellno 0
0: 7441144 kB

# virsh freecell 0
error: unexpected data '0'

Comment 11 Michal Privoznik 2011-04-28 08:54:22 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:
Cause:
 run virsh freecell with non-integer value
Consequence:
 virsh print free memory for node 0
Fix:
 Changed parsing functions of optional arguments so we can detect if given argument is (in-)valid as well.
Result:
 virsh prints error message about argument being non-integer

Comment 14 Laura Bailey 2011-05-04 06:34:49 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,8 +1 @@
-Cause:
+The "virsh freecell" command could be run with an invalid (non-integer) argument without error, and the free memory for node 0 would still be printed. The validity of the argument is now checked, and an error message is now printed when an invalid value is detected.- run virsh freecell with non-integer value
-Consequence:
- virsh print free memory for node 0
-Fix:
- Changed parsing functions of optional arguments so we can detect if given argument is (in-)valid as well.
-Result:
- virsh prints error message about argument being non-integer

Comment 15 Michal Privoznik 2011-05-04 07:28:16 UTC
* The problem was we didn't parse the arguments right, the parsing functions returned the value of argument by value instead of reference, so we were not able to detect situations for incorrect argument.

* Which led to a situation when incorrect argument given was treated like 0

* We changed the parsing functions, so we can now distinguish cases like that

* So what will user see now is error message about incorrect argument specified

Comment 16 errata-xmlrpc 2011-05-19 13:22:16 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0596.html


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