Skip to content

Commit

Permalink
pm: fix assertion failure when printing lockfile summary after adding…
Browse files Browse the repository at this point in the history
… git transitive dependency
  • Loading branch information
nektro authored Oct 10, 2024
1 parent ff47631 commit 6e5280b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/install/install.zig
Original file line number Diff line number Diff line change
Expand Up @@ -12307,6 +12307,16 @@ pub const PackageManager = struct {
this.names = packages.items(.name);
this.bins = packages.items(.bin);
this.resolutions = packages.items(.resolution);

// fixes an assertion failure where a transitive dependency is a git dependency newly added to the lockfile after the list of dependencies has been resized
// this assertion failure would also only happen after the lockfile has been written to disk and the summary is being printed.
if (this.successfully_installed.bit_length < this.lockfile.packages.len) {
const new = Bitset.initEmpty(bun.default_allocator, this.lockfile.packages.len) catch bun.outOfMemory();
var old = this.successfully_installed;
defer old.deinit(bun.default_allocator);
old.copyInto(new);
this.successfully_installed = new;
}
}

/// Install versions of a package which are waiting on a network request
Expand Down

0 comments on commit 6e5280b

Please sign in to comment.