Skip to content

fix(pacquet): preserve exec bit on copy fallback - #12385

Merged
zkochan merged 1 commit into
pnpm:mainfrom
kimulaco:fix/12171
Jun 14, 2026
Merged

zkochan merged 1 commit into
pnpm:mainfrom
kimulaco:fix/12171

Conversation

@kimulaco

@kimulaco kimulaco commented Jun 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #12171.

pacquet stores executable CAFS entries under paths ending in -exec, but the copy fallback tier in link_file.rs materialized them without the executable bit. When hardlink/reflink isn't available and the install falls back to fs::copy (e.g. overlayfs on CI), a native binary such as @esbuild/linux-x64/bin/esbuild lands at 0o644 and fails to spawn with EACCES.

This routes all copy-tier imports through one copy_file helper. On Unix, when the CAS source path ends with -exec, it OR-s the exec bits onto the copied file, mirroring git-fetcher's existing materialize_into. Non-executable files are left exactly as fs::copy produced them.

#12177 (closed) took the same direction but re-read and re-applied the source's full mode to every copied file. This version only touches files the store marked executable (-exec suffix), so it never widens a restrictive mode (e.g. 0o600 → 0o711) and adds no set_permissions syscall on the non-exec majority. Rather than duplicate that logic, the -exec check now lives in a shared pacquet_fs::file_mode::cas_path_is_executable that both copy paths call, replacing the private copy in cas_io.rs.

This is a pacquet-only bug. pnpm preserves the exec bit on its own copy path, so no pnpm-side change is needed.

Summary by CodeRabbit

  • Bug Fixes
    • Executable file permissions are now properly preserved during package import operations. Files marked as executable in the package cache are correctly restored with appropriate executable permissions when copied to the system, while non-executable files retain their original permissions.

@kimulaco
kimulaco requested a review from zkochan as a code owner June 13, 2026 14:30
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 13, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Qodo Logo

@coderabbitai

coderabbitai Bot commented Jun 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cb1ff6b0-78a2-4cec-bf27-df1c6ab9aaf3

📥 Commits

Reviewing files that changed from the base of the PR and between eb2dba3 and 328ae73.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • pacquet/crates/fs/src/file_mode.rs
  • pacquet/crates/fs/src/file_mode/tests.rs
  • pacquet/crates/git-fetcher/Cargo.toml
  • pacquet/crates/git-fetcher/src/cas_io.rs
  • pacquet/crates/package-manager/src/link_file.rs
  • pacquet/crates/package-manager/src/link_file/tests.rs
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (2)
pacquet/**/Cargo.toml

📄 CodeRabbit inference engine (pacquet/AGENTS.md)

pacquet/**/Cargo.toml: Check whether the workspace already depends on something suitable in [workspace.dependencies] in the root Cargo.toml before adding a new dependency
Keep dependencies at the right level — add a new dependency to the specific crate that needs it, not to the workspace root or shared crate unless multiple crates depend on it

Files:

  • pacquet/crates/git-fetcher/Cargo.toml
pacquet/**/*.rs

📄 CodeRabbit inference engine (pacquet/AGENTS.md)

pacquet/**/*.rs: Log emissions are part of matching pnpm — when porting a function that fires pnpm:<channel> events through globalLogger, logger.debug(...), or streamParser.write(...), mirror the call site, payload, and ordering so @pnpm/cli.default-reporter parses pacquet's NDJSON the same way
Declare a newtype wrapper for branded string types instead of collapsing the brand into a plain String or &str in Rust
If upstream TypeScript always validates before construction of a branded string, validate in the Rust wrapper too via TryFrom<String> and/or FromStr and do not provide an infallible public constructor
If upstream TypeScript never validates a branded string, just brand for type-safety in Rust by exposing an infallible From<String> constructor
If upstream TypeScript occasionally constructs a branded string without validation, expose from_str_unchecked in Rust as an escape hatch alongside the validating constructor
Match upstream serde behavior for branded strings crossing JSON, YAML, or INI boundaries by using #[serde(try_from = "String")] for deserialization and #[serde(into = "String")] for serialization
Derive simple conversions for branded strings using #[derive(derive_more::From)] and #[derive(derive_more::Into)] instead of handwriting impl blocks; use manual impl only when conversion needs custom logic
Model TypeScript string literal unions (like 'auto' | 'always' | 'never') as Rust enums instead of newtype wrappers, since the set of valid values is closed
Treat TypeScript string template literal types (like `${string}@${string}`) the same as branded string types in Rust, using a newtype wrapper with validation
Follow the code style guide in CODE_STYLE_GUIDE.md — imports, modules, naming, ownership and borrowing, parameter type selection, trait bounds, pattern matching, pipe-trait, error handling, test layout, and cloning of Arc and Rc
Choose owned vs. borrowed parameters to minimize copies; widen to t...

Files:

  • pacquet/crates/fs/src/file_mode/tests.rs
  • pacquet/crates/fs/src/file_mode.rs
  • pacquet/crates/package-manager/src/link_file/tests.rs
  • pacquet/crates/package-manager/src/link_file.rs
  • pacquet/crates/git-fetcher/src/cas_io.rs
🧠 Learnings (6)
📚 Learning: 2026-05-20T19:40:55.051Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11774
File: pacquet/crates/resolving-deps-resolver/src/resolve_peers.rs:0-0
Timestamp: 2026-05-20T19:40:55.051Z
Learning: In the pacquet Rust code, ensure the semver implementation uses the `node-semver` crate (not `nodejs-semver`). `node-semver`’s public API does not include a `satisfies_with_prerelease`-style method; prerelease-tolerant matching should be implemented inline by first calling `Range::satisfies`, and when it rejects a prerelease version, retry matching against a stripped `MAJOR.MINOR.PATCH` base of the prerelease version.

Applied to files:

  • pacquet/crates/fs/src/file_mode/tests.rs
  • pacquet/crates/fs/src/file_mode.rs
  • pacquet/crates/package-manager/src/link_file/tests.rs
  • pacquet/crates/package-manager/src/link_file.rs
  • pacquet/crates/git-fetcher/src/cas_io.rs
📚 Learning: 2026-05-22T00:08:44.646Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11837
File: pacquet/crates/resolving-npm-resolver/src/pick_package.rs:33-51
Timestamp: 2026-05-22T00:08:44.646Z
Learning: In the pnpm/pnpm repo’s pacquet Rust crates, do not flag Unicode ellipsis characters (U+2026, `…`) in Rust doc comments (`///` / `/** */`) as a lint violation. The pacquet crate’s `dylint.toml` only enables `perfectionist::derive_ordering`, and the Dylint `unicode-ellipsis` rule is not enabled for this project—so `…` in doc comments is an intentional, repo-consistent style.

Applied to files:

  • pacquet/crates/fs/src/file_mode/tests.rs
  • pacquet/crates/fs/src/file_mode.rs
  • pacquet/crates/package-manager/src/link_file/tests.rs
  • pacquet/crates/package-manager/src/link_file.rs
  • pacquet/crates/git-fetcher/src/cas_io.rs
📚 Learning: 2026-05-20T23:07:58.444Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11784
File: pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs:120-133
Timestamp: 2026-05-20T23:07:58.444Z
Learning: When reviewing code in this pacquet Rust port, follow the upstream pnpm compatibility rule: only match pnpm’s behavior exactly. Do not propose review changes that intentionally deviate from pnpm’s documented/observed behavior, even if pnpm appears buggy. If you identify a real bug in pnpm behavior, the review should prioritize fixing it upstream in pnpm first, and avoid implementing a pnpm-behavior workaround here unless the same fix has already landed upstream.

Applied to files:

  • pacquet/crates/fs/src/file_mode/tests.rs
  • pacquet/crates/fs/src/file_mode.rs
  • pacquet/crates/package-manager/src/link_file/tests.rs
  • pacquet/crates/package-manager/src/link_file.rs
  • pacquet/crates/git-fetcher/src/cas_io.rs
📚 Learning: 2026-06-06T18:58:37.156Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 12243
File: pacquet/crates/package-manager/src/install_package_by_snapshot.rs:319-322
Timestamp: 2026-06-06T18:58:37.156Z
Learning: When reviewing Rust code, do not assume `matches!(expr, Pattern(_))` will move out of `expr` if `Pattern(_)` contains no by-value bindings. `matches!` desugars to a `match` that auto-borrows the scrutinee for discrimination, so even if `expr` is a non-`Copy` value behind a shared reference (e.g., `&T`), the macro should not move-out of the borrowed data purely due to `matches!`. Treat `matches!(&expr, Pattern(_))` as a readability/clarity improvement, not a correctness requirement. Only flag potential move-out-of-borrow risks when the pattern includes by-value bindings that would require moving the matched value.

Applied to files:

  • pacquet/crates/fs/src/file_mode/tests.rs
  • pacquet/crates/fs/src/file_mode.rs
  • pacquet/crates/package-manager/src/link_file/tests.rs
  • pacquet/crates/package-manager/src/link_file.rs
  • pacquet/crates/git-fetcher/src/cas_io.rs
📚 Learning: 2026-06-12T20:41:57.558Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 12364
File: pacquet/crates/package-manager/src/install/tests.rs:5717-5717
Timestamp: 2026-06-12T20:41:57.558Z
Learning: In the pnpm/pnpm Rust workspace (toolchain Rust 1.95.0), keep using `std::time::Duration::from_mins(...)` and `std::time::Duration::from_hours(...)` as-is. Do not flag these as invalid or suggest replacing them with `Duration::from_secs(...)`, because Clippy’s `clippy::duration_suboptimal_units` lint is denied by `-D warnings` in CI, and changing to seconds may trigger CI failures.

Applied to files:

  • pacquet/crates/fs/src/file_mode/tests.rs
  • pacquet/crates/fs/src/file_mode.rs
  • pacquet/crates/package-manager/src/link_file/tests.rs
  • pacquet/crates/package-manager/src/link_file.rs
  • pacquet/crates/git-fetcher/src/cas_io.rs
📚 Learning: 2026-06-12T07:04:03.703Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 12227
File: pacquet/crates/package-manager/src/install.rs:708-719
Timestamp: 2026-06-12T07:04:03.703Z
Learning: In this pnpm-based repo’s package-manager Rust code, `ThrottledClient` uses a two-class semaphore scheduling policy (“reserved half” for tarball/download work and a higher-priority “latency class” for lockfile-verification metadata fetches). Therefore, when reviewing, do NOT flag reuse of the same `Arc<ThrottledClient>` for both downloads and verification as a budget/contention issue—this reuse is intentional and handled by the internal two-class “reserved permits” design. Creating a separate client instance would break the EMFILE guard behavior that relies on shared throttling.

Applied to files:

  • pacquet/crates/package-manager/src/link_file/tests.rs
  • pacquet/crates/package-manager/src/link_file.rs
🔇 Additional comments (6)
pacquet/crates/fs/src/file_mode.rs (1)

1-1: LGTM!

Also applies to: 20-28

pacquet/crates/fs/src/file_mode/tests.rs (1)

1-2: LGTM!

Also applies to: 25-37

pacquet/crates/git-fetcher/Cargo.toml (1)

16-16: LGTM!

pacquet/crates/git-fetcher/src/cas_io.rs (1)

18-18: LGTM!

Also applies to: 114-115, 148-148

pacquet/crates/package-manager/src/link_file.rs (1)

217-221: LGTM!

Also applies to: 233-235, 239-260, 347-349, 380-382

pacquet/crates/package-manager/src/link_file/tests.rs (1)

48-89: LGTM!


📝 Walkthrough

Walkthrough

This PR fixes an issue where executable bits are not preserved when pacquet falls back from hardlink to copy on overlayfs. It introduces a shared cas_path_is_executable helper that detects executability via -exec suffix, refactors git-fetcher to use this helper, and adds copy_file wrapper in link_file.rs that restores executable permissions after all copy operations.

Changes

Executable bit preservation on copy fallback

Layer / File(s) Summary
Shared CAS executable detection helper
pacquet/crates/fs/src/file_mode.rs, pacquet/crates/fs/src/file_mode/tests.rs
Adds cas_path_is_executable(&Path) -> bool function that checks if a CAS path's file name ends with -exec suffix. Unit test validates the suffix detection logic for trailing, substring, and parent-directory occurrences.
Git-fetcher refactoring to use shared helpers
pacquet/crates/git-fetcher/Cargo.toml, pacquet/crates/git-fetcher/src/cas_io.rs
Git-fetcher now depends on pacquet-fs and imports cas_path_is_executable and is_executable from the shared module. Removes local cas_path_is_executable implementation and standardizes executable-bit detection to use imported helpers and EXEC_MASK constant across materialize and import operations.
Link-file copy fallback with executable restoration
pacquet/crates/package-manager/src/link_file.rs, pacquet/crates/package-manager/src/link_file/tests.rs
Introduces copy_file helper that wraps fs::copy and restores executable permissions on Unix when CAS source is marked executable via the -exec suffix. Routes hardlink cross-device fallback, explicit Copy method, and downgrade-chain fallbacks through copy_file for consistent exec-bit restoration. Two new tests verify that -exec suffix enforces executable mode (0o755) and non-exec files preserve their original restrictive permissions without widening.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • zkochan

Poem

🐰 A humble rabbit hops through the store,
Finding executable bits where they were before,
With -exec suffixes marking the way,
Copies stay faithful, come what may!
No overlayfs tricks can fool this brave fix,
Permission preservation is now in the mix! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(pacquet): preserve exec bit on copy fallback' directly and clearly describes the main change—restoring executable permissions when pacquet copies files.
Linked Issues check ✅ Passed All coding requirements from #12171 are met: the PR centralizes exec-bit detection in cas_path_is_executable, applies it consistently on Unix via copy_file helper, and matches git-fetcher's existing behavior.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the exec bit loss on copy fallback: new helper in pacquet_fs, refactoring cas_io.rs for reuse, and adding exec-bit restoration in link_file.rs.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Fix pacquet copy fallback to preserve exec bit for CAS "-exec" entries
🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

Walkthroughs

Description
• Restore executable permissions when copy fallback materializes CAS paths ending in "-exec".
• Centralize "CAS path is executable" logic in pacquet-fs and reuse across crates.
• Add Unix-only regression tests to prevent exec-bit loss and permission widening.
Diagram
graph TD
  PM["package-manager: link_file.rs"] --> CF["copy_file helper"] --> FSCOPY["std::fs::copy"] --> DST[("Materialized file")]
  CF --> CASCHK["cas_path_is_executable"] --> FM["pacquet-fs: file_mode.rs"]
  CASCHK --> PERMSET["OR EXEC_MASK + set_permissions"] --> DST
  GF["git-fetcher: cas_io.rs"] --> CASCHK
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Re-stat source and copy full mode for every copied file
  • ➕ Preserves full POSIX mode bits (not just exec) where supported
  • ➕ Does not rely on a naming convention (-exec suffix)
  • ➖ Adds extra syscalls on the hot path (metadata + set_permissions for most files)
  • ➖ Can unintentionally widen or otherwise alter restrictive modes if not carefully constrained
  • ➖ Still may not be reliable if source mode is already wrong after prior materialization
2. Store executability as explicit metadata alongside CAS entries
  • ➕ Avoids encoding semantics into file names
  • ➕ More flexible if future attributes need preservation (e.g., readonly, ACL hints)
  • ➖ Requires format/index changes and migration logic
  • ➖ More invasive and higher risk than a targeted fix

Recommendation: The current approach is the best tradeoff: it restores only the exec bits for files the store explicitly marked executable via the "-exec" suffix, avoids permission widening for non-exec files, and keeps the common case fast by skipping set_permissions unless needed. The shared helper in pacquet-fs reduces duplication and keeps git-fetcher and package-manager consistent.

Grey Divider

File Changes

Bug fix (2)
file_mode.rs Add shared CAS "-exec" suffix executable detector +11/-1

Add shared CAS "-exec" suffix executable detector

• Introduces cas_path_is_executable(Path) to determine executability based on pnpm CAFS "-exec" filename suffix. Keeps exec-bit handling centralized in pacquet-fs for reuse across crates.

pacquet/crates/fs/src/file_mode.rs


link_file.rs Route copy fallback through helper that restores exec bits +35/-18

Route copy fallback through helper that restores exec bits

• Replaces direct fs::copy usage with a copy_file helper across copy fallback paths. On Unix, copy_file restores exec bits for CAS source paths ending in "-exec" via EXEC_MASK + set_permissions, while leaving non-exec files unchanged.

pacquet/crates/package-manager/src/link_file.rs


Refactor (1)
cas_io.rs Reuse pacquet-fs exec helpers and constants +3/-10

Reuse pacquet-fs exec helpers and constants

• Switches executable detection to pacquet_fs::file_mode::is_executable and replaces a local cas_path_is_executable with the shared pacquet-fs implementation. Also uses EXEC_MASK instead of a literal 0o111 when restoring permissions.

pacquet/crates/git-fetcher/src/cas_io.rs


Tests (2)
tests.rs Test CAS suffix-based executable detection +16/-1

Test CAS suffix-based executable detection

• Adds unit coverage ensuring only a trailing "-exec" in the file name marks a CAS path executable. Guards against false positives from parent directories or substrings.

pacquet/crates/fs/src/file_mode/tests.rs


tests.rs Add Unix regression tests for exec-bit restoration and no widening +43/-0

Add Unix regression tests for exec-bit restoration and no widening

• Adds Unix-only tests ensuring copied "-exec" CAS entries become executable (0o755) even if the source mode is 0o644, and that non-exec entries retain restrictive modes (e.g., 0o600) without gaining exec bits.

pacquet/crates/package-manager/src/link_file/tests.rs


Other (1)
Cargo.toml Add pacquet-fs dependency to git-fetcher +1/-0

Add pacquet-fs dependency to git-fetcher

• Adds pacquet-fs as a workspace dependency so git-fetcher can reuse shared file-mode utilities.

pacquet/crates/git-fetcher/Cargo.toml


Grey Divider

Qodo Logo

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.27%. Comparing base (4819fb4) to head (328ae73).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pacquet/crates/package-manager/src/link_file.rs 94.73% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #12385   +/-   ##
=======================================
  Coverage   88.26%   88.27%           
=======================================
  Files         297      297           
  Lines       38705    38710    +5     
=======================================
+ Hits        34164    34170    +6     
+ Misses       4541     4540    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

Scenario: Isolated linker: fresh restore, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.080 ± 0.124 3.938 4.272 1.98 ± 0.09
pacquet@main 3.994 ± 0.145 3.823 4.228 1.94 ± 0.10
pnpr@HEAD 2.087 ± 0.124 1.947 2.359 1.01 ± 0.07
pnpr@main 2.062 ± 0.074 1.958 2.199 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.07958797194,
      "stddev": 0.12435422427699691,
      "median": 4.0479508628400005,
      "user": 3.8324145799999996,
      "system": 3.4234881199999996,
      "min": 3.93841979534,
      "max": 4.27201892934,
      "times": [
        4.20129858334,
        4.27201892934,
        4.04292667534,
        4.05297505034,
        4.24065508634,
        3.94195329334,
        4.02715855434,
        3.93841979534,
        3.95420548934,
        4.12426826234
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.9941415778400007,
      "stddev": 0.14450869879285716,
      "median": 3.96952406484,
      "user": 3.7677250799999995,
      "system": 3.39638872,
      "min": 3.8233048103400002,
      "max": 4.2281194843400005,
      "times": [
        4.01585047634,
        4.22791875034,
        3.92319765334,
        3.8390775613400003,
        4.2281194843400005,
        3.9037042373400004,
        4.02485182634,
        3.9064560953400003,
        4.04893488334,
        3.8233048103400002
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.08721115224,
      "stddev": 0.12352670232057038,
      "median": 2.0411613388400003,
      "user": 2.689479079999999,
      "system": 2.9293827199999996,
      "min": 1.94701788734,
      "max": 2.35865617034,
      "times": [
        2.01200538034,
        2.01005003234,
        2.0687725013400002,
        2.1568893253400003,
        2.01851707834,
        2.35865617034,
        2.21820159134,
        2.01819595634,
        1.94701788734,
        2.06380559934
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.06228295654,
      "stddev": 0.07375032571662729,
      "median": 2.0587019038400003,
      "user": 2.5946717799999997,
      "system": 2.94364652,
      "min": 1.95838681434,
      "max": 2.1991224483400003,
      "times": [
        1.95838681434,
        2.05725688434,
        2.1991224483400003,
        1.9989959473399999,
        2.06014692334,
        2.14469509234,
        2.0828848143400003,
        2.05269880734,
        1.97719970134,
        2.09144213234
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 614.6 ± 16.4 591.5 645.5 1.00
pacquet@main 621.0 ± 16.2 599.7 654.4 1.01 ± 0.04
pnpr@HEAD 683.7 ± 21.1 659.9 722.9 1.11 ± 0.05
pnpr@main 677.0 ± 71.7 638.9 877.5 1.10 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6145884526200001,
      "stddev": 0.016389123295207197,
      "median": 0.60800705292,
      "user": 0.37042778000000004,
      "system": 1.28686856,
      "min": 0.59145515892,
      "max": 0.6455386269200001,
      "times": [
        0.63034629192,
        0.59145515892,
        0.60973114092,
        0.6052993749200001,
        0.60628296492,
        0.62300274792,
        0.6013900239200001,
        0.62749824992,
        0.6455386269200001,
        0.6053399459200001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6210152039200001,
      "stddev": 0.01618634118286255,
      "median": 0.61811072592,
      "user": 0.35640878,
      "system": 1.29490906,
      "min": 0.59965739992,
      "max": 0.65440444592,
      "times": [
        0.65440444592,
        0.59965739992,
        0.60822260092,
        0.61110338692,
        0.62509694492,
        0.63580980592,
        0.6104310339200001,
        0.6286342569200001,
        0.62566765692,
        0.6111245069200001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.68374329522,
      "stddev": 0.021096969368269672,
      "median": 0.67907131092,
      "user": 0.38491297999999996,
      "system": 1.3253664600000001,
      "min": 0.6598786519200001,
      "max": 0.72294231992,
      "times": [
        0.72294231992,
        0.6873373649200001,
        0.71494430892,
        0.67184668392,
        0.67553347192,
        0.6598786519200001,
        0.68260914992,
        0.66055753892,
        0.68952812892,
        0.6722553329200001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.6770025791200001,
      "stddev": 0.07171313195518873,
      "median": 0.66155859192,
      "user": 0.36472448,
      "system": 1.3184594600000001,
      "min": 0.63890930292,
      "max": 0.8774723079200001,
      "times": [
        0.66242001792,
        0.64064869392,
        0.6420467159200001,
        0.66434578592,
        0.63890930292,
        0.67788899892,
        0.66069716592,
        0.6648617799200001,
        0.6407350219200001,
        0.8774723079200001
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.137 ± 0.052 4.051 4.199 1.92 ± 0.14
pacquet@main 4.126 ± 0.042 4.048 4.188 1.92 ± 0.14
pnpr@HEAD 2.152 ± 0.157 1.982 2.419 1.00
pnpr@main 2.224 ± 0.171 2.004 2.402 1.03 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.13672194372,
      "stddev": 0.052421676523051214,
      "median": 4.15259515872,
      "user": 3.7338322399999995,
      "system": 3.3019990200000002,
      "min": 4.05090732522,
      "max": 4.19894272322,
      "times": [
        4.07588088822,
        4.18881777422,
        4.11488903422,
        4.16845139122,
        4.1784893182200005,
        4.13673892622,
        4.08423686622,
        4.05090732522,
        4.19894272322,
        4.16986519022
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.126162526419999,
      "stddev": 0.042168065446449125,
      "median": 4.1347180982200005,
      "user": 3.67656534,
      "system": 3.3022844200000003,
      "min": 4.04829280822,
      "max": 4.18828627622,
      "times": [
        4.12212001922,
        4.13176101522,
        4.09749662222,
        4.14165090022,
        4.07521918022,
        4.15709347522,
        4.16202978622,
        4.18828627622,
        4.13767518122,
        4.04829280822
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.1524958821199998,
      "stddev": 0.15726125825053813,
      "median": 2.09413075922,
      "user": 2.52576804,
      "system": 2.87322802,
      "min": 1.98172502822,
      "max": 2.41895850222,
      "times": [
        2.00175498322,
        2.06270628922,
        1.98172502822,
        2.41895850222,
        2.05545822922,
        2.08384067022,
        2.10442084822,
        2.40608493722,
        2.25680776122,
        2.15320157222
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.22420709882,
      "stddev": 0.17134092893939473,
      "median": 2.23121845822,
      "user": 2.46754404,
      "system": 2.86461592,
      "min": 2.00364214622,
      "max": 2.40162995922,
      "times": [
        2.05226045722,
        2.37906079122,
        2.40162995922,
        2.10221582022,
        2.3843469922200002,
        2.36022109622,
        2.10036272622,
        2.39669650722,
        2.00364214622,
        2.06163449222
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.281 ± 0.013 1.264 1.303 2.01 ± 0.05
pacquet@main 1.299 ± 0.066 1.258 1.483 2.04 ± 0.11
pnpr@HEAD 0.658 ± 0.087 0.612 0.905 1.03 ± 0.14
pnpr@main 0.638 ± 0.013 0.623 0.666 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.2806402340799998,
      "stddev": 0.013008326987977268,
      "median": 1.27711232758,
      "user": 1.29534196,
      "system": 1.6646501399999998,
      "min": 1.26384812508,
      "max": 1.30332902308,
      "times": [
        1.26384812508,
        1.27359193008,
        1.30090263508,
        1.27759199608,
        1.28590687008,
        1.2766326590800001,
        1.27552475908,
        1.26704728208,
        1.30332902308,
        1.28202706108
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.2989531186799999,
      "stddev": 0.06568007993064014,
      "median": 1.28278931008,
      "user": 1.25844726,
      "system": 1.6974757399999998,
      "min": 1.25784948908,
      "max": 1.48346705608,
      "times": [
        1.26863078208,
        1.25784948908,
        1.48346705608,
        1.29096584608,
        1.2829269970800001,
        1.2697354600800002,
        1.28265162308,
        1.2765640550800001,
        1.28998077108,
        1.28675910708
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.65789183378,
      "stddev": 0.08713637407100949,
      "median": 0.63359016508,
      "user": 0.33551116,
      "system": 1.24488644,
      "min": 0.6117127610800001,
      "max": 0.9047286780800001,
      "times": [
        0.63411930208,
        0.62467394608,
        0.6117127610800001,
        0.64382365308,
        0.63103712408,
        0.63335633708,
        0.9047286780800001,
        0.63525196108,
        0.63382399308,
        0.6263905820800001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.63764380158,
      "stddev": 0.012814690820564339,
      "median": 0.63457293958,
      "user": 0.31144365999999996,
      "system": 1.25135454,
      "min": 0.62311705608,
      "max": 0.66597122208,
      "times": [
        0.66597122208,
        0.63325339408,
        0.64521191708,
        0.64516147308,
        0.6270854300800001,
        0.6429774290800001,
        0.62311705608,
        0.62451421508,
        0.6349171530800001,
        0.63422872608
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.944 ± 0.086 2.879 3.175 4.74 ± 0.15
pacquet@main 2.936 ± 0.045 2.897 3.057 4.73 ± 0.09
pnpr@HEAD 0.637 ± 0.008 0.628 0.656 1.03 ± 0.02
pnpr@main 0.621 ± 0.008 0.608 0.635 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.94421398796,
      "stddev": 0.08647166192032377,
      "median": 2.91424948436,
      "user": 1.76101352,
      "system": 1.8986563399999998,
      "min": 2.87881867186,
      "max": 3.1748810648599997,
      "times": [
        2.97094719586,
        2.90806534686,
        2.87881867186,
        2.92043362186,
        2.95085067286,
        2.8966096548599998,
        2.89699264186,
        3.1748810648599997,
        2.95161574286,
        2.8929252658599998
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.93640269956,
      "stddev": 0.04477241149844641,
      "median": 2.92749479136,
      "user": 1.7106353200000002,
      "system": 1.9177815399999996,
      "min": 2.8971965108599997,
      "max": 3.05724291186,
      "times": [
        2.93445681986,
        2.8971965108599997,
        2.9219547478599996,
        2.91392966986,
        2.90891246786,
        2.93520527886,
        2.9444299198599997,
        2.93303483486,
        3.05724291186,
        2.91766383386
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.6371309199599999,
      "stddev": 0.00849153392339051,
      "median": 0.63569121236,
      "user": 0.33872452000000003,
      "system": 1.2417101400000001,
      "min": 0.6276793968600001,
      "max": 0.6560527968600001,
      "times": [
        0.6380026628600001,
        0.64446200886,
        0.6346141488600001,
        0.6405806298600001,
        0.6295429208600001,
        0.62899220986,
        0.6350258788600001,
        0.6276793968600001,
        0.63635654586,
        0.6560527968600001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.6213538482600001,
      "stddev": 0.007689652426711803,
      "median": 0.62286213136,
      "user": 0.31738052000000005,
      "system": 1.23882264,
      "min": 0.60827333386,
      "max": 0.63509635586,
      "times": [
        0.63509635586,
        0.62374402086,
        0.62018750286,
        0.60963103086,
        0.62153472886,
        0.6242277848600001,
        0.60827333386,
        0.62421816086,
        0.6219802418600001,
        0.6246453218600001
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12385
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
4,136.72 ms
(-13.69%)Baseline: 4,792.91 ms
5,751.49 ms
(71.92%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
2,944.21 ms
(-4.37%)Baseline: 3,078.83 ms
3,694.60 ms
(79.69%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,280.64 ms
(+8.02%)Baseline: 1,185.51 ms
1,422.61 ms
(90.02%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
4,079.59 ms
(-21.46%)Baseline: 5,194.56 ms
6,233.48 ms
(65.45%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
614.59 ms
(-5.98%)Baseline: 653.68 ms
784.41 ms
(78.35%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12385
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,152.50 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
637.13 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
657.89 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,087.21 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
683.74 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit 2da0444 into pnpm:main Jun 14, 2026
23 checks passed
@kimulaco
kimulaco deleted the fix/12171 branch June 14, 2026 13:23
zkochan added a commit that referenced this pull request Jun 19, 2026
On Linux reflink_copy::reflink uses FICLONE, which clones only the data into a
freshly-created 0o644 target, dropping the exec bit pacquet encodes in the
`-exec` CAS suffix. #12385 restored it for the copy tier but left clone
out, so an undeclared executable like `@esbuild/linux-x64/bin/esbuild` failed
with EACCES. hardlink shares the store inode's 0o755 and copy was fixed, so only
clone was affected.

Extract the restoration (already duplicated in copy_file and git-fetcher's
materialize_into) into a shared
pacquet_fs::file_mode::restore_exec_bit_from_cas_suffix and route clone through
it. In auto_link / clone_or_copy_link only a reflink failure downgrades; the
post-reflink restoration error stays terminal, so it can't trigger a hardlink
retry against the just-created file that would mask it behind AlreadyExists.

Fixes #12500.

---------

Co-authored-by: Zoltan Kochan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pacquet: exec bit not preserved when copy fallback is used on Linux (overlayfs)

3 participants