[PATCH 2/3] Fix crash caused by passing kwargs to log functions

Vratislav Podzimek vpodzime at redhat.com
Tue Jul 22 19:03:06 UTC 2014


On Tue, 2014-07-22 at 13:03 -0400, David Shea wrote:
> On 07/22/2014 11:53 AM, Vratislav Podzimek wrote:
> > The log take args just like printf, but they don't take kwargs and strings with
> > named parameters instead of positional.
> >
> > Also fix a missing newline in on of the errors.
> >
> > Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> > ---
> >   anaconda | 8 ++++----
> >   1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/anaconda b/anaconda
> > index d2cb5f6..e70f7e8 100755
> > --- a/anaconda
> > +++ b/anaconda
> > @@ -581,7 +581,7 @@ def check_memory(anaconda, options, display_mode=None):
> >       reason_strict = _("%(product_name)s requires %(needed_ram)s MB of memory to "
> >                         "install, but you only have %(total_ram)s MB on this machine.\n")
> >       reason_graphical = _("The %(product_name)s graphical installer requires %(needed_ram)s "
> > -                         "MB of memory, but you only have %(total_ram)s MB.")
> > +                         "MB of memory, but you only have %(total_ram)s MB\n.")
> >   
> >       reboot_extra = _('\n'
> >                        'Press <return> to reboot your system.\n')
> > @@ -615,7 +615,7 @@ def check_memory(anaconda, options, display_mode=None):
> >       if needed_ram > total_ram:
> >           from snack import SnackScreen, ButtonChoiceWindow
> >           if options.liveinst:
> > -            stdoutLog.warning(reason, **reason_args)
> > +            stdoutLog.warning(reason % reason_args)
> >               gtk_warning(livecd_title, reason % reason_args)
> >           else:
> >               reason += reboot_extra
> > @@ -635,13 +635,13 @@ def check_memory(anaconda, options, display_mode=None):
> >           if needed_ram > total_ram:
> >               if options.liveinst:
> >                   reason += livecd_extra
> > -                stdoutLog.warning(reason, **reason_args)
> > +                stdoutLog.warning(reason % reason_args)
> >                   title = livecd_title
> >                   gtk_warning(title, reason % reason_args)
> >                   sys.exit(1)
> >               else:
> >                   reason += nolivecd_extra
> > -                stdoutLog.warning(reason, **reason_args)
> > +                stdoutLog.warning(reason % reason_args)
> >                   anaconda.displayMode = 't'
> >                   time.sleep(2)
> >   
> 
> The three logging lines will need pylint disable=logging-not-lazy
Good point, fixing locally. But I think pylint could detect this.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list