On 09/04/13 23:41, Samuli Suominen wrote:
On 09/04/13 22:31, Mike Frysinger wrote:
i doubt few people have noticed, but i've rewritten lddtree recently in
python. i did for speed, for fun, and to add a lot more functionality
that
would have driven the bash code base to new perverse levels.
i've randomly stumbled across places in our code base (beyond ebuilds)
where
the new python version would be useful. rather than try and ferret
out those
myself, i'll just announce here and people can sort it out.
if you guys think this can satisfy most of your needs but there's like
a small
edge case that isn't quite handled, let me know. i can always add
another
option :).
specifically, lddtree (both the shell & python variants) support a
--list:
$ lddtree -l /bin/bash
$ qfile -v /usr/bin/lddtree
app-misc/pax-utils-0.6 (/usr/bin/lddtree)
$ python --version
Python 3.2.3
$ lddtree -l /bin/bash
Traceback (most recent call last):
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 0x83 in position 25:
invalid start byte
$ locale
LANG=en_US.UTF-8
LC_CTYPE=fi_FI.UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME=en_GB.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
$ LC_ALL=C lddtree -l /bin/bash
Traceback (most recent call last):
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/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0x83 in position 25:
ordinal not in range(128)