Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#6229 closed defect (invalid)

Package unloaded for unknown reasons

Reported by: massimo ceraolo Owned by: Adeel Asghar
Priority: low Milestone: 1.17.0
Component: OMEdit Version: v1.17.0-dev
Keywords: Cc:

Description

I've created the package Demo2P_modelica using Dymola.
OMEdit cannot load it "for unknown reasons"

Attachments (1)

Demo2P_modelica.zip (13.2 KB ) - added by massimo ceraolo 4 years ago.

Download all attachments as: .zip

Change History (13)

by massimo ceraolo, 4 years ago

Attachment: Demo2P_modelica.zip added

comment:1 by Adrian Pop, 4 years ago

I get this:

[3] 23:22:59 Grammar Warning
[C:/Users/adrpo33/Downloads//Demo2P_modelica/StochasticFlows/Support/package.order: 0:0-0:0]: The package.order file does not list all .mo files and directories (containing package.mo) present in its directory.
Missing names are:
        randomCar

[4] 23:22:59 Scripting Warning
[C:/Users/adrpo33/Downloads/Demo2P_modelica/StochasticFlows/Support/randomCar.mo: 2:1-79:14]: Expected the package to have name randomCar, but got RandomCar. Proceeding since only the case of the names are different.

If I rename Demo2P_modelica/StochasticFlows/Support/randomCar.mo to Demo2P_modelica/StochasticFlows/Support/RandomCar.mo everything loads fine.

comment:2 by Francesco Casella, 4 years ago

@adrpo, technically speaking OMC behaves correctly according to the specification.

However, the Windows files system is (alas) not case-sensitive. Should OMC be more relaxed and accept the file name even if the caps are not the same? Note that in Windows it will anyway be impossible to have randomCar.mo and RandomCar.mo in the same directory.

comment:3 by massimo ceraolo, 4 years ago

Priority: highlow

Ok, it is more a Dymola's than an omc issue.

I met a similar problem in the past, But in this case I did not check this.
At least the priority of this ticket must be lowered.
Feel free to close it if you prefer.

comment:4 by Adrian Pop, 4 years ago

I would not change the behavior. Trying the same library in Linux or Mac will fail. Also if you use versioning systems is always a mess if you need to rename case of files.

comment:5 by massimo ceraolo, 4 years ago

Resolution: invalid
Status: newclosed

Also the warning was very clear: it is my fault not having read it better. I'm going to close this ticket.

in reply to:  4 ; comment:6 by Francesco Casella, 4 years ago

Replying to adrpo:

I would not change the behavior. Trying the same library in Linux or Mac will fail.

That's right.

Also if you use versioning systems is always a mess if you need to rename case of files.

Yup.

Time to open a ticket at Dassault :)

comment:7 by Martin Sjölund, 4 years ago

However, the Windows files system is (alas) not case-sensitive. Should OMC be more relaxed and accept the file name even if the caps are not the same? Note that in Windows it will anyway be impossible to have randomCar.mo and RandomCar.mo in the same directory.

I thought this is what we do. It's only a warning, right? The current code as far as I remember gives an error if a filename is totally incorrect, but a warning if we find a file with the wrong case (and then loads that as if the case was correct).

It even says

Proceeding since only the case of the names are different.

comment:8 by Adrian Pop, 4 years ago

Yes, but then it fails to load. The full log is this:

[3] 12:58:16 Grammar Warning
[C:/Users/adrpo33/Downloads//Demo2P_modelica/StochasticFlows/Support/package.order: 0:0-0:0]: The package.order file does not list all .mo files and directories (containing package.mo) present in its directory.
Missing names are:
        randomCar

[4] 12:58:16 Scripting Warning
[C:/Users/adrpo33/Downloads/Demo2P_modelica/StochasticFlows/Support/randomCar.mo: 2:1-79:14]: Expected the package to have name randomCar, but got RandomCar. Proceeding since only the case of the names are different.

[5] 12:58:16 Translation Error
[C:/home/adrpo33/dev/OpenModelica/OMCompiler/Compiler/FrontEnd/ClassLoader.mo: 302:9-302:128]: Internal error loadCompletePackageFromMp failed for unknown reason: mp=C:/Users/adrpo33/Downloads//Demo2P_modelica/StochasticFlows pack=Support

[6] 12:58:16 Scripting Error
Failed to load package Demo2P_modelica () using MODELICAPATH C:/Users/adrpo33/Downloads/.

in reply to:  6 ; comment:9 by massimo ceraolo, 4 years ago

Time to open a ticket at Dassault :)

We should, indeed.
During package evolution I found that randomCar was lowercase, while I prefer class names starting with uppercase letter. I renamed it, but Dymola "forgot" to rename the mo file as well

in reply to:  9 comment:10 by Francesco Casella, 4 years ago

Replying to ceraolo:

During package evolution I found that randomCar was lowercase, while I prefer class names starting with uppercase letter. I renamed it, but Dymola "forgot" to rename the mo file as well

Blame Microsoft, not Dassault. Try to rename a file with something that is equivalent save for upper/lower case, Windows will ignore the rename command, because it is somewhat case-insensitive, due to backwards compatibility with the old days, when filenames were all caps. Like, in the '80s.

You should delete the file first, and then re-create it with the new, correct name.

comment:11 by Adrian Pop, 4 years ago

That was the case in the past, now it seems to work fine. I tried on randomCar.mo in Windows 10 Explorer, press F2 to edit the file, change the case of the first char, works fine.

comment:12 by Francesco Casella, 4 years ago

Yes, but try to use the rename command from the command line.

Note: See TracTickets for help on using tickets.