Fix silent registration failure when paths contain spaces#40
Open
LalithShiyam wants to merge 1 commit intomasterfrom
Open
Fix silent registration failure when paths contain spaces#40LalithShiyam wants to merge 1 commit intomasterfrom
LalithShiyam wants to merge 1 commit intomasterfrom
Conversation
All subprocess calls to greedy and c3d used shell=True with unquoted f-string paths. When directory paths contained spaces (e.g., "psma vs acp3 patients"), the shell would split them into separate arguments causing greedy to fail silently — capture_output=True swallowed stderr and the return code was never checked. Replace re.escape() (regex escaping, wrong context) and bare f-string interpolation with shlex.quote() for proper shell escaping across all subprocess calls: rigid(), affine(), deformable(), _build_cmd(), and rgb2gray(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
shell=Truewith unquoted f-string paths, causing silent failures when directory paths contained spacesre.escape()(regex escaping — wrong context) and bare path interpolation withshlex.quote()for proper shell escapingImageRegistration:rigid(),affine(),deformable(),_build_cmd()(resample), andrgb2gray()Problem
When a subject directory path contained spaces (e.g.,
psma vs acp3 patients/), the shell split the path into separate arguments. Greedy failed butcapture_output=Trueswallowed stderr and the return code was never checked — so PUMA logged alignment as "done" but no output files were created. This caused aFileNotFoundErrordownstream when trying to copy aligned masks.Test plan
psma vs acp3 patients/puma_input/)🤖 Generated with Claude Code