smart info UnicodeEncodeError

Bug #244004 reported by Rehan Khan
20
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Smart Package Manager
Fix Released
Undecided
Unassigned
Revision history for this message
Rehan Khan (rasker) wrote :

Issue 354. Only pertinent file attached.

msg1281 (view) Author: netmask Date: 2008-01-09.10:34:24

Hi sapex,

For the first reported issue, this is a duplicate of issue52. Known bug not
fixed yet. It happens when there is an accentuated character in the repository
data files.

For the second issue, this is a packaging bug, as it happens on a script that is
called during the package install, nor Smart itself. I would suggest you report
that upstream to your distribution.

I'm closing this issue as duplicate. Please, let me know if you still have
questions.

msg1280 (view) Author: sapex Date: 2008-01-07.19:41:40

I also get some error messages, if i want to delete one specific package. I
don't know, whether it is a Smart related problem or not. I installed that
package with Smart.

msg1279 (view) Author: sapex Date: 2008-01-06.19:03:51

After running the command "smart search rar", i get some error messages
following the output. Have a look at the file. This happens with smart-0.52-
5.1.i586.rpm and smart-0.52-26.1.i585.rpm (openSUSE 10.2 i586). I don't know,
whether it happens before.

Revision history for this message
Rehan Khan (rasker) wrote :
Download full text (4.4 KiB)

Issue 52.

msg961 (view) Author: dfarning Date: 2006-11-20.21:04:45

Is this still an issue? I can not reproduce on ubuntu 6.10. Does python handle
Unicode better now? Ubuntu 6.10 runs python 2.4.

Dave

msg155 (view) Author: seventyfour Date: 2005-12-06.14:53:52

The only variable set is LANG and it is set to: en_US.UTF-8

This is the rpm -qi for the package (policycoreutils) I believe is crashing it.

Name : policycoreutils Relocations: /usr
Version : 1.18.1 Vendor: Red Hat, Inc.
Release : 4.3 Build Date: Tue 01 Mar 2005 10:55:22
AM EST
Install Date: Thu 27 Oct 2005 07:12:07 PM EDT Build Host:
dolly.build.redhat.com
Group : System Environment/Base Source RPM:
policycoreutils-1.18.1-4.3.src.rpm
Size : 92425 License: GPL
Signature : DSA/SHA1, Mon 25 Apr 2005 05:50:49 PM EDT, Key ID 219180cddb42a60e
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Summary : SELinux policy core utilities.
Description :
Security-enhanced Linux is a patch of the Linux® kernel and a number
of utilities with enhanced security functionality designed to add
mandatory access controls to Linux. The Security-enhanced Linux
kernel contains new architectural components originally developed to
improve the security of the Flask operating system. These
architectural components provide general support for the enforcement
of many kinds of mandatory access control policies, including those
based on the concepts of Type Enforcement®, Role-based Access
Control, and Multi-level Security.

policycoreutils contains the policy core utilities that are required
for basic operation of a SELinux system. These utilities include
load_policy to load policies, setfiles to label filesystems, newrole
to switch roles, and run_init to run /etc/init.d scripts in the proper
context.

It dies when it hits the description field. I'm guessing its the ® characters
that it is having problems with. Something else to note is that smart has no
problem with "smart info policycoreutils" The problem only arises when I do a
full listing using just "smart info".

When I direct the output of "smart info" to a log, this is what I'm seeing:

Name: policycoreutils
Version: 1.18.1-4.7@i386
Priority: 0
Group: System Environment/Base
Installed Size: 74.8kB
Reference URLs:
Flags:
Channels: kickstart
Summary: SELinux policy core utilities.
Description:
 Traceback (most recent call last):
  File "/usr/bin/smart", line 193, in ?
    main(sys.argv[1:])
  File "/usr/bin/smart", line 166, in main
    exitcode = iface.run(opts.command, opts.argv)
  File "/usr/lib64/python2.3/site-packages/smart/interface.py", line 53, in run
    result = _command.main(self._ctrl, opts)
  File "/usr/lib64/python2.3/site-packages/smart/commands/info.py", line 131, in
main
    print "", line
UnicodeEncodeError: 'ascii' codec can't encode character u'\xae' in position 47:
ordinal not in range(128)

msg150 (view) Author: niemeyer Date: 2005-12-06.02:17:18

> 131c131
> < print "", line
> ---
> > print "", line.encode('ascii', 'ignore')

That's a nice ...

Read more...

Changed in smart:
milestone: none → 1.3.1
Revision history for this message
Anders F Björklund (afb) wrote :

When the locale is either of "C" or "en_US", smart fails to find a localedir for translation:
[Errno 2] No translation file found for domain: 'smart'
This causes the current code to skip(!) setting the preferred encoding and replace errors,
but instead use whatever the current encoding and std errors are (usually 'strict', i.e.raise)

So when outputting to the console, it will use either "US-ASCII" (for C) or "UTF-8"
(for en_US.UTF-8). Where ascii will only work if all info characters are in range(128).
But when directing to a file or pipe, the default encoding is "None" for *both* locales.
And thus it will raise a UnicodeEncodeError on any non-ascii, as per errors="strict"...

Changed in smart:
status: New → Fix Committed
Changed in smart:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.