Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions crates/bashkit/src/interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7980,13 +7980,16 @@ impl Interpreter {

/// Get the separator for `[*]` array joins: first char of IFS, or space if IFS unset.
fn get_ifs_separator(&self) -> String {
match self.variables.get("IFS") {
Some(ifs) => ifs
.chars()
let ifs = self.expand_variable("IFS");
if ifs.is_empty() && !self.is_variable_set("IFS") {
// IFS unset: default separator is space
" ".to_string()
} else {
// IFS set (possibly empty): first char or empty
ifs.chars()
.next()
.map(|c| c.to_string())
.unwrap_or_default(),
None => " ".to_string(),
.unwrap_or_default()
}
}

Expand Down
20 changes: 20 additions & 0 deletions crates/bashkit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2485,6 +2485,26 @@ fn
assert_eq!(result.stdout, "test\n");
}

#[tokio::test]
async fn test_local_ifs_array_join() {
// Regression: local IFS=":" must affect "${arr[*]}" joining
let mut bash = Bash::new();
let result = bash
.exec(
r#"
fn() {
local arr=(a b c)
local IFS=":"
echo "${arr[*]}"
}
fn
"#,
)
.await
.unwrap();
assert_eq!(result.stdout, "a:b:c\n");
}

#[tokio::test]
async fn test_glob_star() {
let mut bash = Bash::new();
Expand Down
2 changes: 1 addition & 1 deletion supply-chain/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ version = "2.13.0"
criteria = "safe-to-deploy"

[[exemptions.insta]]
version = "1.47.1"
version = "1.47.2"
criteria = "safe-to-run"

[[exemptions.instant]]
Expand Down
Loading