fix: remove double quotes from patch command path argument#108
Merged
richm merged 1 commit intolinux-system-roles:mainfrom Mar 24, 2026
Merged
fix: remove double quotes from patch command path argument#108richm merged 1 commit intolinux-system-roles:mainfrom
richm merged 1 commit intolinux-system-roles:mainfrom
Conversation
The patch command was wrapping the path in double quotes and also using the
quote filter, resulting in double-quoted paths being passed to the patch
command. The quote filter already handles proper shell escaping, so the
extra double quotes are redundant and can cause issues.
Changes:
- Remove manual double quotes around {{ __hpc_diags_patch_file.path | quote }}
- Keep the quote filter for proper shell escaping
- The command now generates: patch -p1 gather_azhpc_vm_diagnostics.sh '/path/to/file'
instead of: patch -p1 gather_azhpc_vm_diagnostics.sh "'/path/to/file'"
Created-by-AI: Claude Sonnet 4.5
Prompt: new modification: the patch command double quotes the patch file path, please fix
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts the Ansible task that runs the patch command so the patch file path is only shell-escaped via the quote filter and no longer wrapped in redundant manual double quotes, preventing double-quoted paths from being passed to patch. Sequence diagram for updated patch command invocationsequenceDiagram
actor Operator
participant AnsiblePlaybook as Ansible_playbook
participant PatchDiagnosticsTask as Patch_Diagnostics_task
participant Shell as Shell
participant PatchCmd as patch
Operator->>AnsiblePlaybook: Run playbook
AnsiblePlaybook->>PatchDiagnosticsTask: Execute task Patch Diagnostics script
PatchDiagnosticsTask->>PatchDiagnosticsTask: Resolve __hpc_diags_patch_file.path
PatchDiagnosticsTask->>PatchDiagnosticsTask: Apply quote filter to path
PatchDiagnosticsTask->>Shell: Execute
activate Shell
Shell->>PatchCmd: patch -p1 gather_azhpc_vm_diagnostics.sh <quoted_path>
PatchCmd-->>Shell: Apply patch using correctly escaped path
deactivate Shell
Shell-->>PatchDiagnosticsTask: Command result
PatchDiagnosticsTask-->>AnsiblePlaybook: Task status
AnsiblePlaybook-->>Operator: Playbook result
Flow diagram for command string construction in patch taskflowchart TD
A[Start Patch Diagnostics task] --> B[Read __hpc_diags_patch_file.path]
B --> C[Apply quote filter for shell escaping]
C --> D[Construct cmd:
patch -p1 gather_azhpc_vm_diagnostics.sh <quoted_path>]
D --> E[Invoke command module with cmd and chdir]
E --> F[Shell executes patch with correctly escaped path]
F --> G[End task]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Since the
commandmodule does not invoke a shell, you can avoid relying onquoteand string interpolation entirely by using the list form (e.g.cmd: ['patch', '-p1', 'gather_azhpc_vm_diagnostics.sh', __hpc_diags_patch_file.path]), which will make argument handling clearer and less error-prone for future changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Since the `command` module does not invoke a shell, you can avoid relying on `quote` and string interpolation entirely by using the list form (e.g. `cmd: ['patch', '-p1', 'gather_azhpc_vm_diagnostics.sh', __hpc_diags_patch_file.path]`), which will make argument handling clearer and less error-prone for future changes.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
spetrosi
approved these changes
Mar 24, 2026
richm
approved these changes
Mar 24, 2026
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.
The patch command was wrapping the path in double quotes and also using the quote filter, resulting in double-quoted paths being passed to the patch command. The quote filter already handles proper shell escaping, so the extra double quotes are redundant and can cause issues.
Changes:
Created-by-AI: Claude Sonnet 4.5
Prompt: new modification: the patch command double quotes the patch file path, please fix
Summary by Sourcery
Bug Fixes: