Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

Is there a way to influence file and folder permissions in tmp directory while unzipping the FMU #67

Open
Er-Bj-Ze opened this issue Oct 25, 2022 · 3 comments

Comments

@Er-Bj-Ze
Copy link

Is there a way to influence file and folder permissions in tmp directory while unzipping the FMU as part of executing the FMUComplianceChecker?

In my case I try to run a FMU under Ubuntu 20.04 on PC, which contains several nested FMUs. These have several dependencies like shared object files or applications in addition. All mentioned dependencies are provided by the ressources folders and handled by the child FMUs themself so that no external content has to be requested.

Unfortunately I am missing some permissions inside the temporary directory for my ressources after executing the FMUComplianceChecker. To ensure that my FMU is working properly, I would have to provide write (-w) and/or execute (-x) permissions to several files and stored applications inside the tmp directory.

The only way to be not blocked at the moment is, to connect a debugger at the very beginning of the FMU execution, e.g. during call of fmi2GetTypesPlatform(), changing the file and directory permissions manually inside the tmp directory before resuming the FMU execution.

While using Windows, such issues are not visible and it seems to be most likely connected to LINUX specific permission handling.

Platform: PC Ubuntu 20.04
FMUComplianceChecker: FMUChecker-2.0.4-linux64.zip

@filip-stenstrom
Copy link
Collaborator

Perhaps one of these flags could help?

-t <tmp-dir>     Temporary dir to use for unpacking the FMU.
                 Default is to use system-wide directory, e.g., C:\Temp or /tmp.

-z <unzip-dir>   Do not create and remove a temp directory but instead use the
                 specified one for unpacking the FMU. The option takes
                 precendence over -t.

Otherwise, if the issue is with the nested FMUs I would guess it's the parent FMU that unpacks them and would be responsible for unpack location and file permissions?

@Er-Bj-Ze
Copy link
Author

Unfortunately the mentioned arguments does not help providing proper file permissions.

The child FMUs are part of the parent FMU's resources folder, and are not archived seperately in there. So the parent does not have to take care of unpacking them.


image

image

In comparison, MATLAB Simulink is able to import and execute the FMU without any issues. It seems, like there is a different way of unpacking the FMU used, because I can see that the initially given permissions from the FMU build are available inside the slprj folder.

@filip-stenstrom
Copy link
Collaborator

The issue is that file permissions are lost when unzipping. Unzipping is done via minizip's miniunz function. From what I can see there is no option for preserving file permissions.

I don't see any workaround right now.

For future: A way forward could be to upgrade to FMIL >= 2.3, and then in the call to fmi_import_get_fmi_version make sure that unpacked FMUs are accepted. Then another tool could be used for unzipping.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants