File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1582,13 +1582,31 @@ pub fn run_update(setup_path: &Path) -> Result<()> {
1582
1582
process:: exit ( 0 ) ;
1583
1583
}
1584
1584
1585
+ /// Ensure that the configuration is good after a self-update
1586
+ ///
1587
+ /// Currently the only thing we do is ensure that a profile is set
1588
+ /// since that could mess things up otherwise, and we don't really
1589
+ /// want to do a full metadata update for that. There are potentially
1590
+ /// legitimate reasons for a user to unset profile though so we only
1591
+ /// set it on updates rather than simply ensuring we always have a
1592
+ /// profile set in `Cfg::get_profile()`
1593
+ fn ensure_config_good ( ) -> Result < ( ) > {
1594
+ let cfg = common:: set_globals ( false , true ) ?;
1595
+ if cfg. get_profile ( ) ?. is_none ( ) {
1596
+ cfg. set_profile ( Profile :: default_name ( ) ) ?;
1597
+ }
1598
+
1599
+ Ok ( ( ) )
1600
+ }
1601
+
1585
1602
/// This function is as the final step of a self-upgrade. It replaces
1586
1603
/// `CARGO_HOME`/bin/rustup with the running exe, and updates the the
1587
1604
/// links to it. On windows this will run *after* the original
1588
1605
/// rustup process exits.
1589
1606
#[ cfg( unix) ]
1590
1607
pub fn self_replace ( ) -> Result < ( ) > {
1591
1608
install_bins ( ) ?;
1609
+ ensure_config_good ( ) ?;
1592
1610
1593
1611
Ok ( ( ) )
1594
1612
}
@@ -1597,6 +1615,7 @@ pub fn self_replace() -> Result<()> {
1597
1615
pub fn self_replace ( ) -> Result < ( ) > {
1598
1616
wait_for_parent ( ) ?;
1599
1617
install_bins ( ) ?;
1618
+ ensure_config_good ( ) ?;
1600
1619
1601
1620
Ok ( ( ) )
1602
1621
}
You can’t perform that action at this time.
0 commit comments