-
Notifications
You must be signed in to change notification settings - Fork 521
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
paranoid cause full path in stacktrace #1695
Conversation
I don't think that this is a safe thing to do. Rebar3 may be running in shell mode for example, and changing the path can interrupt a running system with concurrent tasks going on. It would be safer to make the source path relative ( |
See Lines 348 to 362 in 94976d5
This function takes the rebar options for a given application and normalize the path relative to the user's preference. We could reasonably be able to automatically do that in the compiler based on user preferences, I think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use the {source, FileName}
compiler options coupled with the existing compiler_source_format
value (handled in rebar_dir:format_source_file_name/2
) to safely set the file format without switching the working directories, which may be problematic under some rebar3 usages (in shell, or as part of the programmatic interface)
{source, FileName} But this is NOT the value where crashes get the path! |
Yea, we can't be switching the cwd all the time like this. It sounds like there needs to be an OTP fix so the filename in stacktraces is the same as the source option. |
@bjorng since you're playing with compiler stuff by now, do you have any suggestion or rationale behind the current behavior? It seems a bit annoying/risky to have to align the cwd before compiling any module when there's already a |
There is no need to do it at any time, but if i make the release than it should be an option! |
@tsloughter and @ferd
Do you know if there is a discussion on this in OTP? Is there any recommended work around to follow in the mean time? |
No guidelines. The few times I tried to bring it up, I had no response, but I can try to push for it again. |
Hi @ferd
Did you get a chance to do that? Any updates? |
I couldn't get anything there but I opened an Erlang/OTP issue: https://bugs.erlang.org/browse/ERL-706 |
The OTP issue has been implemented. Custom builds of rebar3 (using only the latest versions) and specifying deterministic builds as compiler options will drop paths from both exceptions and will let things be set. Just set the right erl_opts options. See erlang/otp#1976 for details. |
I always see my full path in stacktraces and crashes like
crasher:
.....
exception exit: {timeout,[{.....
[{file,"/users/james/bond/very/secret.erl"},{line,85}]}]}
...
now goes to
crasher:
.....
exception exit: {timeout,[{.....
[{file,"secret.erl"},{line,85}]}]}
...
cause we have a flat erl file structure it doesn't matter!