Skip to content

Commit

Permalink
Rollup merge of rust-lang#84250 - jclulow:illumos-bash-bootstrap, r=M…
Browse files Browse the repository at this point in the history
…ark-Simulacrum

bootstrap: use bash on illumos to run install scripts

The default illumos shell ("sh" in the default PATH) is ksh93, rather
than bash, and does not support constructs like "local" that came from
bash.  The bootstrap function for invoking "install.sh" scripts should
use "bash" explicitly there to avoid issues.
  • Loading branch information
Dylan-DPC authored Apr 22, 2021
2 parents 55ba3de + 4873271 commit 39558a1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/bootstrap/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ use crate::Compiler;
use crate::builder::{Builder, RunConfig, ShouldRun, Step};
use crate::config::{Config, TargetSelection};

#[cfg(target_os = "illumos")]
const SHELL: &str = "bash";
#[cfg(not(target_os = "illumos"))]
const SHELL: &str = "sh";

fn install_sh(
builder: &Builder<'_>,
package: &str,
Expand All @@ -37,7 +42,7 @@ fn install_sh(
let empty_dir = builder.out.join("tmp/empty_dir");
t!(fs::create_dir_all(&empty_dir));

let mut cmd = Command::new("sh");
let mut cmd = Command::new(SHELL);
cmd.current_dir(&empty_dir)
.arg(sanitize_sh(&tarball.decompressed_output().join("install.sh")))
.arg(format!("--prefix={}", prepare_dir(prefix)))
Expand Down

0 comments on commit 39558a1

Please sign in to comment.