* [gentoo-dev] [fyi] lddtree magic
@ 2013-04-09 19:31 Mike Frysinger
2013-04-09 20:30 ` Diego Elio Pettenò
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Mike Frysinger @ 2013-04-09 19:31 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1652 bytes --]
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
/bin/bash
/lib64/ld-linux-x86-64.so.2
/lib64/libreadline.so.6
/lib64/libhistory.so.6
/lib64/libncurses.so.5
/lib64/libdl.so.2
/lib64/libc.so.6
this way you don't have to resort to grep/awk/sed on the output to try and get
the names out of `lddtree` (or heaven forbid, `ldd`).
it also supports --root just like you'd expect:
$ lddtree -l /bin/bash --root /mnt/space/distros/x86
/mnt/space/distros/x86/bin/bash
/mnt/space/distros/x86/lib/ld-linux.so.2
/mnt/space/distros/x86/lib/libreadline.so.6
/mnt/space/distros/x86/lib/libncurses.so.5
/mnt/space/distros/x86/lib/libdl.so.2
/mnt/space/distros/x86/lib/libc.so.6
but things get even crazier with the new --copy-to-tree option (python version
only). this is useful for scenarios like kernel initramfs where you want to
copy over one or two ELFs and their dependencies w/out resorting to statically
linking them. check out the --help text for more details.
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-dev] [fyi] lddtree magic
2013-04-09 19:31 [gentoo-dev] [fyi] lddtree magic Mike Frysinger
@ 2013-04-09 20:30 ` Diego Elio Pettenò
2013-04-10 3:10 ` Mike Frysinger
2013-04-09 20:41 ` Samuli Suominen
2013-04-09 22:22 ` Samuli Suominen
2 siblings, 1 reply; 13+ messages in thread
From: Diego Elio Pettenò @ 2013-04-09 20:30 UTC (permalink / raw
To: gentoo-dev
On 09/04/2013 20:31, Mike Frysinger wrote:
> but things get even crazier with the new --copy-to-tree option (python version
> only). this is useful for scenarios like kernel initramfs where you want to
> copy over one or two ELFs and their dependencies w/out resorting to statically
> linking them. check out the --help text for more details.
Would you mind a "hardlink to tree"? Would be lovely for chroot
environments as well...
--
Diego Elio Pettenò — Flameeyes
flameeyes@flameeyes.eu — http://blog.flameeyes.eu/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-dev] [fyi] lddtree magic
2013-04-09 19:31 [gentoo-dev] [fyi] lddtree magic Mike Frysinger
2013-04-09 20:30 ` Diego Elio Pettenò
@ 2013-04-09 20:41 ` Samuli Suominen
2013-04-09 20:45 ` Samuli Suominen
2013-04-09 22:22 ` Samuli Suominen
2 siblings, 1 reply; 13+ messages in thread
From: Samuli Suominen @ 2013-04-09 20:41 UTC (permalink / raw
To: gentoo-dev
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=
- Samuli
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-dev] [fyi] lddtree magic
2013-04-09 20:41 ` Samuli Suominen
@ 2013-04-09 20:45 ` Samuli Suominen
2013-04-10 2:30 ` Mike Frysinger
0 siblings, 1 reply; 13+ messages in thread
From: Samuli Suominen @ 2013-04-09 20:45 UTC (permalink / raw
To: gentoo-dev
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)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-dev] [fyi] lddtree magic
2013-04-09 19:31 [gentoo-dev] [fyi] lddtree magic Mike Frysinger
2013-04-09 20:30 ` Diego Elio Pettenò
2013-04-09 20:41 ` Samuli Suominen
@ 2013-04-09 22:22 ` Samuli Suominen
2 siblings, 0 replies; 13+ messages in thread
From: Samuli Suominen @ 2013-04-09 22:22 UTC (permalink / raw
To: gentoo-dev
On 09/04/13 22:31, Mike Frysinger wrote:
> i doubt few people have noticed, but i've rewritten lddtree recently in
> python.
I've opened http://bugs.gentoo.org/465310 for the failing new lddtree.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-dev] [fyi] lddtree magic
2013-04-09 20:45 ` Samuli Suominen
@ 2013-04-10 2:30 ` Mike Frysinger
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2013-04-10 2:30 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: Text/Plain, Size: 1068 bytes --]
On Tuesday 09 April 2013 16:45:36 Samuli Suominen wrote:
> $ 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)
make sure you're using pax-utils-0.7 and pyelftools-0.20-r2. there were known
python-3 issues in earlier versions.
if it still fails, post a bug please.
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-dev] [fyi] lddtree magic
2013-04-09 20:30 ` Diego Elio Pettenò
@ 2013-04-10 3:10 ` Mike Frysinger
2013-04-10 10:04 ` Fabio Erculiani
0 siblings, 1 reply; 13+ messages in thread
From: Mike Frysinger @ 2013-04-10 3:10 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: Text/Plain, Size: 843 bytes --]
On Tuesday 09 April 2013 16:30:26 Diego Elio Pettenò wrote:
> On 09/04/2013 20:31, Mike Frysinger wrote:
> > but things get even crazier with the new --copy-to-tree option (python
> > version only). this is useful for scenarios like kernel initramfs where
> > you want to copy over one or two ELFs and their dependencies w/out
> > resorting to statically linking them. check out the --help text for
> > more details.
>
> Would you mind a "hardlink to tree"? Would be lovely for chroot
> environments as well...
sure, that should be easy to add. i'll add an obligatory warning about the
accidental modification scenario. i know some newer kernel systems (like
yama?) have started disallowing hardlinks to files you don't own (even ones
that aren't setuid). the resulting error is fun & obtuse too like "EPERM".
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-dev] [fyi] lddtree magic
2013-04-10 3:10 ` Mike Frysinger
@ 2013-04-10 10:04 ` Fabio Erculiani
2013-04-10 16:33 ` Mike Frysinger
0 siblings, 1 reply; 13+ messages in thread
From: Fabio Erculiani @ 2013-04-10 10:04 UTC (permalink / raw
To: gentoo-dev
It looks like you're not using a standard style guide for Python but
rather this one [1].
I suggest you to use something closer to PEP8.
[1] https://code.google.com/p/google-styleguide/
--
Fabio Erculiani
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-dev] [fyi] lddtree magic
2013-04-10 10:04 ` Fabio Erculiani
@ 2013-04-10 16:33 ` Mike Frysinger
2013-04-10 16:42 ` Fabio Erculiani
0 siblings, 1 reply; 13+ messages in thread
From: Mike Frysinger @ 2013-04-10 16:33 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: Text/Plain, Size: 212 bytes --]
On Wednesday 10 April 2013 06:04:00 Fabio Erculiani wrote:
> It looks like you're not using a standard style guide for Python but
> rather this one [1].
> I suggest you to use something closer to PEP8.
no
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-dev] [fyi] lddtree magic
2013-04-10 16:33 ` Mike Frysinger
@ 2013-04-10 16:42 ` Fabio Erculiani
2013-04-10 17:32 ` Mike Frysinger
0 siblings, 1 reply; 13+ messages in thread
From: Fabio Erculiani @ 2013-04-10 16:42 UTC (permalink / raw
To: gentoo-dev
On Wed, Apr 10, 2013 at 5:33 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Wednesday 10 April 2013 06:04:00 Fabio Erculiani wrote:
>> It looks like you're not using a standard style guide for Python but
>> rather this one [1].
>> I suggest you to use something closer to PEP8.
>
> no
Good arguments! As usual I'd say.
> -mike
--
Fabio Erculiani
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-dev] [fyi] lddtree magic
2013-04-10 16:42 ` Fabio Erculiani
@ 2013-04-10 17:32 ` Mike Frysinger
2013-04-10 17:40 ` Fabio Erculiani
0 siblings, 1 reply; 13+ messages in thread
From: Mike Frysinger @ 2013-04-10 17:32 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: Text/Plain, Size: 828 bytes --]
On Wednesday 10 April 2013 12:42:14 Fabio Erculiani wrote:
> On Wed, Apr 10, 2013 at 5:33 PM, Mike Frysinger wrote:
> > On Wednesday 10 April 2013 06:04:00 Fabio Erculiani wrote:
> >> It looks like you're not using a standard style guide for Python but
> >> rather this one [1].
> >> I suggest you to use something closer to PEP8.
> >
> > no
>
> Good arguments! As usual I'd say.
sorry, but i didn't think stating the obvious was necessary. i authored the
entire tool, and the one maintaining the code, so yes, i get the liberty to
use whatever coding style pleases me. you provide no reasoning whatsoever as
to why PEP8 is "better". i doubt the style choice is going make any difference
whatsoever to contributions for people including yourself.
don't like it ? fork it and write your own.
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-dev] [fyi] lddtree magic
2013-04-10 17:32 ` Mike Frysinger
@ 2013-04-10 17:40 ` Fabio Erculiani
2013-04-10 17:56 ` Mike Frysinger
0 siblings, 1 reply; 13+ messages in thread
From: Fabio Erculiani @ 2013-04-10 17:40 UTC (permalink / raw
To: gentoo-dev
On Wed, Apr 10, 2013 at 6:32 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Wednesday 10 April 2013 12:42:14 Fabio Erculiani wrote:
>> On Wed, Apr 10, 2013 at 5:33 PM, Mike Frysinger wrote:
>> > On Wednesday 10 April 2013 06:04:00 Fabio Erculiani wrote:
>> >> It looks like you're not using a standard style guide for Python but
>> >> rather this one [1].
>> >> I suggest you to use something closer to PEP8.
>> >
>> > no
>>
>> Good arguments! As usual I'd say.
>
> sorry, but i didn't think stating the obvious was necessary. i authored the
> entire tool, and the one maintaining the code, so yes, i get the liberty to
> use whatever coding style pleases me. you provide no reasoning whatsoever as
> to why PEP8 is "better". i doubt the style choice is going make any difference
> whatsoever to contributions for people including yourself.
I guess that you're new to Python then. Anyway, mine was just an
advice, yours was just the same old rude answer.
>
> don't like it ? fork it and write your own.
> -mike
--
Fabio Erculiani
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-dev] [fyi] lddtree magic
2013-04-10 17:40 ` Fabio Erculiani
@ 2013-04-10 17:56 ` Mike Frysinger
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2013-04-10 17:56 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: Text/Plain, Size: 1415 bytes --]
On Wednesday 10 April 2013 13:40:17 Fabio Erculiani wrote:
> On Wed, Apr 10, 2013 at 6:32 PM, Mike Frysinger wrote:
> > On Wednesday 10 April 2013 12:42:14 Fabio Erculiani wrote:
> >> On Wed, Apr 10, 2013 at 5:33 PM, Mike Frysinger wrote:
> >> > On Wednesday 10 April 2013 06:04:00 Fabio Erculiani wrote:
> >> >> It looks like you're not using a standard style guide for Python but
> >> >> rather this one [1].
> >> >> I suggest you to use something closer to PEP8.
> >> >
> >> > no
> >>
> >> Good arguments! As usual I'd say.
> >
> > sorry, but i didn't think stating the obvious was necessary. i authored
> > the entire tool, and the one maintaining the code, so yes, i get the
> > liberty to use whatever coding style pleases me. you provide no
> > reasoning whatsoever as to why PEP8 is "better". i doubt the style
> > choice is going make any difference whatsoever to contributions for
> > people including yourself.
>
> I guess that you're new to Python then. Anyway, mine was just an
> advice, yours was just the same old rude answer.
i guess you haven't actually read the style guides. the differences between
PEP8 and the Google style guide are minor. anyone who is dissuaded from
making changes because of those differences most likely isn't going to
contribute anything useful in the first place.
people who do the actual work get a say in these things.
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-04-10 17:54 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-09 19:31 [gentoo-dev] [fyi] lddtree magic Mike Frysinger
2013-04-09 20:30 ` Diego Elio Pettenò
2013-04-10 3:10 ` Mike Frysinger
2013-04-10 10:04 ` Fabio Erculiani
2013-04-10 16:33 ` Mike Frysinger
2013-04-10 16:42 ` Fabio Erculiani
2013-04-10 17:32 ` Mike Frysinger
2013-04-10 17:40 ` Fabio Erculiani
2013-04-10 17:56 ` Mike Frysinger
2013-04-09 20:41 ` Samuli Suominen
2013-04-09 20:45 ` Samuli Suominen
2013-04-10 2:30 ` Mike Frysinger
2013-04-09 22:22 ` Samuli Suominen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox