testdrive sets wrong MEM value
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
TestDrive |
Fix Released
|
Medium
|
Dustin Kirkland | ||
testdrive (Ubuntu) |
Fix Released
|
Medium
|
Dustin Kirkland |
Bug Description
I have testdrive 1.15-0ubuntu1~ppa4 installed, and it ends up passing 256 MB of memory when starting kvm if I set MEM in the config file, due to the code:
[ -z "$MEM" ] && [ $(grep "^MemTotal" /proc/meminfo | awk '{print $2}') -gt 1000000 ] && MEM=512 || MEM=256
the && and || operators are left-associative and have the same priority in shell, so this is evaluated as:
( ( [ -z "$MEM" ] && [ $(grep "^MemTotal" /proc/meminfo | awk '{print $2}') -gt 1000000 ] ) && MEM=512 ) || MEM=256
and the initial -z $MEM test ends up being false, so the expression falls through to the MEM=256 part.
I think the fix for this is to rewrite the expression as:
[ -z "$MEM" ] && { [ $(grep "^MemTotal" /proc/meminfo | awk '{print $2}') -gt 1000000 ] && MEM=512 || MEM=256 ; }
ie only do the whole "check MemTotal and default MEM based on that" thing if MEM isn't set in the first place.
Or perhaps make it more explicit and do
if [ -z "$MEM" ]; then
[ $(grep "^MemTotal" /proc/meminfo | awk '{print $2}') -gt 1000000 ] && MEM=512 || MEM=256
fi
Changed in testdrive: | |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in testdrive: | |
status: | Triaged → Fix Committed |
Changed in testdrive (Ubuntu): | |
status: | New → Fix Committed |
importance: | Undecided → Medium |
Changed in testdrive: | |
assignee: | nobody → Dustin Kirkland (kirkland) |
Changed in testdrive (Ubuntu): | |
assignee: | nobody → Dustin Kirkland (kirkland) |
Changed in testdrive: | |
status: | Fix Committed → Fix Released |
Changed in testdrive: | |
status: | New → Confirmed |
Changed in testdrive: | |
status: | Confirmed → Fix Committed |
Changed in testdrive: | |
status: | Fix Committed → Fix Released |
This bug was fixed in the package testdrive - 1.17-0ubuntu1
---------------
testdrive (1.17-0ubuntu1) lucid; urgency=low
* testdrive- select- iso, testdriverc: netbook remix no longer "remix",
LP: #505909
* testdrive: fix MEM setting logic, LP: #497499
-- Dustin Kirkland <email address hidden> Tue, 12 Jan 2010 14:55:34 -0600