Subject: Re: Patches from GNATS db broken
To: Toru TAKAMIZU <ttaka@earth.email.ne.jp>
From: Greg A. Woods <woods@weird.com>
List: current-users
Date: 01/17/2003 17:58:00
[ On Friday, January 17, 2003 at 20:33:42 (+0900), Toru TAKAMIZU wrote: ]
> Subject: Patches from GNATS db broken
>
> Sometimes I want to try patches posted to GNATS database, for
> example a new versions of a pkg. But these patches don't work
> because of white spaces or something like that automatically
> added somewhere.
> 
> I can't even apply the patches I posted. (Of course, I have
> original ones I can use instead.)
> 
> Is this normal?

It depends.  I gather from your later messages in this thread that
you're downloading the GNATS PRs by way of the WWW interface.

This is bound to cause troubles.

If you don't have some form of direct access to the GNATS PR database (I
think it should be possible to provide safe anonymous client/server
access to the database, or at least a copy of the database, but I don't
believe that's been done for NetBSD.org's GNATS yet) then ideally you
want to extract the patches from the copy of the PR that's forwarded to
the netbsd-bugs mailing list.  That's the copy which is least likely to
have been damaged in transit and it has gone through the fewest layers
of software.

If you really must extract patches from PRs retrieved via the WWW
interface then the best tool to fetch them is probably NetBSD's own
"ftp" client.

For example for PR#19257:

	$ ftp http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=19257

by default this leaves the raw HTML from the GNATS WWW interface in a
file with a name the same as the basename of the URL:

	query-pr-single.pl?number=19257

You need only then edit that file and remove all the HTML up to the
first part of the patch and all the junk below too.  Then you can safely
feed the remaining file contents to 'patch' for processing.

Now in this particular example there are two patches.  Once that's in
the main body of the PR after the ">Fix:" tag, and another that's in an
e-mail message attached as part of the body of the audit trail
(i.e. after the ">Audit-Trail:" tag).

In order to extract that second patch you have to delete all the HTML
before and after it, and you also have to delete the single leading
space from the remaining text in order to return it to its native format
so that 'patch' will understand it again.

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>