Skip to content
Merged
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion crates/lib/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub async fn ensure(config: &Config, conn: &mut Connection) -> Result<(), Box<dy

pub async fn update(config: &Config, conn: &mut Connection) -> Result<(), Box<dyn Error>> {
if std::env::var("PKGX_PANTRY_DIR").is_ok() {
return Err("PKGX_PANTRY_DIR is set, refusing to update pantry")?;
return ensure(config, conn).await;
}
replace(config, conn).await
Comment on lines 34 to 47
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When PKGX_PANTRY_DIR is set, update() now calls ensure(), which will call replace() (download + archive.unpack(dest)) if pantry_dir/projects is missing. That means a misconfigured PKGX_PANTRY_DIR can cause us to extract the pantry tarball into an arbitrary user-provided directory (potentially overwriting files), whereas we previously refused to update in this mode. Consider keeping the safety guard: if PKGX_PANTRY_DIR is set, only rebuild/cache the DB when pantry_dir/projects exists; otherwise return a clear error about the invalid pantry dir rather than downloading/extracting into it.

Copilot uses AI. Check for mistakes.
}
Expand Down
Loading