Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 452178

Summary: app-misc/pax-utils: w/python3: lddtree.py passes unicode buffers to pyelftools which expects byte buffers
Product: Gentoo Linux Reporter: Oleh <moonlapse81>
Component: [OLD] Core systemAssignee: SpanKY <vapier>
Status: RESOLVED FIXED    
Severity: normal CC: arfrever.fta, cornicx, d.saade, solar, ssuominen
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: proposed patch

Description Oleh 2013-01-15 06:04:41 UTC
ELFFile class from dev-python/pyelftools requires bytes argument, but lddtree from app-misc/pax-utils passes unicode argument.

Reproducible: Always

Actual Results:  
File "/usr/bin/lddtree", line 450, in <module>
    sys.exit(main(sys.argv))
  File "/usr/bin/lddtree", line 437, in main
    elf = ParseELF(path, options.root, ldpaths)
  File "/usr/bin/lddtree", line 235, in ParseELF
    elf = ELFFile(f)
  File "/usr/lib64/python3.2/site-packages/elftools/elf/elffile.py", line 47, in __init__
    self._identify_file()
  File "/usr/lib64/python3.2/site-packages/elftools/elf/elffile.py", line 177, in _identify_file
    magic = self.stream.read(4)
  File "/usr/lib64/python3.2/codecs.py", line 300, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd8 in position 40: invalid continuation byte
Comment 1 Oleh 2013-01-15 06:06:34 UTC
Created attachment 335680 [details, diff]
proposed patch

patch by Arfrever, fixed the issue.
Comment 3 SpanKY gentoo-dev 2013-04-07 19:05:34 UTC
*** Bug 464828 has been marked as a duplicate of this bug. ***
Comment 4 tman 2013-04-08 07:37:27 UTC
its seem to be not fixed. because i still have this problem:

* Gentoo Linux Genkernel; Version 3.4.44.2
* Running with options: --oldconfig --menuconfig all

* Using genkernel.conf from /etc/genkernel.conf
* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86_64/config.sh ..
* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86_64/modules_load ..

* Linux Kernel 3.8.6-gentoo for x86_64...
* .. with config file /etc/kernels/kernel-config-x86_64-3.8.6-gentoo
* kernel: --mrproper is disabled; not running 'make mrproper'.
*         >> Running oldconfig...
* kernel: --clean is disabled; not running 'make clean'.
* kernel: >> Invoking menuconfig...


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

*         >> Compiling 3.8.6-gentoo bzImage...
*         >> Not installing firmware as it's included in the kernel already (CONFIG_FIRMWARE_IN_KERNEL=y)...
*         >> Compiling 3.8.6-gentoo modules...
*         >> Generating module dependency data...
* Copying config for successful build to /etc/kernels/kernel-config-x86_64-3.8.6-gentoo
* busybox: >> Using cache
* initramfs: >> Initializing...
*         >> Appending base_layout cpio data...
*         >> Appending auxilary cpio data...
*         >> Copying keymaps
*         >> Appending busybox cpio data...
*         >> Appending modules cpio data...
*         >> Appending blkid cpio data...
Traceback (most recent call last):
  File "/usr/bin/lddtree", line 647, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/bin/lddtree", line 616, in main
    elf = ParseELF(p, options.root, ldpaths)
  File "/usr/bin/lddtree", line 328, in ParseELF
    for t in segment.iter_tags():
  File "/usr/lib64/python3.2/site-packages/elftools/elf/dynamic.py", line 63, in iter_tags
    tag = self.get_tag(n)
  File "/usr/lib64/python3.2/site-packages/elftools/elf/dynamic.py", line 77, in get_tag
    return DynamicTag(entry, self._elffile)
  File "/usr/lib64/python3.2/site-packages/elftools/elf/dynamic.py", line 32, in __init__
    setattr(self, entry.d_tag[3:].lower(), dynstr.get_string(self.entry.d_val))
AttributeError: 'NoneType' object has no attribute 'get_string'
*         >> Appending modprobed cpio data...
*         >> Compressing cpio data (.xz)...
* 
* Kernel compiled successfully!
* 
* Required Kernel Parameters:
*     real_root=/dev/$ROOT



at the moment: 

[I] app-misc/pax-utils
     Available versions:  0.2.1 0.2.2 0.2.3 (~)0.3.0 0.4 (~)0.5 (~)0.6 (~)0.7 {caps python}
     Installed versions:  0.7(08:00:05 04/08/13)(caps python)
     Homepage:            http://hardened.gentoo.org/pax-utils.xml
     Description:         ELF related utils for ELF 32/64 binaries that can check files for security relevant properties



Portage 2.1.11.60 (default/linux/amd64/13.0/desktop, gcc-4.7.2, glibc-2.17, 3.8.6-gentoo x86_64)
=================================================================
System uname: Linux-3.8.6-gentoo-x86_64-Intel-R-_Core-TM-_i7-3740QM_CPU_@_2.70GHz-with-gentoo-2.2
KiB Mem:    24627888 total,  11544224 free
KiB Swap:   25081852 total,  25081852 free
Timestamp of tree: Mon, 08 Apr 2013 05:30:01 +0000
ld GNU ld (GNU Binutils) 2.23.1
app-shells/bash:          4.2_p45
dev-java/java-config:     2.1.12-r1
dev-lang/python:          2.7.3-r3, 3.2.3-r2
dev-util/cmake:           2.8.10.2-r1
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8::pentoo
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.6, 1.13.1
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.6.3, 4.7.2-r1
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r5::gnome
sys-kernel/linux-headers: 3.8 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo mpd nikai ruby mgorny poly-c pentoo luman qt alice wirelay Techwolf gamerlay scarabeus science gnome steam-overlay mva emacs flameeyes-overlay lokal
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=corei7 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/X11/Sessions/awesome /etc/X11/Sessions/dwm /etc/conf.d/consolefont /etc/conf.d/hostname /etc/conf.d/hwclock /etc/conf.d/keymaps /etc/default/grub /etc/eix-sync.conf /etc/fstab /etc/hosts /etc/locale.gen /etc/make.conf /etc/timezone /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=corei7 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"