Repository navigation
fix: hardlink store files whose mode differs from the umask only in write bits - #16678
Conversation
…rite bits Since #15882 a store write takes group-write from the shard directory and never sets other-write, while the importer (pnpm/pnpm#15646) linked a store inode only if its mode was exactly what the current umask gives a fresh file. Under umask 000 with a 0777 store the entries are 0664/0775 and the umask asks for 0666/0755, so every file was copied. The same happens to executables in a 0775 store under umask 002. The hardlink tiers now ignore missing group- and other-write bits and an extra group-write bit. The shared inode already grants those through the store. Read, execute, owner and other-write bits must still match, so a store populated under umask 022 is still copied into an install under 077. The copy and clone tiers keep materializing at the umask's mode. Fixes #16677 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe Rust and pnpm 11 importers now permit specified store-file write-bit differences when checking hardlink eligibility. Tests cover permission mismatches and verify that installed files share inodes with store entries. ChangesStore hardlink eligibility
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Assessment against linked issues
Suggested labels: Merge Risk: ⚪ Minimal · up to The changed permission checks support hardlinking from writable stores without an identified permission regression. The PR is mergeable after normal checks. ✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16678 +/- ##
=======================================
Coverage 92.35% 92.36%
=======================================
Files 1591 1591
Lines 210207 210211 +4
=======================================
+ Hits 194145 194156 +11
+ Misses 16062 16055 -7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Micro-Benchmark ResultsLinux |
Same-run regression checkHEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval. Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.
Integrated-Benchmark Report (Linux)Commit: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked-workspace scenario compares current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.54291351804,
"stddev": 0.17421741974705407,
"median": 2.4544269409400004,
"user": 1.9656473399999996,
"system": 1.9229281199999995,
"min": 2.39730709494,
"max": 2.86577497594
},
{
"command": "pacquet@main",
"mean": 2.56847220804,
"stddev": 0.10066423224766345,
"median": 2.5378162489400005,
"user": 2.0081748399999997,
"system": 1.9987833199999998,
"min": 2.45437453694,
"max": 2.74607925694
},
{
"command": "pnpr@HEAD",
"mean": 1.43140251994,
"stddev": 0.04995666350064989,
"median": 1.42977279944,
"user": 1.7205237399999997,
"system": 1.6401546199999995,
"min": 1.3543615779400002,
"max": 1.5085712989400002
},
{
"command": "pnpr@main",
"mean": 1.54095702734,
"stddev": 0.10506681894668182,
"median": 1.5206502744400001,
"user": 1.6912185400000002,
"system": 1.66520512,
"min": 1.38811861794,
"max": 1.68086170694
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.35299491204,
"stddev": 0.04401619008461102,
"median": 0.34219613764,
"user": 0.42441611999999995,
"system": 0.8089231,
"min": 0.30079480214000004,
"max": 0.44165857514
},
{
"command": "pacquet@main",
"mean": 0.33675883204,
"stddev": 0.042795414559918504,
"median": 0.34053374664,
"user": 0.40332771999999995,
"system": 0.781026,
"min": 0.26118988314,
"max": 0.41421537214000004
},
{
"command": "pnpr@HEAD",
"mean": 0.35708751454,
"stddev": 0.02737596626429473,
"median": 0.35886951414,
"user": 0.4172145199999999,
"system": 0.7803673000000001,
"min": 0.30179112514,
"max": 0.38807916614000004
},
{
"command": "pnpr@main",
"mean": 0.32757435444000005,
"stddev": 0.015470271783486289,
"median": 0.32631590264000004,
"user": 0.38249711999999997,
"system": 0.7079614999999999,
"min": 0.30330645114000004,
"max": 0.35806247014000003
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.017114173026493505,
"stddev": 0.0027099592993879893,
"median": 0.01676058852,
"user": 0.010133109350649351,
"system": 0.008598195324675331,
"min": 0.012479055020000001,
"max": 0.02701623102
},
{
"command": "pacquet@main",
"mean": 0.016893545681111115,
"stddev": 0.0029101203141083266,
"median": 0.01685674852,
"user": 0.010044543333333327,
"system": 0.008477892999999995,
"min": 0.011004894020000001,
"max": 0.02865357802
},
{
"command": "pnpr@HEAD",
"mean": 0.018266975788707483,
"stddev": 0.0025596724483496042,
"median": 0.01818328802,
"user": 0.010101531428571427,
"system": 0.009804611836734695,
"min": 0.01269749302,
"max": 0.02643237802
},
{
"command": "pnpr@main",
"mean": 0.014310142540833327,
"stddev": 0.003118590248906625,
"median": 0.013639143020000001,
"user": 0.007340918333333333,
"system": 0.008352312638888883,
"min": 0.010653325020000002,
"max": 0.02945960802
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.013925427573793106,
"stddev": 0.0019432067683280059,
"median": 0.013631196160000001,
"user": 0.0076424193103448255,
"system": 0.007885406321839079,
"min": 0.00989962416,
"max": 0.01898859916
},
{
"command": "pacquet@main",
"mean": 0.013304844332839514,
"stddev": 0.0013993529541677537,
"median": 0.013234796160000001,
"user": 0.007779083209876546,
"system": 0.007049907654320987,
"min": 0.010211744160000001,
"max": 0.016783248160000003
},
{
"command": "pnpr@HEAD",
"mean": 0.012685755336795577,
"stddev": 0.001746204173371218,
"median": 0.01246549616,
"user": 0.007108625635359113,
"system": 0.006985224530386737,
"min": 0.00903862416,
"max": 0.01916203916
},
{
"command": "pnpr@main",
"mean": 0.014336889370526313,
"stddev": 0.0017666780914988144,
"median": 0.014228381160000001,
"user": 0.00782740842105263,
"system": 0.008075217789473689,
"min": 0.00977951416,
"max": 0.021363660160000002
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.21421756398,
"stddev": 0.1366983598432672,
"median": 3.18231046888,
"user": 3.96356232,
"system": 2.95590068,
"min": 3.05421442738,
"max": 3.43552102638
},
{
"command": "pacquet@main",
"mean": 3.03063791598,
"stddev": 0.04778335537495358,
"median": 3.0308236518799996,
"user": 3.5500247199999997,
"system": 2.80183228,
"min": 2.93899438638,
"max": 3.09752253338
},
{
"command": "pnpr@HEAD",
"mean": 1.76612456398,
"stddev": 0.10132053378088728,
"median": 1.7148272353800003,
"user": 2.22141212,
"system": 2.1378613799999995,
"min": 1.6650825323800003,
"max": 1.96475570838
},
{
"command": "pnpr@main",
"mean": 1.7444604256800003,
"stddev": 0.08943641003497743,
"median": 1.74425964388,
"user": 2.29868732,
"system": 2.1007819800000003,
"min": 1.6330849533800003,
"max": 1.87689356238
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.5839188430000001,
"stddev": 0.11561869484153099,
"median": 0.5376438744,
"user": 0.80835472,
"system": 0.8806220999999999,
"min": 0.4942116134000001,
"max": 0.8303712234
},
{
"command": "pacquet@main",
"mean": 1.0516578705000001,
"stddev": 0.20152728193145195,
"median": 1.0418701819,
"user": 1.3494051200000001,
"system": 1.2948193,
"min": 0.7119988694,
"max": 1.3384666433999999
},
{
"command": "pnpr@HEAD",
"mean": 0.5562416237999999,
"stddev": 0.06719484040592406,
"median": 0.5426724689,
"user": 0.54880292,
"system": 0.8909059999999999,
"min": 0.44163084340000003,
"max": 0.6582049894
},
{
"command": "pnpr@main",
"mean": 0.536616911,
"stddev": 0.04441516939970525,
"median": 0.5410777989,
"user": 0.50017432,
"system": 0.8785971,
"min": 0.4421281074,
"max": 0.6010795034
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.7690654962999997,
"stddev": 0.054477978230148105,
"median": 1.7657891938999999,
"user": 1.2107857599999996,
"system": 1.0251091799999998,
"min": 1.7059366714000002,
"max": 1.8875329364
},
{
"command": "pacquet@main",
"mean": 1.7990816331000001,
"stddev": 0.07142574146884387,
"median": 1.7843529624,
"user": 1.2652577599999997,
"system": 1.0624649800000001,
"min": 1.6985601194,
"max": 1.9441689784
},
{
"command": "pnpr@HEAD",
"mean": 0.33061945820000005,
"stddev": 0.016112072846613163,
"median": 0.3296161139,
"user": 0.30754856,
"system": 0.6534470800000001,
"min": 0.3007582184,
"max": 0.3536413654
},
{
"command": "pnpr@main",
"mean": 0.39364947620000007,
"stddev": 0.05136003630662147,
"median": 0.3911331899,
"user": 0.37772716,
"system": 0.75647038,
"min": 0.3326502644,
"max": 0.4971408104
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.31700348966,
"stddev": 0.026375708732749803,
"median": 0.32289281306,
"user": 0.31960822,
"system": 0.13504091999999998,
"min": 0.27565816906,
"max": 0.34838277206
},
{
"command": "pacquet@main",
"mean": 0.32718929166000005,
"stddev": 0.014513374691795942,
"median": 0.32347522706,
"user": 0.33711112,
"system": 0.14104002,
"min": 0.30820739506,
"max": 0.35233944006
},
{
"command": "pnpr@HEAD",
"mean": 0.11208326165259258,
"stddev": 0.005078731778496654,
"median": 0.11125816506,
"user": 0.051727349629629625,
"system": 0.023618379259259255,
"min": 0.10410226706,
"max": 0.12266938306
},
{
"command": "pnpr@main",
"mean": 0.10656878380074072,
"stddev": 0.00555494914173323,
"median": 0.10651434006,
"user": 0.04546531259259258,
"system": 0.022958971851851844,
"min": 0.09557257106,
"max": 0.11958040206000001
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.27825129760444445,
"stddev": 0.017180931094773463,
"median": 0.27592497816,
"user": 0.2981484022222222,
"system": 0.07391413333333333,
"min": 0.25266716216,
"max": 0.30569802516
},
{
"command": "pacquet@main",
"mean": 0.2678543049377778,
"stddev": 0.03173714863246054,
"median": 0.25218762316000004,
"user": 0.28127273555555554,
"system": 0.06379546666666666,
"min": 0.23041181416,
"max": 0.33140162616
},
{
"command": "pnpm@HEAD",
"mean": 4.647717805715556,
"stddev": 0.3979517657274687,
"median": 4.549352622160001,
"user": 7.506138735555556,
"system": 0.4526606888888888,
"min": 4.23130857916,
"max": 5.446565538160001
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.29402889356,
"stddev": 0.0312373390397292,
"median": 0.29608841646,
"user": 0.24749791999999998,
"system": 0.10892945999999999,
"min": 0.24610711796000004,
"max": 0.33528617096
},
{
"command": "pacquet@main",
"mean": 0.29834205276000003,
"stddev": 0.030693707427244907,
"median": 0.29719001996000005,
"user": 0.24088491999999997,
"system": 0.12017285999999998,
"min": 0.25315586996,
"max": 0.34826667196
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 5.014367461699999,
"stddev": 0.4675337050768796,
"median": 4.9160053137999995,
"user": 2.26832048,
"system": 2.0945902199999997,
"min": 4.4608742283,
"max": 6.086691174299999
},
{
"command": "pacquet@main",
"mean": 4.4817917387,
"stddev": 0.11677426582394117,
"median": 4.4313725163,
"user": 1.6058864799999994,
"system": 1.49396132,
"min": 4.3614837213,
"max": 4.6631922283
},
{
"command": "pnpr@HEAD",
"mean": 3.6990501191000007,
"stddev": 0.16181388595841462,
"median": 3.6814424908000003,
"user": 1.76283658,
"system": 1.6887371199999996,
"min": 3.4746964813,
"max": 3.9648128103
},
{
"command": "pnpr@main",
"mean": 3.6015567896,
"stddev": 0.07932450847200109,
"median": 3.6045360403,
"user": 1.7624789799999998,
"system": 1.53601902,
"min": 3.4997623043000003,
"max": 3.7186461573000003
}
]
}Scenario: GVS linker: fresh restore, hot cache + hot storeSame install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.22947147844363636,
"stddev": 0.012370950920467461,
"median": 0.22931846908,
"user": 0.27692881999999996,
"system": 0.20088119636363636,
"min": 0.20911959408,
"max": 0.25145397908000006
},
{
"command": "pacquet@main",
"mean": 0.23797715798000002,
"stddev": 0.01730785947825281,
"median": 0.24008924458,
"user": 0.28787602,
"system": 0.19506996000000001,
"min": 0.20540119008000002,
"max": 0.26223237008000005
},
{
"command": "pnpr@HEAD",
"mean": 0.2868678901800001,
"stddev": 0.02018893929485055,
"median": 0.29004465658,
"user": 0.32477181999999993,
"system": 0.19986025999999996,
"min": 0.25853460708000003,
"max": 0.31445126808000007
},
{
"command": "pnpr@main",
"mean": 0.27702241248000004,
"stddev": 0.020557769567444487,
"median": 0.28128662758,
"user": 0.32296402,
"system": 0.17328046,
"min": 0.24114375708000002,
"max": 0.30089093308000003
}
]
} |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
PR Summary by QodoRestore hardlinks for store files with compatible write-bit differences
AI Description
Diagram
High-Level Assessment
Files changed (8)
|
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Replies to the Qodo review of 40468fb:
Written by an agent (Claude Code, claude-opus-5-5). |
|
Code review by qodo was updated up to the latest commit 5159d8d |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Summary
Closes #16677.
Since #15882, a store write takes group-write from the shard directory and never sets other-write. The importer (pnpm/pnpm#15646) still hardlinks a store inode only if its mode is exactly what the current umask gives a fresh file. In the reported setup (umask
000,0777store), store entries are0664/0775but the umask asks for0666/0755, so every file was copied. Installs were about 30% slower. Executables in a0775store under umask002hit the same mismatch.The hardlink tiers now ignore group-write and other-write when the store inode is missing them, and an extra group-write bit. The shared inode already grants those bits through the store. Read, execute, owner, and extra other-write bits must still match, so the #3807 case (a store populated under
022, installed under077) still copies. The copy and clone tiers still materialize at the umask's mode.Both CLIs had the bug and both are fixed:
pnpm_fs::file_mode::store_inode_mode_is_linkable, used bysource_has_desired_mode.isLinkableStoreModein@pnpm/fs.indexed-pkg-importer.Tests (the new ones fail with the exact-match check restored):
umask::installs_hardlink_from_a_world_writable_store_under_umask_000: the issue's scenario, end to end.inherited_file_modedirectory/umask combination it should accept, plus the differences it must still reject) and for the hardlink tier in both stacks.Squash Commit Body
Checklist
already linked to it solves it.
are implemented in every affected version.
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
🤖 Generated with Claude Code
Written by an agent (Claude Code, claude-opus-5-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
pnpm installcan hardlink files from group-writable or world-writable stores when their permissions are otherwise compatible with the installed files. Previously, these files could be copied intonode_modulesinstead.