Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in fidl import #11

Closed
wants to merge 3 commits into from
Closed

Conversation

jb090979
Copy link

@jb090979 jb090979 commented Apr 13, 2017

This request only adds a unittest to show a problem with the import feature of pyfranca. See #10

The Problem occur if an importet fidl also import another fidl file. In my example the fidl hierarchy lookls like:
P.fidl --> Type1.fidl --> Common.fidl
--> Type2.fidl --> Common.fidl

The problem is located in method import_package() in franca_processor.
When merging the imported packages only interafces and typecollections are copied. Not the imports. Later in import_package the instuction "package = self.packages[package.name]" overwrites the imported package and the imports get lost.

I try to fix the problem. I add th copy instruction for the imports to iadd in ast.py. This helps and my test fidl are imported correctly. But ther is stille another problem. Method import_package() is calling itself.

I add a print message to display all importetd fidl files. In my examples with unmodifed bevavior it looks like:
Import File: E:\project\pyfranca\pyfranca\pyfranca\tests\fidl\ImportChain\P.fidl
Import File: Type1.fidl
Import File: Type1.fidl
Import File: Type2.fidl
Import File: Type1.fidl
Import File: Type2.fidl
Import File: common.fidl
Import File: Type1.fidl
Import File: Type2.fidl
Import File: common.fidl
Import File: common.fidl
Import File: common.fidl
Import File: common.fidl
Import File: common.fidl
Import File: Type2.fidl
Import File: common.fidl
Import File: common.fidl

You see the fidls files are imported multiple times. To fix this behavior I try to remove instruction "package = self.packages[package.name]"

This result in the correct import order:
Import File: E:\project\pyfranca\pyfranca\pyfranca\tests\fidl\ImportChain\P.fidl
Import File: Type1.fidl
Import File: common.fidl
Import File: Type2.fidl
Import File: common.fidl

But I am not sure that with my changes method _update_package_references() ist still working correctly.
Please could you verify that the unittest show realy a problem?

This is a tricky issue. I hope my analysis helps you to understand the problem.

- annotate code to show possible root cause
@jb090979 jb090979 mentioned this pull request Apr 13, 2017
@zayfod
Copy link
Owner

zayfod commented Sep 26, 2017

Thanks for your work.

Is this the intended resolution? Is this the same code as your branch?

@jb090979
Copy link
Author

no not. I create a new pull request based on my latest changes. I cancle this request

@jb090979 jb090979 closed this Sep 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants