Skip to content
This repository has been archived by the owner on Jun 27, 2018. It is now read-only.

RUST_BACKTRACE=1 should be set #119

Closed
omo opened this issue May 26, 2015 · 5 comments
Closed

RUST_BACKTRACE=1 should be set #119

omo opened this issue May 26, 2015 · 5 comments

Comments

@omo
Copy link

omo commented May 26, 2015

The error message of rustc internal compiler errors asks this.

It'd be great if we can post a reproduction code on play.rust-lang.org and
the compiler developer sees the live diagnose information there.

@ghost
Copy link

ghost commented Nov 9, 2015

Depends on: rust-lang/rust#29293

@jonas-schievink
Copy link
Contributor

Depends on: rust-lang/rust#29293

That only happens when rustc is compiled with debuginfo btw, so it shouldn't affect playpen

@respeccing
Copy link
Contributor

That only happens when rustc is compiled with debuginfo btw, so it shouldn't affect playpen

You're right - I misunderstood what Mode: Debug means in playpen: "debug assertions on"(--enable-debug-assertions) is not the same as debugging info on(--enable-debuginfo).

@respeccing
Copy link
Contributor

EDIT5: NEVERMIND what I said below, it's easier than I thought!


tl;dr: must modify playpen.c to accept env. var(s) from arguments. OR pass a command like this to playpen bash -c 'export RUST_BACKTRACE=1;set|grep -i rust'

Looks like an env var could only be set in playpen.c: https://github.com/thestinger/playpen/blob/f8becccff56827c1d9ed70f0edc9470bf408bb86/playpen.c#L774-L780

Perhaps if rustc had an arg that would do the same thing as the RUST_BACKTRACE env var, that would be preferable ? (and while at it it would be even better if this arg could override the env var - I found myself in need of forcing that which is why I made a variant as RUST_BACKTRACE=disabled to mean the same as the env var being unset.)

EDIT: actually, I just realized an error in my thinking... it's the resulting binary which needs that arg, not rustc! That is, to emulate the env var being set. Although rustc could, in theory, permanently set that in the resulting binary. But having that binary accept an arg is out of the question /unacceptable, imho.
EDIT6: actually both rustc (while compiling) and the output binary(./out) might need RUST_BACKTRACE to be set, (so not just ./out might need this) just in case the compiler is panic-ing. This means in both compile.sh and evaluate.sh ...

EDIT2: or maybe another env var could be introduced which would change the default to always show backtrace, unless RUST_NOBACKTRACE is set, and since playpen cannot set any vars, rust-playpen will have backtrace be shown by default. Unfortunately this would also mean you cannot turn it off, which might be necessary to reproduce certain output... so it's not an acceptable solution (for me). (not to mention that changing a default like that is already a huge no no)

EDIT3: for what is worth, this seems to work:

$ sudo ./playpen ./sandbox --mount-proc --user=manj1 --syscalls-file=./whitelist -l -- bash -c 'export RUST_BACKTRACE=1;set|grep -i rust'

BASH_EXECUTION_STRING='export RUST_BACKTRACE=1;set|grep -i rust'
RUST_BACKTRACE=1
_=RUST_BACKTRACE

EDIT4: ok, I just realized that this exists and it's already setting an env var (TERM)

EDIT7: I have a workable implementation that turns on RUST_BACKTRACE only when Debug (but not Stable) is selected in rust-playpen... will submit a PR soon...

respeccing added a commit to respeccing/rust-playpen that referenced this issue Mar 28, 2016
and does not set it when Stable build.

This addresses rust-lang#119 although not entirely, as I imagine that a new UI
button would be desirable instead of it currently depending on the
Mode(Debug/Stable) one.
@respeccing
Copy link
Contributor

Can probably close this one now.

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

No branches or pull requests

4 participants