Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build process adds CWD (null entry) to PYTHONPATH if PYTHONPATH is set in the build environment #56491

Open
bitdancer opened this issue Jun 8, 2011 · 4 comments
Labels
build The build process and cross-build

Comments

@bitdancer
Copy link
Member

BPO 12282
Nosy @ned-deily, @merwok, @bitdancer

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2011-06-08.03:10:57.678>
labels = ['build']
title = 'build process adds CWD (null entry) to PYTHONPATH if PYTHONPATH is set in the build environment'
updated_at = <Date 2011-06-09.13:12:03.817>
user = 'https://github.com/bitdancer'

bugs.python.org fields:

activity = <Date 2011-06-09.13:12:03.817>
actor = 'eric.araujo'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Build']
creation = <Date 2011-06-08.03:10:57.678>
creator = 'r.david.murray'
dependencies = []
files = []
hgrepos = []
issue_num = 12282
keywords = []
message_count = 4.0
messages = ['137894', '137897', '137909', '137911']
nosy_count = 3.0
nosy_names = ['ned.deily', 'eric.araujo', 'r.david.murray']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue12282'
versions = ['Python 2.7', 'Python 3.2', 'Python 3.3']

@bitdancer
Copy link
Member Author

After a make distclean I'm seeing the following output during a build of default. It is possible my 2.7 install is borked, but I don't understand why python is apparently being called during a gcc step. The build seems to succeed.

gcc -pthread -c  -g -O0 -Wall -Wstrict-prototypes    -I. -IInclude -I./Include    -DPy_BUILD_CORE \
      -DHGVERSION="\"`LC_ALL=C hg id -i .`\"" \
      -DHGTAG="\"`LC_ALL=C hg id -t .`\"" \
      -DHGBRANCH="\"`LC_ALL=C hg id -b .`\"" \
      -o Modules/getbuildinfo.o ./Modules/getbuildinfo.c
Traceback (most recent call last):
  File "/usr/lib/python2.7/site.py", line 62, in <module>
    import os
  File "/usr/lib/python2.7/os.py", line 398, in <module>
    import UserDict
  File "/usr/lib/python2.7/UserDict.py", line 83, in <module>
    import _abcoll
  File "/usr/lib/python2.7/_abcoll.py", line 11, in <module>
    from abc import ABCMeta, abstractmethod
ImportError: cannot import name ABCMeta
Traceback (most recent call last):
  File "/usr/lib/python2.7/site.py", line 62, in <module>
    import os
  File "/usr/lib/python2.7/os.py", line 398, in <module>
    import UserDict
  File "/usr/lib/python2.7/UserDict.py", line 83, in <module>
    import _abcoll
  File "/usr/lib/python2.7/_abcoll.py", line 11, in <module>
    from abc import ABCMeta, abstractmethod
ImportError: cannot import name ABCMeta
Traceback (most recent call last):
  File "/usr/lib/python2.7/site.py", line 62, in <module>
    import os
  File "/usr/lib/python2.7/os.py", line 398, in <module>
    import UserDict
  File "/usr/lib/python2.7/UserDict.py", line 83, in <module>
    import _abcoll
  File "/usr/lib/python2.7/_abcoll.py", line 11, in <module>
    from abc import ABCMeta, abstractmethod
ImportError: cannot import name ABCMeta

@bitdancer bitdancer added the build The build process and cross-build label Jun 8, 2011
@ned-deily
Copy link
Member

It's being called for hg:

-DHGVERSION=""LC_ALL=C hg id -i ."" ...

@bitdancer
Copy link
Member Author

As far as I can tell my python2.7 installation is fine and bug free. hg is working fine when called from the command line.

@bitdancer
Copy link
Member Author

It turns out that I had a stray abc.py file in my current working directory as the result of some previous tests of module-load-order rules. That by itself wouldn't have triggered the problem, but in addition, I have PYTHONPATH set in my environment because I have the hg whitespace hook installed. Apparently the build process turns a non-empty PYTHONPATH into a null entry in the final computed PYTHONPATH it uses when hg is called, and this results in anything located in the CWD being loaded.

I don't think this rises quite to the level of a security issue, since it applies only at build time, but it certainly seems like a bug.

@bitdancer bitdancer changed the title ABCMeta import error during build build process adds CWD (null entry) to PYTHONPATH if PYTHONPATH is set in the build environment Jun 8, 2011
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build
Projects
None yet
Development

No branches or pull requests

2 participants