Skip to content

GNU patch 2.7.6 always needs a strip option#57205

Open
OrangeDog wants to merge 2 commits into
saltstack:masterfrom
OrangeDog:patch-5
Open

GNU patch 2.7.6 always needs a strip option#57205
OrangeDog wants to merge 2 commits into
saltstack:masterfrom
OrangeDog:patch-5

Conversation

@OrangeDog

@OrangeDog OrangeDog commented May 11, 2020

Copy link
Copy Markdown
Contributor

What does this PR do?

When checking whether a patch applies in reverse, add the -p0 option.
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.

What issues does this PR fix or reference?

Fixes: #52329

Previous Behavior

Once a patch has been applied, all further runs fail.

New Behavior

State now correctly detects whether the patch has been applied,

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes/No

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@OrangeDog OrangeDog requested a review from a team as a code owner May 11, 2020 17:01
@ghost ghost requested review from xeacott and removed request for a team May 11, 2020 17:01
@OrangeDog

OrangeDog commented May 11, 2020

Copy link
Copy Markdown
Contributor Author

@terminalmage wrote this version of the state originally.
This will need tests. Ideally with a real patch.

@dwoz dwoz added needs-testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases has-failing-test labels May 12, 2020
@sagetherage sagetherage requested a review from cmcmarrow July 7, 2020 17:37
@sagetherage sagetherage added the Magnesium Mg release after Na prior to Al label Jul 7, 2020
@cmcmarrow cmcmarrow added Magnesium Mg release after Na prior to Al and removed Magnesium Mg release after Na prior to Al labels Jul 8, 2020
@cmcmarrow

Copy link
Copy Markdown
Contributor

re-run all full

cmcmarrow
cmcmarrow previously approved these changes Jul 17, 2020
@sagetherage sagetherage removed the Magnesium Mg release after Na prior to Al label Sep 18, 2020
@sagetherage sagetherage removed the request for review from xeacott December 3, 2020 17:37
@sagetherage

Copy link
Copy Markdown
Contributor

@waynew this is a good one for the Test Clinic

@dwoz dwoz added test:coverage and removed needs-rebase Needs to be rebased, against either the current branch or a different one labels Apr 9, 2026
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.70%. Comparing base (01dfcb1) to head (236e18f).
⚠️ Report is 8 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #57205      +/-   ##
==========================================
+ Coverage   70.69%   70.70%   +0.01%     
==========================================
  Files        2232     2232              
  Lines      311250   311250              
  Branches    67176    67176              
==========================================
+ Hits       220012   220040      +28     
+ Misses      79193    79172      -21     
+ Partials    12045    12038       -7     
Flag Coverage Δ
salt 57.85% <100.00%> (+0.01%) ⬆️
tests 86.23% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
salt/states/file.py 66.81% <100.00%> (ø)

... and 26 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

OrangeDog and others added 2 commits June 21, 2026 18:09
Fixes saltstack#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`.
Adds test_patch_single_file_absolute_paths to pin the already-applied
detection behaviour for patches with absolute path headers. Also adds
changelog/57205.fixed.md per project convention.

Fixes saltstack#52329
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:coverage test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

previously applied successful patch is not recognized when file.patch is re-run the same patch file

6 participants