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
8 changes: 7 additions & 1 deletion cmux-tui/crates/cmux-tui-core/src/git_seed/tests/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,13 @@ fn a_secret_with_a_non_utf8_name_never_goes() {
use std::os::unix::ffi::OsStrExt as _;
let (world, folder, first) = seeded("export-nonutf8");
let name = std::ffi::OsStr::from_bytes(b".env-\xff");
std::fs::write(folder.join(name), "SECRET=1\n").unwrap();
// APFS (macOS) refuses a name that is not UTF-8 (EILSEQ), so no folder there can hold
// such a secret; ext4 and the other Linux filesystems take raw bytes, and the Linux runs
// of the cmux-tui tests cover this case (as git_seed/secrets.rs since #32091).
match std::fs::write(folder.join(name), "SECRET=1\n") {
Err(e) if cfg!(target_os = "macos") && e.raw_os_error() == Some(libc::EILSEQ) => return,
written => written.unwrap(),
}
write(&folder.join("a"), "a\nchanged\n");
let service = world.service();
let bundle = world.home.join("back.bundle");
Expand Down
8 changes: 7 additions & 1 deletion cmux-tui/crates/cmux-tui/src/link/seed/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,13 @@ fn a_secret_with_a_non_utf8_name_is_left_out() {
use std::os::unix::ffi::OsStrExt as _;
let f = Fixture::new();
let secret = std::ffi::OsStr::from_bytes(b".env-\xff");
std::fs::write(f.work.join(secret), "SECRET=1\n").unwrap();
// APFS (macOS) refuses a name that is not UTF-8 (EILSEQ), so no folder there can hold
// such a secret; ext4 and the other Linux filesystems take raw bytes, and the Linux runs
// of the cmux-tui tests cover this case (as git_seed/secrets.rs since #32091).
match std::fs::write(f.work.join(secret), "SECRET=1\n") {
Err(e) if cfg!(target_os = "macos") && e.raw_os_error() == Some(libc::EILSEQ) => return,
written => written.unwrap(),
}
let hashed =
Command::new("git").arg("-C").arg(&f.work).arg("hash-object").arg(secret).output().unwrap();
assert!(hashed.status.success());
Expand Down
Loading