bugGNU patch - Bugs: bug #39409, Applying context diff (with diff...


bug #39409: Applying context diff (with diff -C0) fails.

Submitted by:  None
Submitted on:  Thu 04 Jul 2013 02:28:19 AM UTC  
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: Andreas Gruenbacher <agruen>
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Thu 04 Jul 2013 10:28:10 AM UTC, comment #1:

Interesting -- this bug seems to exist in all versions of patch.

Andreas Gruenbacher <agruen>
Project AdministratorIn charge of this item.
Thu 04 Jul 2013 02:28:19 AM UTC, original submission:

This occur in 2.6.1 (Ubuntu) and 2.7.1 (Cygwin).

$ echo -ne "a\nb\n" > 1.txt
$ echo -ne "a\n" > 2.txt
$ diff -C0 1.txt 2.txt > 12.patch
$ patch 1.txt 12.patch
patch: **** replacement text or line numbers mangled in hunk at line 4
$ patch -R 2.txt 12.patch
patch: **** replacement text or line numbers mangled in hunk at line 4

This doesn't occur if the order of the input is exchanged.

$ echo -ne "a\nb\n" > 1.txt
$ echo -ne "a\n" > 2.txt
$ diff -C0 2.txt 1.txt > 21.patch
$ patch 2.txt 21.patch
patching file 2.txt
$ patch -R 1.txt 21.patch
patching file 1.txt



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

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by agruen (Posted a comment)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 04 Jul 2013 10:28:09 AM UTCagruenAssigned toNone=>agruen

    Back to the top

    Powered by Savane 3.1-cleanup