mottosso / bleeding-rez

Rez - Reproducible software environments for Windows, Linux and MacOS
GNU Lesser General Public License v3.0
71 stars 10 forks source link

Powershell escapes "&" on environment variables #93

Closed salvaom closed 4 years ago

salvaom commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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