Skip to content

fix(fslib): invalidate stale archive mounts - #7244

Open
cyphercodes wants to merge 1 commit into
yarnpkg:masterfrom
cyphercodes:fix-libzip-directory-reopen-7241
Open

fix(fslib): invalidate stale archive mounts#7244
cyphercodes wants to merge 1 commit into
yarnpkg:masterfrom
cyphercodes:fix-libzip-directory-reopen-7241

Conversation

@cyphercodes

Copy link
Copy Markdown
Contributor

What's the problem this PR addresses?

Fixes #7241.

MountFS could keep treating a path as an archive after the archive file had been replaced by a directory at the same path. Follow-up reads below that path then tried to reopen the directory as a zip archive and threw EISDIR instead of falling back to the base filesystem.

How did you fix it?

findMount now revalidates cached mount paths against the configured typeCheck. If a cached archive path no longer has the expected type, the stale cached mount is discarded and the path is remembered as a non-mount so the base filesystem handles it.

I also added a regression test that first reads from a custom-extension archive, then replaces that archive path with a directory and reads the directory file through the same ZipOpenFS instance.

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

Tests:

yarn version check
yarn jest packages/yarnpkg-libzip/tests/ZipOpenFS.test.ts --runInBand
yarn test:lint packages/yarnpkg-fslib/sources/MountFS.ts packages/yarnpkg-libzip/tests/ZipOpenFS.test.ts
yarn typecheck:all
git diff --check

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.

[Bug?]: EISDIR when reading from a directory that has the same path as a previously existing zip file

1 participant