Hi all!

We were not checking for possible errors while converting to utf-8. I have attached a patch for the same. The patch was generated using 'git diff'.
        This is my first patch. Hope I generated it the right way :)

Kulbir Saini wrote:
Hi all!
    I am a newbie trying to learn yum to participate in regular
development. I was using yum shell and trying out random commands. The
'info' command seems broken in latest source. Below is the error trace.

    I did this with latest yum source which was pulled 5 minutes ago.

[EMAIL PROTECTED] yum]$ ./yummain.py shell

Setting up Yum Shell
info ipw2200-firmware
Installed Packages
Name       : ipw2200-firmware
Arch       : noarch
Version    : 3.0
Release    : 9.at
Size       : 575 k
Repo       : installed
Traceback (most recent call last):
  File "./yummain.py", line 243, in <module>
    user_main(sys.argv[1:], exit_code=True)
  File "./yummain.py", line 236, in user_main
    errcode = main(args)
  File "./yummain.py", line 111, in main
    result, resultmsgs = base.doCommands()
  File "/home2/Studies/project/btp/yum/cli.py", line 309, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self,
self.basecmd, self.extcmds)
  File "/home2/Studies/project/btp/yum/yumcommands.py", line 589, in
doCommand
    return base.doShell()
  File "/home2/Studies/project/btp/yum/cli.py", line 252, in doShell
    yumshell.cmdloop()
  File "/usr/lib/python2.5/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib/python2.5/cmd.py", line 218, in onecmd
    return self.default(line)
  File "/home2/Studies/project/btp/yum/shell.py", line 101, in default
    self.base.doCommands()
  File "/home2/Studies/project/btp/yum/cli.py", line 309, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self,
self.basecmd, self.extcmds)
  File "/home2/Studies/project/btp/yum/yumcommands.py", line 212, in
doCommand
    rip = base.listPkgs(ypl.installed, _('Installed Packages'), basecmd)
  File "/home2/Studies/project/btp/yum/output.py", line 336, in listPkgs
    self.infoOutput(pkg)
  File "/home2/Studies/project/btp/yum/output.py", line 303, in infoOutput
    print self.fmtKeyValFill(_("Summary    : "), enc(pkg.summary))
  File "/home2/Studies/project/btp/yum/output.py", line 291, in enc
    s = unicode(s, "UTF-8")
  File "/usr/lib/python2.5/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xae in position 22:
unexpected code byte
[EMAIL PROTECTED] yum]$



--
---------------------------------------------------
Thank you,
Kulbir Saini,
Computer Science and Engineering,
International Institute of Information Technology,
Hyderbad, India - 500032.

My Home-Page: http://saini.co.in/
My Institute: http://www.iiit.ac.in/
My Linux-Blog: http://linux.saini.co.in/

IRC nick : generalBordeaux
Channels : #fedora, #fedora-devel, #yum on freenode


diff --git a/output.py b/output.py
index 1f0d59e..11f63c6 100644
--- a/output.py
+++ b/output.py
@@ -288,8 +288,10 @@ class YumOutput:
                     if t != s:
                         s = t
                         break
-            s = unicode(s, "UTF-8")
-            return s
+            try:
+                return unicode(s, "UTF-8")
+            except:
+                return s
         print _("Name       : %s") % pkg.name
         print _("Arch       : %s") % pkg.arch
         if pkg.epoch != "0":
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to