Skip to content

Commit

Permalink
Avoid exceeding sun_path limit
Browse files Browse the repository at this point in the history
Unix domain sockets only allow ~103 bytes: compensate with terse paths.
  • Loading branch information
workingjubilee committed Jul 8, 2024
1 parent b8392e7 commit f2815a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pgrx-tests/src/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,12 +763,14 @@ fn get_extension_name() -> eyre::Result<String> {
}

fn get_pgdata_path() -> eyre::Result<PathBuf> {
// Note that this path is turned into an entry in the unix_socket_directories config.
// Each path has a low limit in maximum bytes, so we should avoid adding needless characters.
let mut pgdata_base = std::env::var("CARGO_PGRX_TEST_PGDATA")
.map(|path| PathBuf::from(path))
.unwrap_or_else(|_| {
let mut target_dir = get_target_dir()
.unwrap_or_else(|e| panic!("Failed to determine the crate target directory: {e}"));
target_dir.push("pgrx-test-pgdata");
target_dir.push("test-pgdata");
target_dir
});

Expand Down

0 comments on commit f2815a6

Please sign in to comment.