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

"File exists" error during venv --upgrade #65842

Closed
vdupras mannequin opened this issue Jun 2, 2014 · 7 comments
Closed

"File exists" error during venv --upgrade #65842

vdupras mannequin opened this issue Jun 2, 2014 · 7 comments
Labels
release-blocker stdlib Python modules in the Lib dir

Comments

@vdupras
Copy link
Mannequin

vdupras mannequin commented Jun 2, 2014

BPO 21643
Nosy @warsaw, @vsajip, @orsenthil, @vstinner, @larryhastings
Files
  • venv.patch
  • 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 = <Date 2014-06-03.15:49:25.891>
    created_at = <Date 2014-06-02.18:47:26.567>
    labels = ['library', 'release-blocker']
    title = '"File exists" error during venv --upgrade'
    updated_at = <Date 2014-06-03.15:49:25.889>
    user = 'https://bugs.python.org/vdupras'

    bugs.python.org fields:

    activity = <Date 2014-06-03.15:49:25.889>
    actor = 'python-dev'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-06-03.15:49:25.891>
    closer = 'python-dev'
    components = ['Library (Lib)']
    creation = <Date 2014-06-02.18:47:26.567>
    creator = 'vdupras'
    dependencies = []
    files = ['35471']
    hgrepos = []
    issue_num = 21643
    keywords = ['patch', '3.4regression']
    message_count = 7.0
    messages = ['219617', '219667', '219685', '219686', '219687', '219688', '219702']
    nosy_count = 7.0
    nosy_names = ['barry', 'vinay.sajip', 'orsenthil', 'vstinner', 'larry', 'vdupras', 'python-dev']
    pr_nums = []
    priority = 'release blocker'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue21643'
    versions = ['Python 3.4']

    @vdupras
    Copy link
    Mannequin Author

    vdupras mannequin commented Jun 2, 2014

    There seems to have been a regression in Python 3.4.1 with "pyvenv --upgrade", and this regression seems to be caused by bpo-21197.

    It now seems impossible to use the "--upgrade" flag without getting a "File exists" error. Steps to reproduce:

    $ pyvenv env
    $ pyvenv --upgrade env
    Error: [Errno 17] File exists: '/<pwd>/env/lib' -> '/<pwd>/env/lib64'

    @vdupras vdupras mannequin added the stdlib Python modules in the Lib dir label Jun 2, 2014
    @orsenthil
    Copy link
    Member

    I could not reproduce this in 3.4 / 3.5

    [localhost 21643]$ ./python.exe Tools/scripts/pyvenv --upgrade
    usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]
    [--upgrade] [--without-pip]
    ENV_DIR [ENV_DIR ...]
    venv: error: the following arguments are required: ENV_DIR
    [localhost 21643]$ ./python.exe Tools/scripts/pyvenv --upgrade foo
    [localhost 21643]$ hg tip
    changeset: 90992:50c9df76bb77
    tag: tip
    parent: 90989:f59afe34fe50
    parent: 90991:e6dce5611dae
    user: Senthil Kumaran <senthil@uthcode.com>
    date: Mon Jun 02 23:00:43 2014 -0700
    ---------------------------------------------------------------------

    More specific steps to reproduce it from the current codebase?

    @vdupras
    Copy link
    Mannequin Author

    vdupras mannequin commented Jun 3, 2014

    I could reproduce the bug on the v3.4.1 tag, on the 3.4 branch and on the default branch. I think that one of the conditions for the bug to arise is to have the "lib64" symlink created (as described in bpo-21197).

    I reproduced the bug on Gentoo and Arch environments.

    @vstinner
    Copy link
    Member

    vstinner commented Jun 3, 2014

    Full traceback (I modified venv/main.py):

    haypo@smithers$ /opt/py34/bin/python3 -m venv --upgrade ENV
    Error: [Errno 17] File exists: '/home/haypo/ENV/lib' -> '/home/haypo/ENV/lib64'
    Traceback (most recent call last):
      File "/opt/py34/lib/python3.4/runpy.py", line 170, in _run_module_as_main
        "__main__", mod_spec)
      File "/opt/py34/lib/python3.4/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/opt/py34/lib/python3.4/venv/__main__.py", line 6, in <module>
        main()
      File "/opt/py34/lib/python3.4/venv/__init__.py", line 438, in main
        builder.create(d)
      File "/opt/py34/lib/python3.4/venv/__init__.py", line 82, in create
        context = self.ensure_directories(env_dir)
      File "/opt/py34/lib/python3.4/venv/__init__.py", line 147, in ensure_directories
        os.symlink(p, link_path)
    FileExistsError: [Errno 17] File exists: '/home/haypo/ENV/lib' -> '/home/haypo/ENV/lib64'

    It looks like a regression introduced by the issue bpo-21197.

    Attached patch should fix it.

    @vstinner
    Copy link
    Member

    vstinner commented Jun 3, 2014

    Oh, my test lacks a unit test!

    @vstinner
    Copy link
    Member

    vstinner commented Jun 3, 2014

    Ok, this bug is a regression introduced in Python 3.4.1.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 3, 2014

    New changeset 27e1b4a9de07 by Vinay Sajip in branch '3.4':
    Issue bpo-21643: Updated test and fixed logic bug in lib64 symlink creation.
    http://hg.python.org/cpython/rev/27e1b4a9de07

    New changeset 71eda9bd8875 by Vinay Sajip in branch 'default':
    Closes bpo-21643: Merged fix from 3.4.
    http://hg.python.org/cpython/rev/71eda9bd8875

    @python-dev python-dev mannequin closed this as completed Jun 3, 2014
    @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
    release-blocker stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants