Comments (6)
We should fix this. Here's the reason:
pnpm/store/cafs/src/parseTarball.ts
Line 127 in 284eedb
Our in-house tarball extractor currently skips symlinks.
from pnpm.
This PR should fix it: #7705
from pnpm.
Thanks @bitofsky for look into it. We will for sure backport the fix to v8 too. We just need to cover it with a test. I don't want us to break it again in the future.
from pnpm.
No, actually it is a problem with side-effects cache. When we upload side-effects cache to the store, we don't upload symlinks correctly, I guess. I get the same issue with pnpm v8.6.12
from pnpm.
I assume this issue is the same as #7253
from pnpm.
@zkochan Hello? I have found an issue in cafs/src/addFilesFromDir.ts.
In version pnpm 8.6.12, symbolic links are recognized as files, but starting from version pnpm 8.7.0, symbolic links are not recognized as files anymore.
The changes between the two versions are as follows:
const files = await fs.readdir(currDir) // readdir returns an array of strings
await Promise.all(files.map(async (file) => {
...
const stat = await fs.stat(fullPath) // stat returns a Stats object
if (stat.isDirectory()) {
...
}
if (stat.isFile()) { // symbolic links are considered files
const files = fs.readdirSync(currDir, { withFileTypes: true }) // readdirSync returns an array of Dirent objects
for (const file of files) {
if (file.isDirectory()) {
...
}
if (file.isFile()) { // symbolic links are not considered files
...
}
Dirent objects and Stats objects return different results when the isFile() method is called on symbolic linked files.
While Dirent objects return false when the isFile() method is called on symbolic linked files, Stats objects return true.
10272392 -rw-rw-r-- 1 bitofsky bitofsky 2 Feb 23 16:06 origin.txt
10272393 lrwxrwxrwx 1 bitofsky bitofsky 10 Feb 23 16:09 link.txt -> origin.txt
> node
> require('fs').readdirSync('.', {withFileTypes:true}).find(f => f.name === 'link.txt').isFile() // readdirSync returns an array of Dirent objects
false
> require('fs').statSync('./link.txt').isFile() // statSync returns a Stats object
true
However, starting from [email protected], symbolic links are correctly recognized again.
The code checking for isFile() in the if condition has been removed and replaced with else.
const files = fs.readdirSync(dir, { withFileTypes: true })
for (const file of files) {
if (file.isDirectory()) {
...
} else { // symbolic links are considered files
...
}
I believe the code modified in version 9.0.0-alpha.5 should be reflected in the version 8 series as well, or the code after 8.7 should be modified as follows.
- } else if (file.isFile()) {
+ } else if (file.isFile() || file.isSymbolicLink()) {
Thank you.
from pnpm.
Related Issues (20)
- pnpm fails to exclude files matching negated glob patterns with multiple leading directories HOT 1
- Changing the lockfile format to reduce duplication HOT 7
- ERR_PNPM_NO_OFFLINE_TARBALL A package is missing from the store but cannot download it in offline mode. HOT 5
- Add option to install file: protocol dependencies using symlink HOT 3
- `pnpm install` breaks links created with `pnpm link` HOT 1
- pnpm install fails if node_modules directory is symlinked HOT 1
- Throw Error and Exit on Cyclic Workspace Dependencies
- pnpm outdated [-r] --json does not return all dependencies in workspace
- Wildcard for supportedArchitectures HOT 3
- TARBALL_EXTRACT error while installing a dependency from GitHub having a slash in branch name HOT 2
- Invalid relative dependency path error when installing a remote tarball
- Unable to set-up local development for pnpm `main` branch HOT 6
- `pnpm -r exec rm -rf node_modules` doesn't work HOT 2
- pnpm update -iL does not offer to update svelte 5@next HOT 2
- Only add `requiresBuild` to an entry in the lockfile if we know the package needs to be built from info in the package manifest
- Complete `pnpm init` command HOT 4
- save-workspace-protocol=false breaks prod deployment
- Getting `ERR_PNPM_HARDLINK_FAILED Error: EEXIST: file already exists, link` when pnpm install
- `pnpm list --recursive` should be sorted topologically
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pnpm.