Skip to content

Commit b5480d2

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 7a8d343 commit b5480d2

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
@@ -7857,8 +7857,8 @@ def _patch(patch_file, options=None, dry_run=False):
78577857
# Try to reverse-apply hunks from rejects file using a dry-run.
78587858
# If this returns a retcode of 0, we know that the patch was
78597859
# already applied. Rejects are written from the base of the
7860-
# directory, so the strip option doesn't apply here.
7861-
reverse_pass = _patch(patch_rejects, ["-R", "-f"], dry_run=True)
7860+
# directory, so the required strip level is 0.
7861+
reverse_pass = _patch(patch_rejects, ["-R", "-f", "-p0"], dry_run=True)
78627862
already_applied = reverse_pass["retcode"] == 0
78637863

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

0 commit comments

Comments
 (0)