modelica-tools / FMUComplianceChecker

FMI Compliance Checker for validation of FMUs 1.0 and 2.0
BSD 3-Clause "New" or "Revised" License
42 stars 31 forks source link

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

Open Er-Bj-Ze opened 1 year ago

Er-Bj-Ze commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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.