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

rebar_dir: Avoid canonicalizing the CWD (get_cwd/0) #2925

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

the-mikedavis
Copy link

The unix BIF which ultimately implements file:get_cwd/0 uses getcwd(3) which returns a canonicalized path, resolving any symlinks. Instead we should try to preserve the non-canonicalized path by reading the $PWD environment variable set by Posix shells. We should prefer $PWD to file:get_cwd() when it canonicalizes to the same path. This emulates the behavior of pwd -L (the default behavior of pwd).

WhatsApp/erlang-language-platform#65 has more details on the motivation of this change. On my machine rebar3 experimental manifest emits canonicalized paths which confuse tools like ELP that comumnicate these paths with editors.

The unix BIF which ultimately implements `file:get_cwd/0` uses getcwd(3)
which returns a canonicalized path, expanding any symlinks. Instead we
should try to preserve the non-canonicalized path by reading the $PWD
environment variable set by Posix shells. We should prefer $PWD to
`file:get_cwd()` when it canonicalizes to the same path. This emulates
the behavior of `pwd -L` (the default behavior of `pwd`).
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 this pull request may close these issues.

1 participant