Skip to content

Fix bugs in possible policy-set path detection in cfbs-analyze#267

Merged
jakub-nt merged 3 commits into
cfengine:masterfrom
jakub-nt:analyze-possible-policyset-paths-fix
Aug 12, 2025
Merged

Fix bugs in possible policy-set path detection in cfbs-analyze#267
jakub-nt merged 3 commits into
cfengine:masterfrom
jakub-nt:analyze-possible-policyset-paths-fix

Conversation

@jakub-nt

@jakub-nt jakub-nt commented Aug 7, 2025

Copy link
Copy Markdown
Contributor

No description provided.

Hiding the static dictionary or list used as a default function argument behind a `None` is not sufficient, as dictionary and list assignment in Python only assigns the reference, rather than cloning the contents.

Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
…files; changed the error message to suggest real paths instead of (incorrectly) MPF-normalized paths

Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
@jakub-nt jakub-nt requested review from larsewi and olehermanse August 7, 2025 21:22
@jakub-nt jakub-nt force-pushed the analyze-possible-policyset-paths-fix branch 3 times, most recently from d52bde3 to ebd99c0 Compare August 7, 2025 21:35
Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
@jakub-nt jakub-nt force-pushed the analyze-possible-policyset-paths-fix branch from ebd99c0 to c4b8277 Compare August 7, 2025 21:37
Comment thread cfbs/analyze.py
possible_policyset_relpaths = []

for filepath in files_dict:
file_name = name(filepath)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preexisting, but is not this name() function the same as os.path.basename()? If so, why not use it instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That could be done, I've simply never ended up doing so after writing the current implementation.

@jakub-nt jakub-nt merged commit bcaa45c into cfengine:master Aug 12, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants