Repository navigation
fix(pacquet): preserve exec bit on copy fallback - #12385
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (2)pacquet/**/Cargo.toml📄 CodeRabbit inference engine (pacquet/AGENTS.md)
Files:
pacquet/**/*.rs📄 CodeRabbit inference engine (pacquet/AGENTS.md)
Files:
🧠 Learnings (6)📚 Learning: 2026-05-20T19:40:55.051ZApplied to files:
📚 Learning: 2026-05-22T00:08:44.646ZApplied to files:
📚 Learning: 2026-05-20T23:07:58.444ZApplied to files:
📚 Learning: 2026-06-06T18:58:37.156ZApplied to files:
📚 Learning: 2026-06-12T20:41:57.558ZApplied to files:
📚 Learning: 2026-06-12T07:04:03.703ZApplied to files:
🔇 Additional comments (6)
📝 WalkthroughWalkthroughThis PR fixes an issue where executable bits are not preserved when pacquet falls back from hardlink to copy on overlayfs. It introduces a shared ChangesExecutable bit preservation on copy fallback
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
PR Summary by QodoFix pacquet copy fallback to preserve exec bit for CAS "-exec" entries WalkthroughsDescription• 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. Diagramgraph 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
High-Level AssessmentThe following are alternative approaches to this PR: 1. Re-stat source and copy full mode for every copied file
2. Store executability as explicit metadata alongside CAS entries
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. File ChangesBug fix (2)
Refactor (1)
Tests (2)
Other (1)
|
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
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
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
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
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
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
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
]
}
]
} |
|
| Branch | pr/12385 |
| Testbed | pacquet |
Click to view all benchmark results
| Benchmark | Latency | Benchmark 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%) |
|
| Branch | pr/12385 |
| Testbed | pnpr |
⚠️ 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-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 2,152.50 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 637.13 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 657.89 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,087.21 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 683.74 ms |
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]>
Summary
Fixes #12171.
pacquet stores executable CAFS entries under paths ending in
-exec, but the copy fallback tier inlink_file.rsmaterialized them without the executable bit. When hardlink/reflink isn't available and the install falls back tofs::copy(e.g. overlayfs on CI), a native binary such as@esbuild/linux-x64/bin/esbuildlands at0o644and fails to spawn withEACCES.This routes all copy-tier imports through one
copy_filehelper. On Unix, when the CAS source path ends with-exec, it OR-s the exec bits onto the copied file, mirroringgit-fetcher's existingmaterialize_into. Non-executable files are left exactly asfs::copyproduced 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 (
-execsuffix), so it never widens a restrictive mode (e.g.0o600→0o711) and adds noset_permissionssyscall on the non-exec majority. Rather than duplicate that logic, the-execcheck now lives in a sharedpacquet_fs::file_mode::cas_path_is_executablethat both copy paths call, replacing the private copy incas_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