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

Emulator path is terminated at the first sign of white space in erlc #8845

Open
starbelly opened this issue Sep 22, 2024 · 2 comments
Open
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@starbelly
Copy link
Contributor

starbelly commented Sep 22, 2024

Describe the bug
erlc will fail to run if it resides in a path that contains spaces (i.e., /foo/bar baz/erlc). This is due to the push_words function.

A fix was sent up in 2015, yet was reverted in f77436f a few months later, but without indication as to why.

Per the PR above, it seems this is a problem in multiple programs shipped with OTP.

To Reproduce

Install Erlang/OTP in a location with a parent directory that contains spaces
such as /tmp/foo bar/erlang_test , then try to invoke erlc (i.e., /tmp/foo bar/erlang_test/bin/erlc) , you should get an errno 2 exit.

Expected behavior
erlc and friends can successfully be invoked without issue when residing in a path containing spaces (i.e., the path to the emulator is not lopped off the first sign of space).

Affected versions
All versions of OTP post R13B

Additional context

This bug was noticed and reported by @tsloughter on erlanger slack.

@starbelly starbelly added the bug Issue is reported as a bug label Sep 22, 2024
@garazdawi
Copy link
Contributor

How odd! We test with a space (and unicode character) in the path for all our GH actions tests. Seems like for some reason that does not catch this problem. Will have to investigate.

@garazdawi garazdawi added the team:VM Assigned to OTP team VM label Sep 23, 2024
@frazze-jobb
Copy link
Contributor

frazze-jobb commented Oct 10, 2024

Hmm, I ran the erlc_SUITE test suite and I found that it works there, it creats a script file that sets ERLC_EMULATOR=erl, when evaluating push_words, everything works fine. But erl might actually have the same path as erlc, but we rely on the OS way of finding the full path later.

If you set ERLC_EMULATOR=/some path with space/erl, then we get the same problem as before with push_words.

ERLC_EMULATOR - The command for starting the emulator. Defaults to erl in the same directory as the erlc program itself, or, if it does not exist, erl in any of the directories specified in environment variable PATH

I think we should try to add this fix again.

Maybe the problem with the original one is that if you set ERLC_EMULATOR="erl -cli_arg1 -cli_arg2" then just doing PUSH was not enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

3 participants