MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / check_extension_archive_layout

Function check_extension_archive_layout

xtask/src/main.rs:6433–6459  ·  view source on GitHub ↗
(path: &Path)

Source from the content-addressed store, hash-verified

6431}
6432
6433fn check_extension_archive_layout(path: &Path) -> Result<()> {
6434 let entries = archive_entries(path)?;
6435 for entry in entries {
6436 if matches!(
6437 entry.as_str(),
6438 "lib"
6439 | "lib/postgresql"
6440 | "share"
6441 | "share/postgresql"
6442 | "share/postgresql/extension"
6443 | "share/postgresql/tsearch_data"
6444 ) {
6445 continue;
6446 }
6447 if entry.starts_with("lib/postgresql/")
6448 || entry.starts_with("share/postgresql/extension/")
6449 || entry.starts_with("share/postgresql/tsearch_data/")
6450 {
6451 continue;
6452 }
6453 bail!(
6454 "extension archive {} contains non-canonical path {entry}",
6455 path.display()
6456 );
6457 }
6458 Ok(())
6459}
6460
6461fn archive_entries(path: &Path) -> Result<HashSet<String>> {
6462 let file = fs::File::open(path).with_context(|| format!("open {}", path.display()))?;

Callers 1

Calls 1

archive_entriesFunction · 0.70

Tested by

no test coverage detected