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

BUG: ParserCache cant flush wrongly cased includes (on case-insensitive fs) #4841

Closed
mhsdesign opened this issue Jan 18, 2024 · 2 comments
Closed

Comments

@mhsdesign
Copy link
Member

mhsdesign commented Jan 18, 2024

Related: #4415

I just remembered that paths are case insensitive on unix. Edit: on Windows and macOS.

And this is currently not being taken into consideration when flushing the fusion parse partials cache. Because my assumption of realpath was wrong.

This results in the parser cache not being flushed and changes not being reflected in dev mode.

This case is easily reproducible via:

Root.fusion

# we use lower case here to reproduce this:
include: myfusionfile.fusion

debug = Neos.Fusion:Join {
    a = "Root was included"
}

root >
root = Neos.Fusion:Renderer {
    renderPath = "/debug"
}

MyFusionFile.fusion

debug {
    b = "MyFusionFile.fusion was included"
}

Renders to

MyFusionFile.fusion was included
Root was included

but when updating MyFusionFile.fusion no changes are reflected.

MyFusionFile.fusion

debug {
    b = "MyFusionFile.fusion was included - i was updated"
}

Still renders the same output as above.


The reason for that is that the cache is flushed with the file system monitor which provides the path in "correct" casing.

FLOW_ROOT_PATH/Packages/My.Package/Resources/Private/Fusion/MyFusionFile.fusion

But while resolving the include via the FilePatternResolver the incorrect casing is used:

resource://My.Package/Private/Fusion/myfusionfile.fusion

This resource path will eventually be resolved manually into an absolute path (link) and to get a comparable path we use realpath.
But realpath doesnt actually return the correct casing 🤯

For case-insensitive filesystems realpath() may or may not normalize the character case.

That means realpath is of no use to us and it seems we have to use consistently strtolower on case-insensitive fs to correctly flush the cache. This is doable but would require a manual flow cache:flushone Neos_Fusion_ParsePartials as the current cache entries become obsolete after update. -> This is hardly doable.


Also we have to bear in mind that fusion file includes would behaving different on other platforms and thus packages might not work on case sensitive windows. So maybe we should only allow correctly cased imports, if possible?

@kdambekalns
Copy link
Member

I just remembered that paths are case insensitive on unix

No, usually they are case-sensitive, unlike on Windows and macOS (be default). But that might have been just a typo?

@mhsdesign mhsdesign changed the title BUG: ParserCache cant flush wrongly cased includes BUG: ParserCache cant flush wrongly cased includes (on case-insensitive fs) Jan 18, 2024
@mhsdesign
Copy link
Member Author

mhsdesign commented Jan 18, 2024

Ah well i mixed things up. I though my mac behaved like a unix 🤯 but not the APFS it seems ^^

So i tested this also on the default mac fs, thats how i came to the wrong conclusion.

As discussed with @kitsunet https://neos-project.slack.com/archives/C04PYL8H3/p1705570111490639 the dev is expected to either use a case sensitive fs to not make any errors, or not make any errors.

@mhsdesign mhsdesign closed this as not planned Won't fix, can't repro, duplicate, stale Feb 3, 2024
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

No branches or pull requests

2 participants