From: bors Date: Fri, 9 Sep 2016 16:16:01 +0000 (-0700) Subject: Auto merge of #3078 - jhbabon:fix/parse-home-config-once, r=alexcrichton X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~13^2~81 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=398de2516028611b1cdd980cd72bd2194004d205;p=cargo.git Auto merge of #3078 - jhbabon:fix/parse-home-config-once, r=alexcrichton Fix: Don't parse the home directory more than once This PR tries to resolve this issue https://github.com/rust-lang/cargo/issues/3070. The problem is that the `walk_tree` method in the `src/util/config.rs` module was parsing more than once the contents of the config file in the home directory (the file `~/.cargo/config`). The biggest problem with this is with options that can accept multiple values, like `build.rustflags`. If you parse the file twice, the same option can end with duplicated values (e.g: `rustflags=["-Z", "foo", "-Z", "foo"]`). I made the fix following the comments in the issue. In the fix I keep track of all the parsed config files in a `HashSet` so I can know if a file has been parsed already. ~~I'm also using `std::fs::canonicalize`, as suggested in the issue, to prevent parsing files behind symbolic links more than once.~~ **UPDATE:** I removed the call to `fs::canonicalize` as suggested in the comments. Now the fix is way simpler, which means less code and less possibilities to add a new bug. --- 398de2516028611b1cdd980cd72bd2194004d205