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

Inconsistent normalization of config paths can break handling of local packages path #1768

Open
nrusch opened this issue Jun 7, 2024 · 0 comments

Comments

@nrusch
Copy link
Contributor

nrusch commented Jun 7, 2024

When overriding "path-like" config values, slashes in paths are not consistently normalized to the current platform, depending on the presence of special patterns (specifically, ~).

When local_packages_path uses different path literals that point to the same path between site and user config files, this will break the value of config.nonlocal_packages_path, and prevent flags like --no-local from working correctly.

Environment

  • Windows 10
  • Rez 2.114.1
  • Rez python version: 3.7.9

To Reproduce

This uses slash differences on Windows to demonstrate the issue, but I can imagine similar issues arising from the use of symlinked directories in config values.

Start with a default rez install.

  1. Create a personal ~/.rezconfig.py, and add this to it:
import os
local_packages_path = '{0}/packages'.format(os.path.expanduser('~'))
  1. Run this command:
rez-python -c 'import rez.config; print("\n".join(rez.config.config.nonlocal_packages_path))'

Expected behavior
The path to the packages folder in your home directory should not be included in the resulting output.

Actual behavior

  • The path to the packages folder in your home directory is included in the resulting output.
  • When using rez-env --no-local, packages in your local packages path can still be included in the resolve.

This is because path normalization is currently only applied indirectly based on whether the path contains ~ (smoking gun in rez.utils.formatting.expanduser), and can thus cause inconsistent config behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants