Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] Do not enable optimizations by default to work-around pycparser issue
Date: Sat, 02 Sep 2017 21:23:43
Message-Id: b043d525-a31b-e31d-3815-aa6adf3a695e@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] Do not enable optimizations by default to work-around pycparser issue by "Michał Górny"
1 On 09/02/2017 02:05 PM, Michał Górny wrote:
2 > W dniu sob, 02.09.2017 o godzinie 12∶19 -0700, użytkownik Zac Medico
3 > napisał:
4 >> On 09/02/2017 10:46 AM, Michał Górny wrote:
5 >>> dev-python/pycparser-2.18+ exposes a design flaw in dev-python/ply that
6 >>> makes it unable to work with -OO code. Remove the optimizations from
7 >>> Portage shebangs to prevent triggering the issue until we find a proper
8 >>> solution for it.
9 >>>
10 >>> Bug: https://bugs.gentoo.org/628386
11 >>> ---
12 >>> bin/clean_locks | 2 +-
13 >>> bin/dispatch-conf | 2 +-
14 >>> bin/ebuild | 2 +-
15 >>> bin/emaint | 2 +-
16 >>> bin/env-update | 2 +-
17 >>> bin/portageq | 2 +-
18 >>> tabcheck.py | 2 +-
19 >>> 7 files changed, 7 insertions(+), 7 deletions(-)
20 >>>
21 >>> diff --git a/bin/clean_locks b/bin/clean_locks
22 >>> index 13af06197..fb245972f 100755
23 >>> --- a/bin/clean_locks
24 >>> +++ b/bin/clean_locks
25 >>> @@ -1,4 +1,4 @@
26 >>> -#!/usr/bin/python -bO
27 >>> +#!/usr/bin/python -b
28 >>
29 >> The diff shows -O, but the commit messages says -OO, so which one is it really?
30 >
31 > Yes, it's a curious problem. -OO is the one breaking it but py<3.5 seems
32 > to be happy to load -OO files with -O:
33 >
34 > $ python2.7 -O -c 'import pycparser; print(pycparser.__file__)'
35 > /usr/lib64/python2.7/site-packages/pycparser/c_parser.py:20: RuntimeWarning: parsing methods must have __doc__ for pycparser to work properly
36 > class CParser(PLYParser):
37 > /usr/lib64/python2.7/site-packages/pycparser/__init__.pyo
38 >
39 > $ python3.4 -O -c 'import pycparser; print(pycparser.__cached__)'
40 > /usr/lib64/python3.4/site-packages/pycparser/c_parser.py:20: RuntimeWarning: parsing methods must have __doc__ for pycparser to work properly
41 > class CParser(PLYParser):
42 > /usr/lib64/python3.4/site-packages/pycparser/__pycache__/__init__.cpython-34.pyo
43 >
44 > This doesn't seem to be the case anymore for py3.5+:
45 >
46 > $ python3.5 -O -c 'import pycparser; print(pycparser.__cached__)'
47 > /usr/lib64/python3.5/site-packages/pycparser/__pycache__/__init__.cpython-35.opt-1.pyc
48 >
49 >> Are we sure that it's worth it to load all of the __doc__ strings into
50 >> memory, given that we have alternative implementations for everything
51 >> that pycrypto provides?
52 >
53 > I dare say that if -O can cause completely random total breakage, then
54 > we shouldn't risk doing that for the sake of some minor memory savings.
55 > It's not a case of 'support for pycryptodome' vs '1M memory saving'.
56 > It's a case of 'loading random module can wreak total havoc in Portage'.
57
58 Seems reasonable. Please merge.
59 --
60 Thanks,
61 Zac

Replies