NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/47367: patch(1) mishandles Oops.rej

>Number:         47367
>Category:       bin
>Synopsis:       patch(1) mishandles Oops.rej
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 27 02:05:00 +0000 2012
>Originator:     David A. Holland
>Release:        NetBSD 6.99.11 (20120906)
System: NetBSD macaran 6.99.11 NetBSD 6.99.11 (MACARAN) #15: Mon Oct 15 
21:24:31 EDT 2012 dholland@macaran:/usr/src/sys/arch/amd64/compile/MACARAN amd64
Architecture: x86_64
Machine: amd64
     $NetBSD: patch.c,v 1.29 2011/09/06 18:25:14 joerg Exp $
     $NetBSD: pch.c,v 1.24 2011/09/06 18:25:14 joerg Exp $
     $NetBSD: inp.c,v 1.23 2009/10/21 17:16:11 joerg Exp $
     $NetBSD: util.c,v 1.26 2010/10/02 19:31:14 wiz Exp $
     $NetBSD: backupfile.c,v 1.14 2008/09/19 18:33:34 joerg Exp $
     $NetBSD: mkpath.c,v 1.1 2008/09/19 18:33:34 joerg Exp $


If you try to patch a file that doesn't exist, and attempt to continue
instead of ^Cing out, patch goes

   File to patch: 
   No file found--skip this patch? [n] y
   Skipping patch...
   Hunk #1 ignored at 64.
   Hunk #2 ignored at 99.
   Hunk #3 ignored at 133.
   3 out of 3 hunks ignored--saving rejects to Oops.rej

...but it truncates Oops.rej for each missing file, so you lose most
of the patch.

The output Oops.rej file also doesn't have a patch header, so you
can't tell where it was supposed to go.


Pick your favorite pkgsrc package with a bunch of patches, then do

        mkdir foo
        cd foo
        tar -xvzf ../../../distfiles/thingy-1.0.tar.gz
        cd thingy-1.0
        cat ../../patches/patch-* | patch -p1

and enter nothing at the "File to patch:" prompts and 'y' and the
"skip this patch?" prompts.

Then look at the output Oops.rej file and notice that it reflects only
the last of the patches.

There is an Oops.rej.orig file also left behind that contains the
contents of the second-last patch, but the others are lost.

(I'm furthermore wondering what happens if the current directory also
contains a file called Oops for which a patch fails...)



Home | Main Index | Thread Index | Old Index