Linux Archive

Linux Archive (
-   Fedora Packaging (
-   -   Fix "memcheck=0" (and other store_true boot args) (

Will Woods 04-04-2012 09:07 PM

Fix "memcheck=0" (and other store_true boot args)
optparse.Option will ignore the value for options that have the action
"store_true" or "store_false". This is fine if the boolean values match,
but wrong otherwise (e.g. memcheck=yes sets memcheck=True, but so does

So: if we have a store_true option with a value that's False, skip the
normal behavior and just set the value to False.

As for store_false.. all our existing "store_false" options start with
"no", which means that negating them yields a double-negative
(e.g. nomemcheck=yes). We've decided that's just too confusing to
accept. so nomemcheck=yes should still set memcheck=False. So we don't
need to do anything special for "store_false".
anaconda | 6 +++++-
pyanaconda/ | 4 ++++
2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/anaconda b/anaconda
index 6a673b1..0a214dc 100755
--- a/anaconda
+++ b/anaconda
@@ -192,6 +192,10 @@ def parseOptions(argv=None, cmdline=None):
op = AnacondaOptionParser(version="%prog " + getAnacondaVersion(),
bootarg_prefix="inst.", require_prefix=False)

+ # NOTE: store_false options will *not* get negated when the user does
+ # "option=0" on the boot commandline (store_true options do, though).
+ # Basically, don't use store_false unless the option starts with "no".
# Interface
op.add_option("-C", "--cmdline", dest="display_mode", action="store_const", const="c",
@@ -262,7 +266,7 @@ def parseOptions(argv=None, cmdline=None):
op.add_option("--dlabel", action="store_true", default=False)
op.add_option("--image", action="append", dest="images", default=[])
op.add_option("--memcheck", action="store_true", default=True)
- op.add_option("--no-memcheck", action="store_false", dest="memcheck")
+ op.add_option("--nomemcheck", action="store_false", dest="memcheck")

# some defaults change based on cmdline flags
if cmdline is not None:
diff --git a/pyanaconda/ b/pyanaconda/
index 7653716..ccb0361 100644
--- a/pyanaconda/
+++ b/pyanaconda/
@@ -107,6 +107,10 @@ class AnacondaOptionParser(OptionParser):
if option.takes_value() and val is None:
continue # TODO: emit a warning or something there?
+ if option.action == "store_true" and val in ("0", "no", "off"):
+ # special case: "mpath=0" would otherwise set mpath to True
+ setattr(values, option.dest, False)
+ continue
option.process(arg, val, values, self)
return values


Anaconda-devel-list mailing list

All times are GMT. The time now is 11:36 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.