Closed DarthGandalf closed 5 years ago
I have that issue too and I found this
https://github.com/rust-lang/rust/issues/49269
using sudo is the problem also see 376 line of your log
so you must not use sudo
try su
@Riey the ebuild shouldn't depend on whether I used sudo or su to run emerge.
Can you show log for that?
Log of what? I already posted above how it failed. The only command I was running was emerge rust
, and it shouldn't care whether I was using sudo or something else.
I never ran sudo ./x.py
directly.
Same output for only use su
?
make sure $SUDO_USER is not set
If the problem is in how x.py treats $SUDO_USER, the rust ebuild probably should clean that variable.
It shouldn't be set until using sudo
In my case start in local user then using su to login to root
and using emerge rust:git works fine
That might be a workaround, yes.
But it's still a bug in either rust build system, or in the ebuild.
https://github.com/rust-lang/rust/issues/40108
It's expected behavior but seems to be little weird
If it's expected, then it's the ebuild's job to either clean up the environment to not confuse x.py, or to provide the vendor folder itself, somehow.
A temporary fix for this is using package.env
to either unset SUDO_USER
(which doesn't seem to be possible with package.env
?) or, looking at bootstrap.py
, set both SUDO_USER
and USER
to portage
(or root
if sandbox
is disabled, I guess).
/etc/portage/env/fix-sudo-user
:
SUDO_USER=portage
USER=portage
/etc/portage/package.env/rust
:
=dev-lang/rust-9999 fix-sudo-user
Or even better, just remove the offending code block in a patch.
/etc/portage/patches/dev-lang/rust-9999/0000-no-vendor-sudo-user.patch
:
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -776,15 +776,6 @@ def bootstrap(help_triggered):
build.use_locked_deps = '\nlocked-deps = true' in build.config_toml
- if 'SUDO_USER' in os.environ and not build.use_vendored_sources:
- if os.environ.get('USER') != os.environ['SUDO_USER']:
- build.use_vendored_sources = True
- print('info: looks like you are running this command under `sudo`')
- print(' and so in order to preserve your $HOME this will now')
- print(' use vendored sources by default. Note that if this')
- print(' does not work you should run a normal build first')
- print(' before running a command like `sudo ./x.py install`')
-
if build.use_vendored_sources:
if not os.path.exists('.cargo'):
os.makedirs('.cargo')
https://pastebin.com/Ld3CfCKq
This happens with and without
FEATURES="network-sandbox"