Bug 625420

Summary: patch creates .orig backup file
Product: [Fedora] Fedora Reporter: Jiri Popelka <jpopelka>
Component: patchAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 13CC: twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-20 12:16:10 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Attachments:
Description Flags
patch with files to patch none

Description Jiri Popelka 2010-08-19 07:35:49 EDT
Created attachment 439655 [details]
patch with files to patch

Description of problem:

(01:00:42 PM) jpopelka: I have a patch that patches 2 files. When I apply it
(01:00:42 PM) jpopelka: patch -p1 --verbose --fuzz=0 <foomatic-db-device-ids-20100506.patch
(01:01:05 PM) jpopelka: it creates backup for one of the files with .orig suffix
(01:01:37 PM) twaugh: Only one?
(01:01:40 PM) jpopelka: only one
(01:01:41 PM) twaugh: What does 'lsdiff' say about the patch?
(01:02:07 PM) jpopelka: >lsdiff foomatic-db-device-ids-20100506.patch
(01:02:07 PM) jpopelka: foomatic-db-20100204/db/source/PPD/Ricoh/PS/Ricoh-Aficio_SP_C420DN_PS.ppd
(01:02:07 PM) jpopelka: foomatic-db-20100204/db/source/printer/HP-Color_LaserJet_2605dn.xml
(01:02:24 PM) jpopelka: it creates db/source/PPD/Ricoh/PS/Ricoh-Aficio_SP_C420DN_PS.ppd.orig
(01:03:15 PM) twaugh: There used to be a bug where if the same file was patched twice from the same input file, the .orig file would get overwritten the second time
(01:03:20 PM) twaugh: I wonder if the fix for that didn't work right

Version-Release number of selected component (if applicable):
patch-2.6.1-1.fc13.x86_64

How reproducible:
Always

Steps to Reproduce:
1. unpack the attached file (foomatic-db-20100819.tar.bz2)
2. cd foomatic-db-20100819
3. patch -p1 --verbose --fuzz=0 <foomatic-db-device-ids-20100506.patch
  
Actual results:
Backup file db/source/PPD/Ricoh/PS/Ricoh-Aficio_SP_C420DN_PS.ppd.orig is created.

Expected results:
No backup file created.
Comment 1 Tim Waugh 2010-08-20 12:16:10 EDT
Looks like intentional behaviour.  One of the patches required an offset of 1 line, whereas the other applied exactly.

       --backup-if-mismatch
          Back  up  a file if the patch does not match the file exactly and if
          backups are not otherwise requested.  This  is  the  default  unless
          patch is conforming to POSIX.