bugQuilt - Bugs: bug #62837, Quilt fail to apply patch when the...


bug #62837: Quilt fail to apply patch when the patch file had been dos2unix-ed

Submitter:  None
Submitted:  Fri 29 Jul 2022 06:30:14 PM UTC
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Invalid
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup

Wed 07 Dec 2022 01:52:43 PM UTC, comment #1: 

I don't think anything can be done about this at the quilt level. Quilt is essentially asking the patch utility to apply the patches. If the patch utility doesn't like the way your patch is formatted, it won't apply. The "reversed patch" message is also coming from patch. The message may seem incorrect in this case, but it is due to the fact that you are in a corner case where the patch deletes a complete file, and such patches can always be revert-applied by nature.

If you believe that it should be possible to apply patches with a given line ending to files using a different line ending, you should create a feature request in the GNU patch project (or whatever patch utility you are using).

I am personally not convinced that anything needs to be fixed or implemented here. In my opinion, it is your responsibility to ensure that the line ending used in your patch files is consistent with the line ending used in the files themselves. This seems desirable for consistency if nothing else, independently of the issue being reported here.

Also I have never heard of github messing with line ending. I know there are a few git config options related to this, maybe you simply need to set them right in your repository. Namely, core.eol and core.autocrlf seem relevant in your case.

Jean Delvare <khali>
Group administrator
Fri 29 Jul 2022 06:30:14 PM UTC, original submission:  

I'm using quilt to apply patches to third party debian packages. I had a patch file that was working, but when it was checked into my github repo, the carriage returns line terminators were turned into line feeds. When the patch was re-applied to the same original source, it failed with the message "Reversed (or previously applied) patch detected!", which I didn't find very informative. Visually comparing the patch against the source being patched didn't flag anything for me, since the differences were in the invisible whitespace.

In this particular case, the patch was to actually remove a file that contained five lines of text. The correct file looks like this:

--- a/poetry-core-1.0.8/poetry/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-from pkgutil import extend_path^M
-__path__ = extend_path(_path_, _name_)^M

Ideally, I'd hope that the EOL type would not affect the application of a patch, or at least cause quilt to fall back to fuzzy matching and still succeed.



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by khali (Posted a comment)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-04-11 khali StatusNeed Info Invalid
        Open/ClosedOpen Closed
    2022-12-07 khali StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-c373.
    Corresponding source code