Skip to content

Commit 7abcce6

Browse files
OrangeDogdwoz
authored andcommitted
GNU patch 2.7.6 always needs a strip option
Fixes #52329 Without this, you get errors such as >No file to patch. Skipping patch. >1 out of 1 hunk ignored >can't find file to patch at input line 857 >Perhaps you should have used the -p or --strip option? There may be additional bugs like this if the target is not a directory. The solution should be to default `strip=0`.
1 parent efc0939 commit 7abcce6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

salt/states/file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7268,8 +7268,8 @@ def _patch(patch_file, options=None, dry_run=False):
72687268
# Try to reverse-apply hunks from rejects file using a dry-run.
72697269
# If this returns a retcode of 0, we know that the patch was
72707270
# already applied. Rejects are written from the base of the
7271-
# directory, so the strip option doesn't apply here.
7272-
reverse_pass = _patch(patch_rejects, ["-R", "-f"], dry_run=True)
7271+
# directory, so the required strip level is 0.
7272+
reverse_pass = _patch(patch_rejects, ["-R", "-f", "-p0"], dry_run=True)
72737273
already_applied = reverse_pass["retcode"] == 0
72747274

72757275
# Check if the patch command threw an error upon execution

0 commit comments

Comments
 (0)