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

FMUs with curly brackets in guid are failing #533

Closed
ljamt opened this issue Mar 3, 2020 · 2 comments
Closed

FMUs with curly brackets in guid are failing #533

ljamt opened this issue Mar 3, 2020 · 2 comments
Assignees
Labels
bug Something isn't working urgent blocking issue

Comments

@ljamt
Copy link
Member

ljamt commented Mar 3, 2020

Earlier we simply removed { and } from the FMU GUIDs, with PR 388 we now percent encode them. The problem occurs when the FMU tries to reach files in /resources and itself (or FMI library) also do percent encoding. Leading to the following:

Failed to open file .../Temp/cse_e7409bf5-94da-4771-8cac-26ff9a2c0d8e/%257B7041d910-6424-4284-89c5-5246b4b483c3%257D/resources/ MotorGenPackV3_MotorGenerator_CV_FMU3_info.json for reading: No such file or directory

Here the percent itself is encoded as the real path is
.../%7B7041d910-6424-4284-89c5-5246b4b483c3%7D/...

Not encoding the curly brackets is not a solution as the fmu tries to reach a path containing .../%7B7041d910-6424-4284-89c5-5246b4b483c3%7D/... which is not the same as .../{7041d910-6424-4284-89c5-5246b4b483c3}/...

I suggest that we go back to removing the curly brackets from the GUID when creating the directory.

Maybe an option could be to provide fmuResourceLocation instead of nullptr when we call fmi2_import_instantiate in fmu.cpp. FMI library sets a default for us (as already mentioned by @markaren here). Tested with providing the fmuResourceLocation, and reports failure on mismatching path due to percent encoding.

@ljamt ljamt added bug Something isn't working urgent blocking issue labels Mar 3, 2020
@ljamt
Copy link
Member Author

ljamt commented Mar 3, 2020

BTW, this is a blocker for the use cases.

@ljamt ljamt self-assigned this Mar 3, 2020
@kyllingstad
Copy link
Member

I would say that this is a bug in the FMU. The FMI standard clearly says that fmuResourceLocation must be interpreted as an RFC3986-compliant URI, which, among other things, includes percent encoding.

That said, I'm all for fixing this in the way you suggest, but mainly because I think the Microsoft-style GUID formatting {...} should be banished from the world of software forever and replaced everywhere with proper RFC4122-style formatting without the brackets. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working urgent blocking issue
Projects
None yet
Development

No branches or pull requests

2 participants