Repository navigation
fix: reject two source files that share a name (port files collide) - #726
Open
SahilKumar965 wants to merge 1 commit into
Open
SahilKumar965 wants to merge 1 commit into
SahilKumar965 wants to merge 1 commit into
Conversation
mkconcore names port files, Dockerfiles and docker images after the source stem, so CZ:controller.py and PZ:controller.m both write src/controller.iport and one node silently gets the other's ports. validate and mkconcore now reject different sources with the same stem (case-insensitive). One source shared by several nodes still works. add-node and the init wizard pick a free stem instead of script.py + script.m.
|
🎉 Welcome aboard, @SahilKumar965! Thank you for your first pull request in concore. Please ensure that you are contributing to the dev branch. Your contribution means a lot to us. We'll review it shortly. Please ensure you have reviewed our: If you have any questions, feel free to ask. Happy coding! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mkconcore names each node's port files after its source file stem (
mkconcore.py:837), soCZ:controller.pyandPZ:controller.mboth writesrc/controller.iport/.oport. The second write wins and both nodes copy the same file, so the controller silently gets the plant's ports.concore validatesaid the workflow was valid and the build succeeded. Dockerfiles, docker build folders and image names use the same stem, so docker builds clash too.concore add-nodemade this easy to hit:concore init+add-node --lang octavegavescript.py+script.m.Repro (before this PR):
After: validate fails with
Source files share the name 'controller': controller.m, controller.py (rename one of them)and mkconcore exits with the same message.Change
validateandmkconcorereject two different source files with the same stem. The check is case-insensitive, sincescript.iportandScript.iportare one file on Windows/macOS.demo/gencon2.graphml,PZ:pm.py+PS:pm.py) is still accepted.add-nodeand theinit -iwizard now pick a free stem (script.py,script2.m,Script3.java). The helper lives ininit.pyand replacesadd_node._pick_filename, and the Java class is still renamed to match the file.Tests
test_duplicate_container_names.py: reject same stem (validate + mkconcore), reject stems that differ only in case, accept one source shared by two nodes.test_add_node_command.py: updated the two tests that expectedscript.cpp/Script.javanext toscript.py; added a wizard test (python + octave + java) and made the "still validates" test add an octave node.Notes
concore initproject, the first added C++/Octave/Java node is nowscript2.cpp/script2.m/Script2.java.concore.iport['NAME']would see the other node's names (the demos read ports by number, so they work). Fixing that means naming port files per node, which touches the generated scripts and docker images. I can do it as a follow-up if you'd like that approach.