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

activate.fish sets VENV prompt incorrectly #70536

Closed
DanMcCombs mannequin opened this issue Feb 12, 2016 · 9 comments
Closed

activate.fish sets VENV prompt incorrectly #70536

DanMcCombs mannequin opened this issue Feb 12, 2016 · 9 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@DanMcCombs
Copy link
Mannequin

DanMcCombs mannequin commented Feb 12, 2016

BPO 26348
Nosy @brettcannon, @vsajip, @zhangyangyu
Files
  • activate-fish.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 = 'https://github.com/brettcannon'
    closed_at = <Date 2016-07-01.04:37:39.402>
    created_at = <Date 2016-02-12.13:08:59.483>
    labels = ['type-bug', 'library']
    title = 'activate.fish sets VENV prompt incorrectly'
    updated_at = <Date 2016-07-01.04:37:39.401>
    user = 'https://bugs.python.org/DanMcCombs'

    bugs.python.org fields:

    activity = <Date 2016-07-01.04:37:39.401>
    actor = 'vinay.sajip'
    assignee = 'brett.cannon'
    closed = True
    closed_date = <Date 2016-07-01.04:37:39.402>
    closer = 'vinay.sajip'
    components = ['Library (Lib)']
    creation = <Date 2016-02-12.13:08:59.483>
    creator = 'Dan McCombs'
    dependencies = []
    files = ['41907']
    hgrepos = []
    issue_num = 26348
    keywords = ['patch']
    message_count = 9.0
    messages = ['260175', '260243', '262764', '264385', '264395', '264396', '264397', '264398', '264399']
    nosy_count = 5.0
    nosy_names = ['brett.cannon', 'vinay.sajip', 'python-dev', 'xiang.zhang', 'Dan McCombs']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue26348'
    versions = ['Python 3.5', 'Python 3.6']

    @DanMcCombs
    Copy link
    Mannequin Author

    DanMcCombs mannequin commented Feb 12, 2016

    Currently, the activate.fish VENV script sets fish's prompt to be prepended with a literal "__VENV_PROMPT__" rather than the contents of the $VENV_PROMPT variable as intended.

    The attached patch simply adds the missing "$" to the variable in the conditional test and it's usage, so it's only being set if the variable is non-zero, rather than testing if the string "__VENV_PROMPT__" is non-zero like it is doing right now.

    The results in the prompt being correctly prepended by "(my_actual_venv_name)".

    @DanMcCombs DanMcCombs mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Feb 12, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 13, 2016

    New changeset cfc66e37eb8e by Vinay Sajip in branch '3.5':
    Fixes bpo-26348: Corrected typos in activate.fish script.
    https://hg.python.org/cpython/rev/cfc66e37eb8e

    New changeset 0f1ac94d2f98 by Vinay Sajip in branch 'default':
    Fixes bpo-26348: Merged fix from 3.5.
    https://hg.python.org/cpython/rev/0f1ac94d2f98

    @vsajip vsajip closed this as completed Feb 13, 2016
    @vsajip
    Copy link
    Member

    vsajip commented Apr 1, 2016

    Implementing this patch has led to another issue being raised: bpo-26664. Dan - would you care to take a look and comment? Thanks.

    @zhangyangyu
    Copy link
    Member

    The original behaviour is right. __VENV_PROMPT__ is meant to be a placeholder, not a variable interpreted by shell. I think this patch should be reverted. Related issue is bpo-26664.

    @DanMcCombs
    Copy link
    Mannequin Author

    DanMcCombs mannequin commented Apr 27, 2016

    I somehow missed the comment on 2016-04-01, I apologize for being late to look at this.

    Xiang is right, this patch should be reverted.

    It looks like the issue reported was originally brought on by an activate.fish being used from a Python after the patch in commit 7f913c6ada03 was added, but the running version of Python did not include the patch, so that the placeholder was not being swapped out. In that case, updating the script to include $ and use the variable fixed the problem, but when the patch in 7f913c6ada03 is also included it causes the placeholder to be swapped to a name wrapped in parenthesis preceded by $ at the time the venv is created causing a syntax error in fish.

    Since the patch in commit 7f913c6ada03 swaps that place holder and handles doing so in the other activate scripts as well, the patch that was part of this issue (cfc66e37eb8e) is not needed and should be reverted.

    Here's the commit adding that placeholder for context:

    https://hg.python.org/cpython/rev/7f913c6ada03

    @brettcannon
    Copy link
    Member

    So just to be clear, cfc66e37eb8e and 0f1ac94d2f98 should be reverted? No other changes?

    And will this fix issue bpo-26664 or affect it in any way?

    @brettcannon brettcannon reopened this Apr 27, 2016
    @brettcannon brettcannon self-assigned this Apr 27, 2016
    @DanMcCombs
    Copy link
    Mannequin Author

    DanMcCombs mannequin commented Apr 27, 2016

    Yes, reverting cfc66e37eb8e and 0f1ac94d2f98 should resolve bpo-26664.

    @brettcannon
    Copy link
    Member

    I'll revert the two commits then and close both this and bpo-26664 when I have a chance.

    @DanMcCombs
    Copy link
    Mannequin Author

    DanMcCombs mannequin commented Apr 27, 2016

    Thanks Brett.

    @vsajip vsajip closed this as completed Jul 1, 2016
    @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
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants