patch: .diff interpreted incorrectly?

Rob Landley rob at landley.net
Tue Oct 11 00:34:19 UTC 2005


On Monday 10 October 2005 13:21, Bernhard Fischer wrote:
> On Mon, Oct 10, 2005 at 12:38:16PM -0500, Rob Landley wrote:
> >On Monday 10 October 2005 07:42, Bernhard Fischer wrote:
> >> Hi,
> >>
> >> ./patch is the busybox one, it behaves differently as GNU patch,
> >> i.e. it seems to patch the "wrong" file as compared to GNU patch
> >> version 2.5.9? "wrong" because i'd expect _both_ patch commands to patch
> >> the same file..
> >>
> >> Is this a feature or a bug in busybox' patch?
> >
> >Figuring out which file to patch is a perennial problem with the patch
> >command, because diff lists differences between two files, so patch should
> >apply those changes to which of those two?
>
> SUSv sais that the one with *** is the src and the one with --- is the
> dst. The only problem is that for _my_ usual invocations of (GNU) diff,
> no *** is ever emitted.

In gnu, --- is the old one (The source of - lines) from) and +++ is the new 
one (the source of + lines).  This makes sense to me, and I'm all for it.

> >If you want to poke around with patch, there's plenty of to-do items.  In
>
> I don't want to. It was you who started to mention patch :)

Well I'm putting together a new version of Firmware Linux now that I got 
unblocked about the upgrade to 2.6.13's UML.  (Some behavior changed and 
broke busybox, but it turns out they're correct and we're wrong.  Busybox's 
install.c had a bug where we were calling lstat() against a file that didn't 
exist, and not checking the return code.  So we fell through and called 
ISDIR() against a stat buffer that contained random uninitalized garbage, and 
what was in that random garbage changed with the kernel upgrade, which caused 
us to think that a nonexistent file was a directory, which went "boing".  I 
checked in a fix to busybox already.)

Anyway, when I upgraded to the new busybox I tried yanking various things and 
using the busybox version.  I can now yank the gzip package, and less.  But 
yanking patch caused breakage, and I had to revert to the other patch.  I'll 
probably fix it up later, but right now I've got several other things to 
do...

> >addition to fairly standard usage ("patch -p1 -i thingy.patch") not
> > currently
>
> It should *currently* work right (except vodz mentioning to use bb_getlarg
> instead of atoi, because the former would check/warn for -phaha,gotYa
> but would add 6 bytes as compared to the dumb variant i (temporarily)
> changed it to).

Ah, I see you checked in a fix.  I'll give it a whack, possibly this evening.  
(Still need to get 1.0.2 together before Erik comes back, though...)

Rob



More information about the busybox mailing list