AcademySoftwareFoundation / rez

An integrated package configuration, build and deployment system for software
https://rez.readthedocs.io
Apache License 2.0
938 stars 332 forks source link

Missleading warning due to gitbash shell plugin ignoring its config settings #1617

Open Dennis-Lehmann opened 8 months ago

Dennis-Lehmann commented 8 months ago

When WSL is setup on a windows machine, rez will throw the following warning multiple times after executing rez -h or trying to run rez env --shell gitbash

23:08:52 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.

The warning itself is good, but its missing vital information, as well as providing (possibly) false information to the user!

  1. The path in the message is missing: [...] has been detected at %s, [...]
  2. Editing the config setting plugins.shell.gitbash.executable_fullpath as suggested, will not satisfy/silence the warning

Instead of gitbash the setting for bash needs to be edited, such as in the example below. Note: git is not required to be installed, its enough to point to some arbitrary path to silence the warning, I'm just using it as an example!

plugins = {
    "shell": {
        "bash": {
            "executable_fullpath": R"C:\Program Files\Git\bin\bash.exe",
        }
    }
}

Noteworthy here: Spaces in the path of executable_fullpath lead to an addtional error:

C:\Users\Dennis\AppData\Local\Temp\rez_context_y5byj03o\rez-shell.sh: line 5: C:Program: command not found

Environment

To Reproduce

  1. Setup WSL: https://learn.microsoft.com/en-us/windows/wsl/install
  2. Execute rez -h or rez env --shell gitbash in terminal

Expected behavior

Actual behavior

Here is the full output of rez -h:

23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
23:46:59 WARNING  Git-bash executable has been detected at %s, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.
usage: rez [-h] [-i] [-V] [-v] COMMAND ...

rez CLI

positional arguments:
  COMMAND
    bind         Create a Rez package for existing software.
    build        Build a package from source.
    config       Print current rez settings.
    context      Print information about the current rez context, or a given
                 context file.
    cp           Copy a package from one repository to another.
    depends      Perform a reverse package dependency lookup.
    diff         Compare the source code of two packages.
    env          Open a rez-configured shell, possibly interactive.
    gui          Run the Rez GUI application.
    help         Utility for displaying help for the given package.
    interpret    Execute some Rex code and print the interpreted result.
    memcache     Manage and query memcache server(s).
    pip          Install a pip-compatible python package, and its
                 dependencies, as rez packages.
    pkg-cache    Manipulate a package cache.
    plugins      Get a list of a package's plugins.
    python       Start a python interpreter or execute a python script within
                 Rez's own execution context.
    release      Build a package from source and deploy it.
    search       Search for packages
    selftest     Run unit tests. Use pytest if available.
    status       Report current status of the environment, or a tool or
                 package etc.
    suite        Manage a suite or print information about an existing suite.
    test         Run tests listed in a package's definition file.
    view         View the contents of a package.
    yaml2py      Print a package.yaml file in package.py format.
    bundle       Bundle a context and its packages into a relocatable dir.
    benchmark    Run a benchmarking suite for runtime resolves.
    pkg-ignore   Disable a package so it is hidden from resolves.
    mv           Move a package from one repository to another.
    rm           Remove package(s) from a repository.

optional arguments:
  -h, --help     show this help message and exit
  -i, --info     print information about rez and exit
  -V, --version  show program's version number and exit
  -v, --verbose  verbose mode, repeat for more verbosity
JeanChristopheMorinPerso commented 7 months ago

Thanks for creating this issue @RegionStormer! If you have some time, could you test with #1475 to see if it fixes the issue? I think it does but a confirmation would help.

Dennis-Lehmann commented 7 months ago

Using the changes from #1475 I can confirm that the error message does now provide the path to the exe:

18:09:10 WARNING  Git-bash executable has been detected at c:\windows\system32\bash.exe, but this is probably not correct (google Windows Subsystem for Linux). Consider adjusting your searchpath, or use rez config setting plugins.shell.gitbash.executable_fullpath.

Also setting up a .rezconfig.py with the following content, gets rid of the warning:

plugins = {
    "shell": {
        "gitbash": {
            "executable_fullpath": R"C:\Program Files\Git\bin\bash.exe",
        }
    }
}

The path to bash.exe is properly resolved, though requesting an empty environment using the gitbash shell results in the following issue:

PS C:\Users\Dennis> rez env --shell gitbash

You are now in a rez-configured environment.

bash: rezolve: command not found
>
Dennis@COMPUTER MINGW64 /c/Users/Dennis
$ 

Rez also is not available in that environment

[...]
Dennis@COMPUTER MINGW64 /c/Users/Dennis
$ rez -h
bash: rez: command not found
>
Dennis@COMPUTER MINGW64 /c/Users/Dennis
$
JeanChristopheMorinPerso commented 7 months ago

@Dennis-Lehmann can you add that comment in https://github.com/AcademySoftwareFoundation/rez/pull/1475 please?