Skip to content

Commit 4873271

Browse files
committed
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.
1 parent 2faef12 commit 4873271

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/bootstrap/install.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ use crate::Compiler;
1717
use crate::builder::{Builder, RunConfig, ShouldRun, Step};
1818
use crate::config::{Config, TargetSelection};
1919

20+
#[cfg(target_os = "illumos")]
21+
const SHELL: &str = "bash";
22+
#[cfg(not(target_os = "illumos"))]
23+
const SHELL: &str = "sh";
24+
2025
fn install_sh(
2126
builder: &Builder<'_>,
2227
package: &str,
@@ -37,7 +42,7 @@ fn install_sh(
3742
let empty_dir = builder.out.join("tmp/empty_dir");
3843
t!(fs::create_dir_all(&empty_dir));
3944

40-
let mut cmd = Command::new("sh");
45+
let mut cmd = Command::new(SHELL);
4146
cmd.current_dir(&empty_dir)
4247
.arg(sanitize_sh(&tarball.decompressed_output().join("install.sh")))
4348
.arg(format!("--prefix={}", prepare_dir(prefix)))

0 commit comments

Comments
 (0)