Gentoo Archives: gentoo-dev

From: Samuli Suominen <ssuominen@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [fyi] lddtree magic
Date: Tue, 09 Apr 2013 20:45:53
Message-Id: 51647DF0.206@gentoo.org
In Reply to: Re: [gentoo-dev] [fyi] lddtree magic by Samuli Suominen
1 On 09/04/13 23:41, Samuli Suominen wrote:
2 > On 09/04/13 22:31, Mike Frysinger wrote:
3 >> i doubt few people have noticed, but i've rewritten lddtree recently in
4 >> python. i did for speed, for fun, and to add a lot more functionality
5 >> that
6 >> would have driven the bash code base to new perverse levels.
7 >>
8 >> i've randomly stumbled across places in our code base (beyond ebuilds)
9 >> where
10 >> the new python version would be useful. rather than try and ferret
11 >> out those
12 >> myself, i'll just announce here and people can sort it out.
13 >>
14 >> if you guys think this can satisfy most of your needs but there's like
15 >> a small
16 >> edge case that isn't quite handled, let me know. i can always add
17 >> another
18 >> option :).
19 >>
20 >> specifically, lddtree (both the shell & python variants) support a
21 >> --list:
22 >> $ lddtree -l /bin/bash
23 >
24 > $ qfile -v /usr/bin/lddtree
25 > app-misc/pax-utils-0.6 (/usr/bin/lddtree)
26 >
27 > $ python --version
28 > Python 3.2.3
29 >
30 > $ lddtree -l /bin/bash
31 > Traceback (most recent call last):
32 > File "/usr/bin/lddtree", line 450, in <module>
33 > sys.exit(main(sys.argv))
34 > File "/usr/bin/lddtree", line 437, in main
35 > elf = ParseELF(path, options.root, ldpaths)
36 > File "/usr/bin/lddtree", line 235, in ParseELF
37 > elf = ELFFile(f)
38 > File "/usr/lib64/python3.2/site-packages/elftools/elf/elffile.py",
39 > line 47, in __init__
40 > self._identify_file()
41 > File "/usr/lib64/python3.2/site-packages/elftools/elf/elffile.py",
42 > line 177, in _identify_file
43 > magic = self.stream.read(4)
44 > File "/usr/lib64/python3.2/codecs.py", line 300, in decode
45 > (result, consumed) = self._buffer_decode(data, self.errors, final)
46 > UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 25:
47 > invalid start byte
48 >
49 > $ locale
50 > LANG=en_US.UTF-8
51 > LC_CTYPE=fi_FI.UTF-8
52 > LC_NUMERIC="en_US.UTF-8"
53 > LC_TIME=en_GB.UTF-8
54 > LC_COLLATE="en_US.UTF-8"
55 > LC_MONETARY="en_US.UTF-8"
56 > LC_MESSAGES="en_US.UTF-8"
57 > LC_PAPER="en_US.UTF-8"
58 > LC_NAME="en_US.UTF-8"
59 > LC_ADDRESS="en_US.UTF-8"
60 > LC_TELEPHONE="en_US.UTF-8"
61 > LC_MEASUREMENT="en_US.UTF-8"
62 > LC_IDENTIFICATION="en_US.UTF-8"
63 > LC_ALL=
64
65 $ LC_ALL=C lddtree -l /bin/bash
66 Traceback (most recent call last):
67 File "/usr/bin/lddtree", line 450, in <module>
68 sys.exit(main(sys.argv))
69 File "/usr/bin/lddtree", line 437, in main
70 elf = ParseELF(path, options.root, ldpaths)
71 File "/usr/bin/lddtree", line 235, in ParseELF
72 elf = ELFFile(f)
73 File "/usr/lib64/python3.2/site-packages/elftools/elf/elffile.py",
74 line 47, in __init__
75 self._identify_file()
76 File "/usr/lib64/python3.2/site-packages/elftools/elf/elffile.py",
77 line 177, in _identify_file
78 magic = self.stream.read(4)
79 File "/usr/lib64/python3.2/encodings/ascii.py", line 26, in decode
80 return codecs.ascii_decode(input, self.errors)[0]
81 UnicodeDecodeError: 'ascii' codec can't decode byte 0x83 in position 25:
82 ordinal not in range(128)

Replies

Subject Author
Re: [gentoo-dev] [fyi] lddtree magic Mike Frysinger <vapier@g.o>