Skip to content
Open
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
5 changes: 5 additions & 0 deletions scripts/install-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
#
set -eu

# Keep ASCII validation independent of the user's locale. On macOS, locale
# collation can make shell ranges such as [A-Z] match lowercase characters.
LC_ALL=C
export LC_ALL

if [ -z "${HOME:-}" ] && [ -z "${CHAT2DB_CLI_BIN_DIR:-}" ]; then
echo "error: HOME is not set; set CHAT2DB_CLI_BIN_DIR to choose an install directory" >&2
exit 1
Expand Down
23 changes: 23 additions & 0 deletions tests/install_cli_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,29 @@ mod unix_install_tests {
)));
}

#[test]
fn install_script_accepts_manifest_base_under_non_c_locale() {
let temp = tempfile::tempdir().unwrap();
let home = temp.path().join("home");
fs::create_dir_all(&home).unwrap();
let release = FakeRelease::start();
let lowercase_manifest_base = release.manifest_base_url.replace("127.0.0.1", "localhost");

let output = run_installer(
&home,
Some("/bin/zsh"),
&release,
&["--no-modify-path"],
&[
("CHAT2DB_CLI_MANIFEST_BASE", &lowercase_manifest_base),
("LC_ALL", "en_US.UTF-8"),
],
);

assert_success(&output);
assert!(stdout(&output).contains("installed:"));
}

#[test]
fn install_script_rejects_noncanonical_manifest_bases() {
for base in [
Expand Down