bugmonotone - Bugs: bug #13072, diff against empty file produces...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #13072: diff against empty file produces incorrect patch

Submitted by:  None
Submitted on:  Fri 13 May 2005 03:53:52 AM UTC  
 
Category: working copySeverity: 3 - Normal
Item Group: incorrect behaviorStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed
mtn version --full: 

Sat 26 Nov 2005 01:10:32 AM UTC, comment #2:

This was fixed in e841b4394556a3839a60f21388574d8f7124f724 (with a testcase included). Closing as resolved.

Matthew Gregan <kinetik>
Project Member
Sun 12 Jun 2005 11:58:35 PM UTC, comment #1:

I have taken a look at the problem. The problem seems to be in two places. The first one is in diff.cc where there is no provision for a zero length hunk around line 833. The other problem is in transform.cc lines 398 and 399, which will add a blank line if there is no lines in a file. The first one is easily solved, the second one isn't because I don't know if other parts of monotone depend on this behavior. I modified commands.cc to check for an extra line being artifically added, and removing it if that happened. To use this patch, download it and type in the following

cd /dir/to/monotone/source
patch -p3 < /path/to/patch/13072_f1.patch
./configure
./make install

let me know how this works out for you.

Stephen Peters <smpeters>
Fri 13 May 2005 03:53:52 AM UTC, original submission:

In any monotone working directory, pick a file and run:

mv FILE SOMETHING-ELSE
touch FILE
monotone diff FILE | patch -p0 -R

You'll see that patch will fail. The problem is that monotone creates a buggy patch. For an empty input file (as generated by touch) it creates a patch which is equivalent to a file with one empty line (i.e., only newline). The @@ looks like

@@ -N,M +1

instead of

@@ -N,M +0

Anonymous

 

Attached Files
file #3082:  13072_f1.patch added by smpeters (2KiB - application/octet-stream - a suggested fix)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

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):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Sat 26 Nov 2005 01:10:32 AM UTCkinetikStatusNone=>Fixed
  Open/ClosedOpen=>Closed
Sun 12 Jun 2005 11:58:35 PM UTCsmpetersAttached File-=>Added 13072_f1.patch, #2600

Back to the top


Powered by Savane 3.1-cleanup1