Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#5871 closed defect (fixed)

OMEdit changes extensions of package.mo files when top-level package is modified

Reported by: Andrea Bartolini Owned by: Adeel Asghar
Priority: blocker Milestone: 1.16.0
Component: OMEdit Version: v1.16.0-dev
Keywords: Cc: Francesco Casella, Adrian Pop

Description (last modified by Andrea Bartolini)

Hi Adeel, here the steps to reproduce the issue:

1) unzip and open in OMEdit the attached Test example, files and directories structure on disk appears as shown in attached before.png file.

2) open the top-level package Test and switch to the text view

3) add a comment below the // test line

4) save the package:

  • the top-level package.order file is empty
  • the sub-packages pack2.mo and package.mo files are renamed in pack2.bak-mo and package.bak-mo (as shown in attached after.png file)

It seems (but I'm not sure) that the issue is related to the fact that both sub-package in a single file (pack2.mo) and sub-package in sub-directory (pack1) are present at the same time...

OMEdit - OpenModelica Connection Editor
Connected to OpenModelica 1.16.0~dev-208-gb567bd2
Sysop Linux Ubuntu 18.04

Kind regards,
Andrea

Attachments (4)

Test.zip (1.2 KB ) - added by Andrea Bartolini 5 years ago.
before.png (6.7 KB ) - added by Andrea Bartolini 5 years ago.
after.png (6.6 KB ) - added by Andrea Bartolini 5 years ago.
script.mos (377 bytes ) - added by Adeel Asghar 5 years ago.
Unzip the Test.zip attachment and copy this script inside Test directory

Download all attachments as: .zip

Change History (15)

by Andrea Bartolini, 5 years ago

Attachment: Test.zip added

by Andrea Bartolini, 5 years ago

Attachment: before.png added

by Andrea Bartolini, 5 years ago

Attachment: after.png added

comment:1 by Andrea Bartolini, 5 years ago

Description: modified (diff)

comment:2 by Francesco Casella, 5 years ago

Milestone: 1.16.01.15.0

@adease31, @adrpo, I guess that's exactly what my other colleague Alberto Leva experienced. The bak files were not backups of deleted stuff, they were just the .mo files renamed. He even made a script to rename them back to .mo files and carry on.

If I am not mistaken, the log file only contains "getXXX" API function calls. It is really weird that such an effect on the file system is produced.

@adeas31, I think this should be fixed with top priority and back-ported to 1.15.0 as well.

Thanks!

by Adeel Asghar, 5 years ago

Attachment: script.mos added

Unzip the Test.zip attachment and copy this script inside Test directory

comment:3 by Adeel Asghar, 5 years ago

The problem seems to be with loadString API. It has the option to merge or replace the AST. In our case it is replacing the AST even though the merge flag is set.

I put up the small script to show the problem. Unzip the Test.zip attachment, copy this script inside Test directory and run it.

comment:4 by Andrea Bartolini, 5 years ago

Hi Adeel,
in the following the results from the script:

Notebook:~/Desktop/Test$ omc script.mos 
true
""
{Test}
""
{pack1,pack2}
""
"/home/andrea/Desktop/Test/package.mo"
true
""
{}
""
{Test}
""
Notebook:~/Desktop/Test$ 

comment:5 by Andrea Bartolini, 5 years ago

I'm running:
OpenModelica 1.16.0~dev-221-g5369161

comment:6 by Adeel Asghar, 5 years ago

Yes that is correct. Note that getClassNames(Test) returns empty list that is why OMEdit thinks that Test.pack1 and Test.pack2 are deleted.

comment:7 by Adeel Asghar, 5 years ago

Cc: Adrian Pop added

comment:8 by Adrian Pop, 5 years ago

Should be fixed with PR: https://github.com/OpenModelica/OpenModelica/pull/763.
Check and close ticket if it works fine.

comment:9 by Andrea Bartolini, 5 years ago

Resolution: fixed
Status: newclosed

Tested with:
OpenModelica 1.16.0~dev-227-g491c0c8
running on Ubuntu 18.04

it works fine.

Thanks :)

comment:10 by Adeel Asghar, 5 years ago

Back-ported the fix to 1.15.0

comment:11 by Francesco Casella, 4 years ago

Milestone: 1.15.01.16.0

Release 1.15.0 was scrapped, because replaceable support eventually turned out to be more easily implemented in 1.16.0. Hence, all 1.15.0 tickets are rescheduled to 1.16.0

Note: See TracTickets for help on using tickets.