Skip to content

Allow subdirectory source paths in GraphML node labels#324

Closed
Titas-Ghosh wants to merge 1 commit intoControlCore-Project:devfrom
Titas-Ghosh:allow-subdir-node-sources
Closed

Allow subdirectory source paths in GraphML node labels#324
Titas-Ghosh wants to merge 1 commit intoControlCore-Project:devfrom
Titas-Ghosh:allow-subdir-node-sources

Conversation

@Titas-Ghosh
Copy link

Hi @pradeeban , This PR fixes #297

Summary

  • Accept safe relative subpaths (e.g., script.py).
  • Preserve security by rejecting traversal (..), absolute paths, and drive roots.
  • Ensure mkconcore creates required subdirectories for copies and generated artifacts.
  • Add CLI test coverage for subdirectory workflows.

Problem

mkconcore.py rejects / and \ in node labels, forcing a flat src/ layout. This makes real‑world workflows hard to organize.

Fix

  • Added safe_relpath() to allow relative subpaths and block unsafe paths.
  • Normalized node source paths during parsing.
  • Created parent directories before copying scripts and writing iport/oport/Dockerfiles.
  • Ensured build scripts create subdirectories inside node folders when needed.
  • Added test for concore run with script.py

Evidence

Screenshot of subdir run.

Screenshot 2026-02-15 005504

Checklist

  • Tested locally (python -m pytest -v)
  • Added regression test
  • No breaking CLI changes

@pradeeban
Copy link
Member

Can you pls recreate the PR with just the actual changes to the code? Maybe changes in the EOL character: somehow around 176 lines are changed while the actual changes are much smaller in scale. This is to keep the code easy to maintain (git blame, merge conflicts, etc).

@Titas-Ghosh
Copy link
Author

Can you pls recreate the PR with just the actual changes to the code? Maybe changes in the EOL character: somehow around 176 lines are changed while the actual changes are much smaller in scale. This is to keep the code easy to maintain (git blame, merge conflicts, etc).

Sorry about that, and thank you for calling it out @pradeeban ,you were right, the PR had extra EOL/formatting noise.
I recreated the PR #327 with only the actual functional changes for this fix, scoped to:
mkconcore.py
test_cli.py
Could you please take another look at the updated PR?

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.

2 participants