You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "Perry E. Metzger" <pe...@piermont.com> on 2001/11/24 22:48:29 UTC

does it really need gnu patch?

I'm trying to build the Subversion client on a fairly recent NetBSD.
config dies trying to find GNU patch -- it seems to be unwilling to
live with a non-GNU patch. (NetBSD has a non-GPL'ed patch).

Does it really need GNU patch or would it be safe to remove that requirement?

Perry

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: gnu diff (was Re: does it really need gnu patch?)

Posted by Ben Collins-Sussman <su...@collab.net>.
Ben Collins-Sussman <su...@collab.net> writes:

> Of course, IMO, I think this behavior is good.  I *want* my diff and
> patch program to deal with these kinds of text files appropriately,
> and so does the FSF apparently.  

Feel free to remove this 'diff' hack in NetBSD... maybe we can reverse
the whole trend, and have your reversion propogate back to FreeBSD as
well!

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: gnu diff (was Re: does it really need gnu patch?)

Posted by "Perry E. Metzger" <pe...@piermont.com>.
Ben Collins-Sussman <su...@collab.net> writes:
> But if I run the *real* GNU diff, compiled straight out of diffutils,
> the patch file looks like:
> 
> --- foofile     Sat Nov 24 17:42:02 2001
> +++ foofile2    Sat Nov 24 17:41:53 2001
> @@ -1 +1 @@
> -fooooextra text
> \ No newline at end of file
> +foooo
> \ No newline at end of file

Here is what it looks like on NetBSD:

$ more foofile.patch 
--- foofile     Sat Nov 24 18:56:02 2001
+++ foofile2    Sat Nov 24 18:56:02 2001
@@ -1 +1 @@
-some text, no newline...extra text, still no newline
\ No newline at end of file
+some text, no newline
\ No newline at end of file

That would seem to indicate that our diff is fine.

The problem appears to be our version of patch. It bitches about the
patch being malformed, as you note. I'm going to try to add the needed
feature to our patch so that it does not fail any longer.

Perry

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: gnu diff (was Re: does it really need gnu patch?)

Posted by Ben Collins-Sussman <su...@collab.net>.
"Perry E. Metzger" <pe...@piermont.com> writes:

> My one possible guess is that patch is in fact what is failing in the
> test and not actually diff. I'm going to check that. If so, I'll
> figure out what's wrong with our patch and fix it. Otherwise I'll
> continue to be puzzled.

Look at the test in ac-helpers/gnu-diff.sh:

It creates two identical files, each with no newline ending.  Then it
appends to one of them, still no newline ending.

Then it runs 'diff'.  If I use the 'hacked' GNU diff (/usr/bin/diff)
on FreeBSD, the patch file looks like:

--- foofile     Sat Nov 24 17:42:02 2001
+++ foofile2    Sat Nov 24 17:41:53 2001
@@ -1 +1 @@
-fooooextra text
+foooo

But if I run the *real* GNU diff, compiled straight out of diffutils,
the patch file looks like:

--- foofile     Sat Nov 24 17:42:02 2001
+++ foofile2    Sat Nov 24 17:41:53 2001
@@ -1 +1 @@
-fooooextra text
\ No newline at end of file
+foooo
\ No newline at end of file


This second patch file causes /usr/bin/patch (Larry Wall, v.2.1) to
choke and claim the patch is malformed.  I just verified this by hand.

I'm certain that the FreeBSD folks removed the '\ No newline' output
behavior so that they could go on using Larry Wall's original patch
program.  Compare the diffutils source with the BSD source -- you
should see the difference.

Really, I don't see a lot of choices here:  either an operating system
needs to use the true-blue GNU diff/patch as a pair, or use the hacked
GNU diff and Larry Wall patch as a pair.

Going out for the evening, back later...


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: gnu diff (was Re: does it really need gnu patch?)

Posted by "Perry E. Metzger" <pe...@piermont.com>.
Ben Collins-Sussman <su...@collab.net> writes:
> There's a long FreeBSD thread about why they modified their GNU diff.
> I don't remember the details, or where I read about it.  

Dunno about how they did theirs, but I've just finished reading all
the CVS log messages on ours. From what I can tell, we added some
casts and code to use mkstemp. No changes in behavior! I can't explain
what is going on.

My one possible guess is that patch is in fact what is failing in the
test and not actually diff. I'm going to check that. If so, I'll
figure out what's wrong with our patch and fix it. Otherwise I'll
continue to be puzzled.

Perry

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: gnu diff (was Re: does it really need gnu patch?)

Posted by Ben Collins-Sussman <su...@collab.net>.
"Perry E. Metzger" <pe...@piermont.com> writes:

> "Perry E. Metzger" <pe...@piermont.com> writes:
> > Hmm. It seems that NetBSD's diff, although it claims to be gnu diff 2.7,
> > does not pass this test. Any ideas on what I have to do to fix any
> > damage done to it so it will work?
> 
> BTW, to be clear, I've got NetBSD commit access so my intention is to
> fix our diff "permanently" so the released NetBSD diff does the right thing.

Oooh, a NetBSD committer.  :-)

