Subject: Re: Fuzz factors
To: None <tech-pkg@netbsd.org>
From: Alistair G. Crooks <agc@ftp.netbsd.org>
List: tech-pkg
Date: 11/12/1999 05:20:31
> On Fri, 12 Nov 1999, Alistair G. Crooks wrote:
> > introduce a second patch stage (in the package patch phase, not the
> > distribution patches), whereby a misapplied patch with
> > ${PATCH_FUZZ_FACTOR} will be tried again without a fuzz factor.  This
> 
> Um, shouldn't this rather be the other way 'round? First try with -F0,
> then retry without if it fails?

Ummm, yes. That's what I wrote in the commit message which you quoted,
and what's in the source.

...
fuzz="";                                \
${PATCH} -v > /dev/null 2>&1 && fuzz="${PATCH_FUZZ_FACTOR}"; \
${PATCH} $$fuzz ${PATCH_ARGS} < $$i ||  \
	( ${ECHO} "*** Fuzzy patch $$i ***"; ${PATCH} ${PATCH_ARGS} < $$i) || \
	( ${ECHO} Patch $$i failed ; exit 1 ) ; \
...

i.e.

set no fuzz factor
check we're not using a braindead patch(1), and set fuzz factor to
	${PATCH_FUZZ_FACTOR}
Attempt to apply the patch using the fuzz factor
If this fails, display a message, and attempt to apply the patch
	without a fuzz factor
If this fails, then die.

Regards,
Alistair

PS. I already sent you output of what happens, but here it is again,
on Solaris, but set up to use GNU patch 2.5, and with
PATCH_FUZZ_FACTOR?= -F0
set in /etc/mk.conf

% bmake patch
===>  Validating dependencies for gtk+-1.2.6
>> gtk+-1.2.6.tar.gz doesn't seem to exist on this system.
>> Attempting to fetch gtk+-1.2.6.tar.gz from ftp://ftp.gtk.org/pub/gtk/v1.2/.
Requesting ftp://ftp.gtk.org/pub/gtk/v1.2/gtk+-1.2.6.tar.gz
  (via ftp://<a firewall meachine>/)
2825334 bytes retrieved in 02:31 (18.20 KB/s)
>> Checksum OK for gtk+-1.2.6.tar.gz.
===>  Extracting for gtk+-1.2.6
===>  gtk+-1.2.6 depends on file: /usr/local/bin/perl - found
===>  gtk+-1.2.6 depends on executable: gmake - /usr/local/bin/gmake found
===>  gtk+-1.2.6 depends on file: /usr/local/bin/pkglibtool-ELF-1.2p2 - found
===>  gtk+-1.2.6 depends on installed package: gettext-0.10.35 - gettext-0.10.35  found
===>  gtk+-1.2.6 depends on installed package: glib-1.2.* - glib-1.2.4  found
===>  gtk+-1.2.6 depends on installed package: gtexinfo-3.12 - gtexinfo-3.12  found
===>  Patching for gtk+-1.2.6
===>  Applying SunOS patches for gtk+-1.2.6
===>   Applying SunOS patch <my pkgsrc dir>/x11/gtk/patches/patch-aa
patching file `configure'
Hunk #2 succeeded at 1391 (offset 2 lines).
Hunk #4 succeeded at 4089 (offset 11 lines).
Hunk #5 succeeded at 6888 (offset -104 lines).
===>   Applying SunOS patch <my pkgsrc dir>/x11/gtk/patches/patch-ab
patching file `gdk/Makefile.in'
===>   Applying SunOS patch <my pkgsrc dir>/x11/gtk/patches/patch-ac
patching file `gtk/Makefile.in'
===>   Applying SunOS patch <my pkgsrc dir>/x11/gtk/patches/patch-ad
patching file `po/Makefile.in.in'
===>   Applying SunOS patch <my pkgsrc dir>/x11/gtk/patches/patch-ae
patching file `gdk/gdkimage.c'
Hunk #1 FAILED at 18.
1 out of 1 hunk FAILED -- saving rejects to gdk/gdkimage.c.rej
!!! Fuzzy patch <my pkgsrc dir>/x11/gtk/patches/patch-ae !!!
patching file `gdk/gdkimage.c'
Hunk #1 succeeded at 26 with fuzz 1 (offset 8 lines).
===>   Applying SunOS patch <my pkgsrc dir>/x11/gtk/patches/patch-af
patching file `gtk-config.in'
%