File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -793,6 +793,8 @@ def set_dist_environment(self, url):
793793
794794 def check_vendored_status (self ):
795795 """Check that vendoring is configured properly"""
796+ # keep this consistent with the equivalent check in rustbuild:
797+ # https://github.com/rust-lang/rust/blob/a8a33cf27166d3eabaffc58ed3799e054af3b0c6/src/bootstrap/lib.rs#L399-L405
796798 if 'SUDO_USER' in os .environ and not self .use_vendored_sources :
797799 if os .getuid () == 0 :
798800 self .use_vendored_sources = True
Original file line number Diff line number Diff line change @@ -396,13 +396,18 @@ impl Build {
396396 let src = config. src . clone ( ) ;
397397 let out = config. out . clone ( ) ;
398398
399+ #[ cfg( unix) ]
400+ // keep this consistent with the equivalent check in x.py:
401+ // https://github.com/rust-lang/rust/blob/a8a33cf27166d3eabaffc58ed3799e054af3b0c6/src/bootstrap/bootstrap.py#L796-L797
399402 let is_sudo = match env:: var_os ( "SUDO_USER" ) {
400- Some ( sudo_user ) => match env :: var_os ( "USER" ) {
401- Some ( user ) => user != sudo_user ,
402- None => false ,
403- } ,
403+ Some ( _sudo_user ) => {
404+ let uid = unsafe { libc :: getuid ( ) } ;
405+ uid == 0
406+ }
404407 None => false ,
405408 } ;
409+ #[ cfg( not( unix) ) ]
410+ let is_sudo = false ;
406411
407412 let ignore_git = config. ignore_git ;
408413 let rust_info = channel:: GitInfo :: new ( ignore_git, & src) ;
You can’t perform that action at this time.
0 commit comments