Skip to content

Commit d5c9078

Browse files
Rollup merge of #52195 - alexcrichton:no-tmp, r=pnkfelix
rustc: Avoid /tmp/ in graphviz writing This issue was reported to [email protected] by Sebastien Marie following our recent [security advisory][1]. Because `/tmp` is typically globally writable it's possible for one user to place symlinks in `/tmp` pointing to files in another user's directories, causing `rustc` to overwrite the contents of innocent files by accident. This patch instead defaults the output path here to the cwd which should avoid this issue. [1]: https://blog.rust-lang.org/2018/07/06/security-advisory-for-rustdoc.html
2 parents aa9ee68 + bc09fcb commit d5c9078

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustc/infer/lexical_region_resolve/graphviz.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ use std::sync::atomic::{AtomicBool, Ordering};
3939
fn print_help_message() {
4040
println!("\
4141
-Z print-region-graph by default prints a region constraint graph for every \n\
42-
function body, to the path `/tmp/constraints.nodeXXX.dot`, where the XXX is \n\
42+
function body, to the path `constraints.nodeXXX.dot`, where the XXX is \n\
4343
replaced with the node id of the function under analysis. \n\
4444
\n\
4545
To select one particular function body, set `RUST_REGION_GRAPH_NODE=XXX`, \n\
4646
where XXX is the node id desired. \n\
4747
\n\
4848
To generate output to some path other than the default \n\
49-
`/tmp/constraints.nodeXXX.dot`, set `RUST_REGION_GRAPH=/path/desired.dot`; \n\
49+
`constraints.nodeXXX.dot`, set `RUST_REGION_GRAPH=/path/desired.dot`; \n\
5050
occurrences of the character `%` in the requested path will be replaced with\n\
5151
the node id of the function under analysis. \n\
5252
\n\
@@ -90,7 +90,7 @@ pub fn maybe_print_constraints_for<'a, 'gcx, 'tcx>(
9090
}
9191

9292
Ok(other_path) => other_path,
93-
Err(_) => "/tmp/constraints.node%.dot".to_string(),
93+
Err(_) => "constraints.node%.dot".to_string(),
9494
};
9595

9696
if output_template.is_empty() {

0 commit comments

Comments
 (0)