#6174 closed defect (fixed)
OMC loads the wrong package
Reported by: | massimo ceraolo | Owned by: | Adrian Pop |
---|---|---|---|
Priority: | blocker | Milestone: | 1.16.1 |
Component: | Interactive Environment | Version: | v1.16.0-dev |
Keywords: | Cc: | Martin Sjölund |
Description (last modified by )
The zip file MultifileIssue contains two multi-file packages: "Test_multifile" and "Test_multifile - Copia". The first contains a model named "test", the second contains a model named testNew"
Put the folders in the same disk area. e.g. c:\Work
Then, if we load package.mo from Test_multifile, OMEdit opens the package from "Test_multifile - Copia"!
This is probably due to spaces in names. Tested with Windows
Attachments (2)
Change History (13)
by , 4 years ago
Attachment: | MultifileIssue.zip added |
---|
comment:1 by , 4 years ago
Description: | modified (diff) |
---|---|
Summary: | Omedit loads the wrokng package → Omedit loads the wrong package |
comment:2 by , 4 years ago
Description: | modified (diff) |
---|
by , 4 years ago
Attachment: | MultifileIssueWithScript.zip added |
---|
comment:3 by , 4 years ago
Cc: | added |
---|---|
Component: | OMEdit → Interactive Environment |
Owner: | changed from | to
Status: | new → assigned |
comment:4 by , 4 years ago
I think this is the class loader implemented by @sjoelund.se but I will have a look.
comment:5 by , 4 years ago
ClassLoader.mo:149
(mp,name,isDir) := System.getLoadModelPath(id,prios,mps,requireExactVersion);
This one returns name="Test_multifile - Copia"
when called with:
System.getLoadModelPath("Test_multifile",{""},"path/to/test/",false);
comment:6 by , 4 years ago
Summary: | Omedit loads the wrong package → OMC loads the wrong package |
---|
comment:7 by , 4 years ago
The problem is that omc thinks that the part "- Copia" is the version number.
I guess this is the wrong code:
https://github.com/OpenModelica/OpenModelica/blob/master/OMCompiler/Compiler/runtime/systemimpl.c#L2180
if (version > 0 && !*versionExtra) {
as version is an array of long so the first condition will *always* true!
comment:8 by , 4 years ago
I guess in splitVersion we should init version array with -1
so that we know if the split worked or not. One can have version 0.0.1
so version[0] > 0
is not a good check.
I don't get the code too much so I will let @sjoelund.se fix it if he has time.
comment:9 by , 4 years ago
I'll fix this in https://github.com/OpenModelica/OpenModelica/pull/6930 but I will not add a testcase since it seemed random which one was used before.
comment:10 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Porting it to 1.16:
https://github.com/OpenModelica/OpenModelica/pull/6939
Simplified the provided test case and added a script to reproduce the issue.