Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: 4915 fusion ParsePartials cache not flushed for symlinked packages #4916

Conversation

mhsdesign
Copy link
Member

Resolves #4915
By reverting fix #4838
Which will lead to the original problem to resurface #4415 (but silently this time, no one will notice the cache flodding :D)

Upgrade instructions

Review instructions

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked with !!! and have upgrade-instructions

@mhsdesign
Copy link
Member Author

After discussing this extensively with @kitsunet (thanks 🙏 ) we are sure that this is the right direction for now.

The challenges were mainly that the PARSE_PARTIAL cache is written by fusion, but fusion only "knows" a file by its include path, which might contain directory traversal /../. To normalize that we use real_path when writing the file wich will not only cleanup directory traversal but also resolve symlinks. Normally both Flow0PackageInterface::getResourcesPath and the file monitor operate on the symlinks. Even composers installed.php internally uses the symlinks directly. But due to this one resolve, we have to resolve everywhere. Resolving the symlink for the deleted files is not possible, thus we skip.
Technically flow could operate on the realpaths directly in detectChangesOnPath but using realpath on such a fundamental framework level could be uncool as it requires more rights and see neos/flow-development-collection#2491. In our case realpath is fine as its only for dev mode and also specific for fusion and well tested since Neos 8.0.

// should not happen as we ignored deleted files beforehand.
throw new \RuntimeException("Couldn't resolve realpath for: '$changedFile'", 1709122619);
}
$identifiersToFlush[] = $this->getCacheIdentifierForAbsoluteUnixStyleFilePathWithoutDirectoryTraversal($fusionFileRealPath);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before #4838 the realpath call would always happen inside this ParserCacheIdentifierTrait method. The "revert" ist that we call realpath again, but explicitly above, so its more obvious who and what and why.

Copy link
Member

@jonnitto jonnitto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on a local project

@jonnitto jonnitto merged commit d1d8d96 into neos:8.0 Mar 1, 2024
7 checks passed
@mhsdesign mhsdesign deleted the bugfix/4915-fusion-ParsePartials-cache-not-flushed-for-symlinked-packages branch March 1, 2024 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants