public inbox for sourcenav@sourceware.org
 help / color / mirror / Atom feed
* How to apply patches?
@ 2000-08-01  3:12 Thomas Heller
  2000-08-01  4:34 ` Bruce Stephens
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Heller @ 2000-08-01  3:12 UTC (permalink / raw)
  To: sourcenav

(Although I have created several patches in the past, I've
never applied any myself)

How do I apply patches to the SN source tree?
Which options must I give to patch, so that
the correct files are patched?

Here is what I did:

  $ tar -zxvf SN451.tar.gz
  $ cd SN451
  $ patch -p 0 <../0001-spolk-000725-patch
  patching file `configure.in'
                 ^^^^^^^^^^^^
  Reversed (or previously applied) patch detected!  Assume -R? [n] n
  Apply anyway? [n] n
  Skipping patch.
  1 out of 1 hunk ignored -- saving rejects to configure.in.rej
  patching file `Makefile.in'
                 ^^^^^^^^^^^
  Hunk #1 FAILED at 208.
  Hunk #2 FAILED at 233.
  2 out of 2 hunks FAILED -- saving rejects to Makefile.in.rej
  can't find file to patch at input line 74
  Perhaps you used the wrong -p or --strip option?
  The text leading up to this was:
  --------------------------
  |Index: snavigator/gui/Makefile.am
  |===================================================================
  |RCS file: /cvs/cvsfiles/devo/snavigator/gui/Makefile.am,v
  |retrieving revision 1.27.2.2.2.3.4.4
  |diff -c -2 -p -r1.27.2.2.2.3.4.4 Makefile.am
  |*** Makefile.am        2000/02/11 23:48:34     1.27.2.2.2.3.4.4
  |--- Makefile.am        2000/07/25 19:19:57
  --------------------------
  File to patch: ^C

Patch seems to look for the files in the wrong location(s).
Here are some lines from the patch itself:

Index: snavigator/configure.in
Index: snavigator/db/Makefile.in
...

Help!

Regards

Thomas Heller


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to apply patches?
  2000-08-01  3:12 How to apply patches? Thomas Heller
@ 2000-08-01  4:34 ` Bruce Stephens
  2000-08-01  5:08   ` Bruce Stephens
  0 siblings, 1 reply; 4+ messages in thread
From: Bruce Stephens @ 2000-08-01  4:34 UTC (permalink / raw)
  To: sourcenav

"Thomas Heller" <thomas.heller@ion-tof.com> writes:

> (Although I have created several patches in the past, I've
> never applied any myself)

I've created and applied patches without difficulty in the past.
However, these patches look impossible to apply using GNU patch 2.5 or
2.5.4.

The problem is in determining the filename:

[...]

>   --------------------------
>   |Index: snavigator/gui/Makefile.am
>   |===================================================================
>   |RCS file: /cvs/cvsfiles/devo/snavigator/gui/Makefile.am,v
>   |retrieving revision 1.27.2.2.2.3.4.4
>   |diff -c -2 -p -r1.27.2.2.2.3.4.4 Makefile.am
>   |*** Makefile.am        2000/02/11 23:48:34     1.27.2.2.2.3.4.4
>   |--- Makefile.am        2000/07/25 19:19:57
>   --------------------------

There are three relevant pathnames here: the old path, the new path,
and the Index: path.  According to the manpage, patch will consider
them in that order.  

If in POSIX mode, it'll take the first one that exists (in this case,
Makefile.am (the old pathname).  Otherwise, it'll choose the best
pathname.  Unfortunately, the best pathname seems to be the name with
fewest path name components, with the shortest basename.

Presumably somewhere there's a patch where you can tell it to use
Index, ignoring other pathnames.  Indeed, that would seem to me to be
sane behaviour---if there's an Index line present, then surely whoever
generated the patch knew what they were doing.  

Anyway, I don't know how to apply these patches.  Do RedHat have some
special version of patch?

-- 
Bruce Stephens			Bruce.Stephens@MessagingDirect.com
MessagingDirect(UK) Ltd		<URL: http://www.MessagingDirect.com/ >

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to apply patches?
  2000-08-01  4:34 ` Bruce Stephens
@ 2000-08-01  5:08   ` Bruce Stephens
  2000-08-01  5:57     ` Thomas Heller
  0 siblings, 1 reply; 4+ messages in thread
From: Bruce Stephens @ 2000-08-01  5:08 UTC (permalink / raw)
  To: sourcenav

Bruce Stephens <bruce.stephens@messagingdirect.com> writes:

[...]

> Presumably somewhere there's a patch where you can tell it to use
> Index, ignoring other pathnames.  Indeed, that would seem to me to
> be sane behaviour---if there's an Index line present, then surely
> whoever generated the patch knew what they were doing.

Here's a quick hack to patch-2.5.4.  It changes the behaviour of
patch, so you probably don't want to install it widely.  If an Index:
line is found, then it gets used, regardless.  (Probably it would be
better to change the ordering, putting Index: before the old and new
paths, but that's not necessary for these patches.)

*** pch.c~      Mon Aug 30 07:20:08 1999
--- pch.c       Tue Aug  1 13:01:30 2000
***************
*** 513,522 ****
        {
        enum nametype i0 = NONE;
  
!       if (! posixly_correct && (name[OLD] || name[NEW]) && name[INDEX])
          {
!           free (name[INDEX]);
!           name[INDEX] = 0;
          }
  
        for (i = OLD;  i <= INDEX;  i++)
--- 513,524 ----
        {
        enum nametype i0 = NONE;
  
!       if (! posixly_correct && name[INDEX])
          {
!           free (name[OLD]);
!           name[OLD] = 0;
!           free (name[NEW]);
!           name[NEW] = 0;
          }
  
        for (i = OLD;  i <= INDEX;  i++)


-- 
Bruce Stephens			Bruce.Stephens@MessagingDirect.com
MessagingDirect(UK) Ltd		<URL: http://www.MessagingDirect.com/ >

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to apply patches?
  2000-08-01  5:08   ` Bruce Stephens
@ 2000-08-01  5:57     ` Thomas Heller
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Heller @ 2000-08-01  5:57 UTC (permalink / raw)
  To: sourcenav

> Bruce Stephens <bruce.stephens@messagingdirect.com> writes:
> 
> [...]
> 
> > Presumably somewhere there's a patch where you can tell it to use
> > Index, ignoring other pathnames.  Indeed, that would seem to me to
> > be sane behaviour---if there's an Index line present, then surely
> > whoever generated the patch knew what they were doing.
> 
> Here's a quick hack to patch-2.5.4.  It changes the behaviour of
> patch, so you probably don't want to install it widely.  If an Index:
> line is found, then it gets used, regardless.  (Probably it would be
> better to change the ordering, putting Index: before the old and new
> paths, but that's not necessary for these patches.)
> [...]

Thanks, I wrote a small python script to fix the patches,
that was easier.

Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-08-01  5:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-01  3:12 How to apply patches? Thomas Heller
2000-08-01  4:34 ` Bruce Stephens
2000-08-01  5:08   ` Bruce Stephens
2000-08-01  5:57     ` Thomas Heller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).