(path: &Path)
| 6431 | } |
| 6432 | |
| 6433 | fn 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 | |
| 6461 | fn archive_entries(path: &Path) -> Result<HashSet<String>> { |
| 6462 | let file = fs::File::open(path).with_context(|| format!("open {}", path.display()))?; |
no test coverage detected