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

pdm venv activate doesn't quote strings properly for Powershell #2881

Closed
1 task done
lambda opened this issue May 14, 2024 · 0 comments · Fixed by #2887
Closed
1 task done

pdm venv activate doesn't quote strings properly for Powershell #2881

lambda opened this issue May 14, 2024 · 0 comments · Fixed by #2887
Assignees
Labels
🐛 bug Something isn't working

Comments

@lambda
Copy link

lambda commented May 14, 2024

  • I have searched the issue tracker and believe that this is not a duplicate.

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

  • Create a user account with an apostrophe in the name in Windows; for example, PeterO'toole, so the home directory is C:\Users\PeterO'toole (or just make sure any path name with an apostrophe is in your path)
  • Clone a project using PDM in that directory:
    git clone https://github.com/pdm-project/pdm.git
    cd pdm
    
  • Create a venv by using pdm sync
  • Try to activate that venv using iex (pdm venv activate)

Actual behavior

You get an error indicating The term 'C:\Users\PeterO' is not recognized as the name of a cmdlet, function, script file, or operable program

If you just run pdm venv activate alone, you see that the command output is . 'C:\Users\PeterO'"'"'toole\pdm\.venv\Scripts\activate.ps1'

It looks like this is using bourne-shell-style quoting for that apostrophe in the name.

Expected behavior

The virtual environment is activated.

It looks like in Powershell, you can quote a single quote in a single quoted string by doubling it up, such as 'C:\Users\PeterO''toole\...': https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-7.4

Environment Information

# Paste the output of `pdm info && pdm info --env` below:

Reported by another user (I'm on Linux so can't test), but this was a fresh install of PDM 2.15.2 on a brand new system running Python 3.12 installed via the scoop package manager.

@lambda lambda added the 🐛 bug Something isn't working label May 14, 2024
@frostming frostming self-assigned this May 16, 2024
frostming added a commit that referenced this issue May 16, 2024
Fixes #2881

Signed-off-by: Frost Ming <me@frostming.com>
frostming added a commit that referenced this issue May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants