This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 639587 - virsh freecell' prints the available amount of memory even if an invalid cellno is specified.
virsh freecell' prints the available amount of memory even if an invalid cell...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.1
All Linux
low Severity medium
: rc
: ---
Assigned To: Michal Privoznik
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-10-02 07:39 EDT by Humble Chirammal
Modified: 2015-09-27 22:20 EDT (History)
8 users (show)

See Also:
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.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-05-19 09:22:16 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 Humble Chirammal 2010-10-02 07:39:23 EDT
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 02:30:46 EST
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 03:10:19 EDT
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 04:54:22 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:
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 02:34:49 EDT
    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 03:28:16 EDT
* 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 09:22:16 EDT
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.