Fix symbolic links to sccache on linux#2420
Conversation
|
@sylvestre Could you take a look at this? |
|
@sertonix could you please add a test to make sure we don't regress? thanks |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2420 +/- ##
==========================================
+ Coverage 67.31% 70.27% +2.96%
==========================================
Files 64 65 +1
Lines 35165 35525 +360
==========================================
+ Hits 23670 24964 +1294
+ Misses 11495 10561 -934 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| if !internal_start_server { | ||
| if let Ok(exe) = env::current_exe() { | ||
| if let Ok(exe) = match env::args().next() { |
There was a problem hiding this comment.
I think it would make sense to mention the platform-dependent symlink following issue here in a comment instead of only in the commit message. This code looks a bit mysterious otherwise. Much more convenient not to have to use git blame or so to find that important info.
I hope this gets merged btw, this issue is a strange papercut that gives a bad/unfinished first impression.
I would like to but I am uncertain how to do this. |
I've had the same problem, but it's often not as hard as it looks.
|
|
@sertonix If you're motivated to finish it, you could come to the sccache Matrix channel and ask for help. I'm sometimes on there as well. https://chat.mozilla.org/#/room/#sccache:mozilla.org (or translate it to the usual Matrix "coordinates" in your client if you have one) |
Whether or not env::current_exe follows symlinks is platform dependant. On linux it follows them which made it impossible to do things like ln -s sccache /usr/bin/cc. By reading env::args() directly we don't have this issue. Fixes mozilla#993 Based on rivy/rs.coreutils@ad3852a
|
@sertonix If you don't mind, I can have a whack at writing a test for this |
|
It might take a while before I get to writing tests so feel free to give it a try. I pushed a small fix that I made while using this patch |
|
I think you can close this one. |
|
Right |
Whether or not
env::current_exefollows symlinks is platform dependant. On linux it follows them which made it impossible to do things likeln -s sccache /usr/bin/cc. By readingenv::args()directly we don't have this issue.Fixes #993
Based on rivy/rs.coreutils@ad3852a