There's a long FreeBSD thread about why they modified their GNU diff.
I don't remember the details, or where I read about it.  

If you look at the test: GNU diff notices when an input file doesn't
end with a newline, and adds a special line about this at the end of
the patch-file it produces.  IIRC, the FreeBSD people found this
behavior annoying, or maybe it broke some other program reading the
patchfile -- probably Larry Wall's original patch program.  So they
got rid of the behavior.

Of course, IMO, I think this behavior is good.  I *want* my diff and
patch program to deal with these kinds of text files appropriately,
and so does the FSF apparently.  

I just answered my own previous question:  that's why Subversion
requires GNU patch.  Because I bet an older 'patch' program would gag
on GNU diff's special 'no newline' output.   So please don't remove
our GNU patch requirement.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: gnu diff (was Re: does it really need gnu patch?)

Posted by "Perry E. Metzger" <pe...@piermont.com>.
"Perry E. Metzger" <pe...@piermont.com> writes:
> Hmm. It seems that NetBSD's diff, although it claims to be gnu diff 2.7,
> does not pass this test. Any ideas on what I have to do to fix any
> damage done to it so it will work?

BTW, to be clear, I've got NetBSD commit access so my intention is to
fix our diff "permanently" so the released NetBSD diff does the right thing.

Perry

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: gnu diff (was Re: does it really need gnu patch?)

Posted by "Perry E. Metzger" <pe...@piermont.com>.
Ben Collins-Sussman <su...@collab.net> writes:
> Aha! Looks like the NetBSD folks are using the same 'hacked' diff as
> the FreeBSD folks.
> 
> Build diffutils.  Install them into /usr/local/bin, perhaps as 'gdiff'
> and 'gpatch'.  Those will be found.

I'd prefer to fix our diff to work correctly for good -- then people
won't need two diffs on their system to use subversion with NetBSD.

Any idea what the nature of the hack you speak of was? I've just
looked through our sources and can't find ANY substantive changes at
all! The only thing I've been able to detect is that we replaced
mktemp with mkstemp, a difference that can't possibly have caused this
semantic change.

Perry

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: gnu diff (was Re: does it really need gnu patch?)

Posted by Ben Collins-Sussman <su...@collab.net>.
"Perry E. Metzger" <pe...@piermont.com> writes:

> Ben Collins-Sussman <su...@collab.net> writes:
> > I know that we require GNU diff, because it's the only version of diff
> > that can deal with files that don't end with a newline.  That's why I
> > originally wrote ac-helpers/gnu-diff.sh.
> 
> Hmm. It seems that NetBSD's diff, although it claims to be gnu diff 2.7,
> does not pass this test. Any ideas on what I have to do to fix any
> damage done to it so it will work?

Aha! Looks like the NetBSD folks are using the same 'hacked' diff as
the FreeBSD folks.

Build diffutils.  Install them into /usr/local/bin, perhaps as 'gdiff'
and 'gpatch'.  Those will be found.

On my own system, I just keep a version of GNU diff in ~/bin/diff,
which also happens to be in my $PATH.  :-)



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

gnu diff (was Re: does it really need gnu patch?)

Posted by "Perry E. Metzger" <pe...@piermont.com>.
Ben Collins-Sussman <su...@collab.net> writes:
> I know that we require GNU diff, because it's the only version of diff
> that can deal with files that don't end with a newline.  That's why I
> originally wrote ac-helpers/gnu-diff.sh.

Hmm. It seems that NetBSD's diff, although it claims to be gnu diff 2.7,
does not pass this test. Any ideas on what I have to do to fix any
damage done to it so it will work?

Perry

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: does it really need gnu patch?

Posted by Ben Collins-Sussman <su...@collab.net>.
"Perry E. Metzger" <pe...@piermont.com> writes:

> Ben Collins-Sussman <su...@collab.net> writes:
> > > Does it really need GNU patch or would it be safe to remove that
> > > requirement?
> > 
> > I know that we require GNU diff, because it's the only version of diff
> > that can deal with files that don't end with a newline.
> 
> We do, in fact, have GNU diff in NetBSD (because RCS and CVS need it too.)

I use FreeBSD, and learned (the hard way) that while the 'diff'
included in /usr/src *claims* to be GNU diff, it turns out that the
FreeBSD team actually hacked it to lose certain behaviors.  Hence the
autoconf test for a 'non-hacked' GNU diff.

> 
> > As for GNU patch, I'm not sure why we require it.  Probably just to be
> > consistent.  Does anyone remember who wrote ac-helpers/gnu-patch.sh,
> > and why?  :-)
> 
> If there isn't a specific requirement it would be cool to allow other
> kinds of patch....

Hmmm.  It turns out I added the GNU patch requirement back on June
27th.  I wonder what I was smoking; the log message doesn't say why.
I'm guessing that I was just looking for consistency... ?

On my FreeBSD box, /usr/local/bin/patch is GNU patch 2.5, while the
standard system 'patch' is Larry Wall's version 2.1.

Really, I've never witnessed any issues that have to do with differing
versions of 'patch'.  My inclination is just to throw out the GNU
requirement.  But then who knows?  Maybe we'll discover a bug that
results.  What do other people think?

> 
> > (The background is:  we have no internal diff/patch library, because
> > after searching for over a year, we can't find one that isn't GPLed.
> > (CVS uses a librarized version of GNU diffutils.)  Therefore we use
> > the external GNU diff and patch.)
> 
> The original patch wasn't GPLed, btw. It only got GPLed after FSF
> started maintaining it.

Sure.  But do you want to turn Larry Wall's patch code into a library?
And do you have a non-GPLed diff implementation that we can do the
same thing to?  Sounds like quite a project.  :-(

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: does it really need gnu patch?

Posted by "Perry E. Metzger" <pe...@piermont.com>.
Ben Collins-Sussman <su...@collab.net> writes:
> > Does it really need GNU patch or would it be safe to remove that
> > requirement?
> 
> I know that we require GNU diff, because it's the only version of diff
> that can deal with files that don't end with a newline.

We do, in fact, have GNU diff in NetBSD (because RCS and CVS need it too.)

> As for GNU patch, I'm not sure why we require it.  Probably just to be
> consistent.  Does anyone remember who wrote ac-helpers/gnu-patch.sh,
> and why?  :-)

If there isn't a specific requirement it would be cool to allow other
kinds of patch....

> (The background is:  we have no internal diff/patch library, because
> after searching for over a year, we can't find one that isn't GPLed.
> (CVS uses a librarized version of GNU diffutils.)  Therefore we use
> the external GNU diff and patch.)

The original patch wasn't GPLed, btw. It only got GPLed after FSF
started maintaining it.

-- 
Perry E. Metzger		perry@piermont.com
--
"Ask not what your country can force other people to do for you..."

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: does it really need gnu patch?

Posted by Ben Collins-Sussman <su...@collab.net>.
"Perry E. Metzger" <pe...@piermont.com> writes:

> I'm trying to build the Subversion client on a fairly recent NetBSD.
> config dies trying to find GNU patch -- it seems to be unwilling to
> live with a non-GNU patch. (NetBSD has a non-GPL'ed patch).
> 
> Does it really need GNU patch or would it be safe to remove that requirement?

I know that we require GNU diff, because it's the only version of diff
that can deal with files that don't end with a newline.  That's why I
originally wrote ac-helpers/gnu-diff.sh.

As for GNU patch, I'm not sure why we require it.  Probably just to be
consistent.  Does anyone remember who wrote ac-helpers/gnu-patch.sh,
and why?  :-)

(The background is:  we have no internal diff/patch library, because
after searching for over a year, we can't find one that isn't GPLed.
(CVS uses a librarized version of GNU diffutils.)  Therefore we use
the external GNU diff and patch.)






---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: does it really need gnu patch?

Posted by Daniel Rall <dl...@finemaltcoding.com>.
I hadn't tried building Subversion in a while, and didn't follow the
build instructions properly the first go:


dlr@despot:subversion$ rpm -q diffutils patch
diffutils-2.7.2-3
patch-2.5.4-4
dlr@despot:subversion$ ./configure --enable-maintainer-mode --disable-shared
...
checking for non-broken GNU diff... ./configure: /home/dlr/src/collab.net/subversion/ac-helpers/gnu-diff.sh: Permission denied
configure: error: not found

Cannot find an unbroken GNU diff program in your PATH.
Please install GNU diff and patch from the GNU diffutils package,
version 2.7 or later. (ftp://ftp.gnu.org/pub/gnu/diffutils)

(Note that FreeBSD uses a *hacked* version of GNU diff that is unable
to handle certain types of text files.)


Note that patch is not part of the diffutils package (neither in the
RPMs I installed nor in diffutils 2.7 tarball I downloaded from
gnu.org -- see http://www.gnu.org/directory/diffutils.html and
http://www.gnu.org/directory/patch.html), and has not released a 2.7
version, so this text is somewhat misleading.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org