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

Powershell escapes "&" on environment variables #93

Closed
salvaom opened this issue Feb 12, 2020 · 3 comments · Fixed by #95
Closed

Powershell escapes "&" on environment variables #93

salvaom opened this issue Feb 12, 2020 · 3 comments · Fixed by #95

Comments

@salvaom
Copy link
Collaborator

salvaom commented Feb 12, 2020

Issue

While creating a Houdini package, I've stumbled onto a small issue using this following command:

def commands():
    global env

    env.PATH.append('{this.install_dir}/bin')
    env.HOUDINI_PATH.append('&')

While I was expecting to have & added to the end of the HOUDINI_PATH environment variable, the following occurs:

PS D:\projects\py> rez env houdini-18.0.378
You are now in a rez-configured environment.
> $ Write-Host $ENV:HOUDINI_PATH
;^&
> $

While it's expected for special characters to be escaped, the & character is sometimes required to setup Houdini's environment variables, and ^ is also a special Houdini character.

https://www.sidefx.com/docs/houdini/basics/config_env.html

Solution (?)

By removing & from the _escape_re in src\rezplugins\shell\powershell.py this issue seems to be fixed but as far as I know PS also uses & to evaluate strings as commands, so I'm unsure of how would this affect the rest of rez.

@mottosso
Copy link
Owner

Thanks for reporting this. First thing I would check is whether they've solved this up-stream, then we could merge those results here. Are you able to test nerdvegas/test with the same package and see if the problem still occurs?

@salvaom
Copy link
Collaborator Author

salvaom commented Feb 13, 2020

nerdvegas/rez version 2.53.1 yields the correct environment:

PS D:\projects\py> rez.exe env houdini

You are now in a rez-configured environment.

resolved by Salva@WORKSTATION, on Thu Feb 13 10:23:45 2020, using Rez v2.53.1

requested packages:
houdini
~platform==windows       (implicit)
~arch==AMD64             (implicit)
~os==windows-10.0.18362  (implicit)

resolved packages:
arch-AMD64        c:\users\salva\packages\arch\AMD64
houdini-18.0.378  c:\users\salva\packages\houdini\18.0.378\platform-windows\arch-AMD64  (NOT FOUND)
platform-windows  c:\users\salva\packages\platform\windows
> $ $ENV:HOUDINI_PATH
;&
> $

@mottosso
Copy link
Owner

Have a look at whether you can port that over, it's here. Should be around here I think.

salvaom added a commit that referenced this issue Feb 14, 2020
Fix "&" being escaped on PoweShell's environment variables (#93)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants