Bug 50097 - New port: 2.11BSD version of diff/diffh, can work w/files that GNU Diff failes "memory exhausted"
Summary: New port: 2.11BSD version of diff/diffh, can work w/files that GNU Diff faile...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Norikatsu Shigemura
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-18 15:30 UTC by risner
Modified: 2003-03-23 07:25 UTC (History)
1 user (show)

See Also:


Attachments
file.shar (8.30 KB, text/plain)
2003-03-18 15:30 UTC, risner
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description risner 2003-03-18 15:30:07 UTC
	Diff program from 2.11BSD unix ported to FreeBSD.  This
	program can process large files with less memory.  GNU Diff
	often can not work with files larger than 33 % of datasize
	(from limit) due to memory exhaustion.  If you work with
	files that large or larger, you will need this version of
	diff.
Comment 1 Norikatsu Shigemura freebsd_committer freebsd_triage 2003-03-18 16:02:38 UTC
State Changed
From-To: open->analyzed

I want this. Oops, I'll handle this:-). 


Comment 2 Norikatsu Shigemura freebsd_committer freebsd_triage 2003-03-18 16:02:38 UTC
Responsible Changed
From-To: freebsd-ports-bugs->nork

Now ports freeze.
Comment 3 Norikatsu Shigemura freebsd_committer freebsd_triage 2003-03-18 17:40:52 UTC
	I reviewd it.  If you OK, I'll commit this after ports freeze.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	2bsd-diff
#	2bsd-diff/Makefile
#	2bsd-diff/distinfo
#	2bsd-diff/files
#	2bsd-diff/files/patch-Makefile
#	2bsd-diff/files/patch-diff.1
#	2bsd-diff/files/patch-diff.c
#	2bsd-diff/files/patch-diff.h
#	2bsd-diff/files/patch-diffdir.c
#	2bsd-diff/files/patch-diffreg.c
#	2bsd-diff/pkg-descr
#	2bsd-diff/pkg-plist
#
echo c - 2bsd-diff
mkdir -p 2bsd-diff > /dev/null 2>&1
echo x - 2bsd-diff/Makefile
sed 's/^X//' >2bsd-diff/Makefile << 'END-of-2bsd-diff/Makefile'
X# New ports collection makefile for:	2bsd-diff
X# Date created:				Mon Mar 17 20:54:03 EST 2003
X# Whom:					risner@stdio.com
X#
X# $FreeBSD$
X#
X
XPORTNAME=	diff
XPORTVERSION=	2.11
XPORTREVISION=	0
XCATEGORIES=	textproc
XMASTER_SITES=	http://www.tribug.org/pub/tuhs/PDP-11/Distributions/ucb/2.11BSD/
XPKGNAMEPREFIX=	2bsd-
XDISTNAME=	file8
X
XMAINTAINER=	risner@stdio.com
XCOMMENT=	2.11BSD diff utility
X
XEXTRACT_AFTER_ARGS=	| ${TAR} -xf - bin/diff man/man1/diff.1
XWRKSRC=		${WRKDIR}/bin/diff
X
XUSE_REINPLACE=	YES
X
XMAN1=		2diff.1
X
Xpost-patch:
X	@${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},g' \
X				${WRKSRC}/../../man/man1/diff.1
X
X.include <bsd.port.mk>
END-of-2bsd-diff/Makefile
echo x - 2bsd-diff/distinfo
sed 's/^X//' >2bsd-diff/distinfo << 'END-of-2bsd-diff/distinfo'
XMD5 (file8.tar.gz) = 77397e6d554361c127592b1fea2d776f
END-of-2bsd-diff/distinfo
echo c - 2bsd-diff/files
mkdir -p 2bsd-diff/files > /dev/null 2>&1
echo x - 2bsd-diff/files/patch-Makefile
sed 's/^X//' >2bsd-diff/files/patch-Makefile << 'END-of-2bsd-diff/files/patch-Makefile'
X--- Makefile.orig	Tue Oct 22 13:29:46 1996
X+++ Makefile	Wed Mar 19 01:29:12 2003
X@@ -1,9 +1,9 @@
X #	@(#)Makefile	4.1.1	1996/10/21
X #
X-DIFF=	/bin/diff
X-DIFFH=	/usr/libexec/diffh
X-PR=	/bin/pr
X-CFLAGS=	-O -DDIFF='"${DIFF}"' -DDIFFH='"${DIFFH}"' -DPR='"${PR}"'
X+DIFF=	${PREFIX}/bin/2diff
X+DIFFH=	${PREFIX}/libexec/2diffh
X+PR=	/usr/bin/pr
X+CFLAGS+=-DDIFF='"${DIFF}"' -DDIFFH='"${DIFFH}"' -DPR='"${PR}"'
X SEPFLAG=-i
X DESTDIR=
X 
X@@ -14,14 +14,15 @@
X all: diff diffh
X 
X diff: ${OBJS}
X-	cc ${CFLAGS} -o diff ${OBJS} ${SEPFLAG} ${LDFLAGS}
X+	${CC} ${CFLAGS} -o diff ${OBJS} ${SEPFLAG} ${LDFLAGS}
X 
X diffh: diffh.o
X-	cc -o diffh diffh.o ${SEPFLAG} ${LDFLAGS}
X+	${CC} ${CFLAGS} -o diffh diffh.o ${SEPFLAG} ${LDFLAGS}
X 
X clean:
X 	rm -f diff diffh ${OBJS} diffh.o
X 
X install: all
X-	install -s diff ${DESTDIR}/bin/diff
X-	install -s diffh ${DESTDIR}/usr/libexec/diffh
X+	${BSD_INSTALL_PROGRAM} diff  ${DIFF}
X+	${BSD_INSTALL_PROGRAM} diffh ${DIFFH}
X+	${BSD_INSTALL_MAN}     ../../man/man1/diff.1 ${MANPREFIX}/man/man1/2diff.1
END-of-2bsd-diff/files/patch-Makefile
echo x - 2bsd-diff/files/patch-diff.1
sed 's/^X//' >2bsd-diff/files/patch-diff.1 << 'END-of-2bsd-diff/files/patch-diff.1'
X--- ../../man/man1/diff.1.orig	Tue Oct 22 14:00:30 1996
X+++ ../../man/man1/diff.1	Wed Mar 19 02:06:08 2003
X@@ -4,12 +4,12 @@
X .\"
X .\"	@(#)diff.1	6.4.1 (2.11BSD) 1996/10/21
X .\"
X-.TH DIFF 1 "October 21, 1996"
X+.TH 2DIFF 1 "October 21, 1996"
X .UC 4
X .SH NAME
X-diff \- differential file and directory comparator
X+2diff \- 2.11BSD differential file and directory comparator
X .SH SYNOPSIS
X-.B diff
X+.B 2diff
X [
X .B \-l
X ] [
X@@ -22,14 +22,14 @@
X .B \-biwt
X ] dir1 dir2
X .br
X-.B diff
X+.B 2diff
X [
X \fB\-cefhn
X ] [
X \fB\-biwt\fR
X ] file1 file2
X .br
X-.B diff
X+.B 2diff
X [
X .BI \-D string
X ] [
X@@ -38,10 +38,10 @@
X file1 file2
X .SH DESCRIPTION
X If both arguments are directories,
X-.I diff
X+.I 2diff
X sorts the contents of the directories by name, and then runs the
X regular file
X-.I diff
X+.I 2diff
X algorithm (described below)
X on text files which are different.
X Binary files which differ,
X@@ -51,7 +51,7 @@
X .TP
X .B \-l
X long output format; each text file
X-.I diff
X+.I 2diff
X is piped through
X .IR pr (1)
X to paginate it,
X@@ -60,26 +60,26 @@
X .TP
X .B \-r
X causes application of
X-.I diff
X+.I 2diff
X recursively to common subdirectories encountered.
X .TP
X .B \-s
X causes 
X-.I diff
X+.I 2diff
X to report files which are the same, which are otherwise not mentioned.
X .TP
X .B \-Sname
X starts a directory
X-.I diff
X+.I 2diff
X in the middle beginning with file
X .I name.
X .PP
X When run on regular files, and when comparing text files which differ
X during directory comparison,
X-.I diff
X+.I 2diff
X tells what lines must be changed in the files to bring them into agreement.
X Except in rare circumstances,
X-.I diff
X+.I 2diff
X finds a smallest sufficient set of file differences.
X If neither
X .I file1
X@@ -163,7 +163,7 @@
X version-to-version
X .I ed
X scripts ($2,$3,...) made by
X-.I diff
X+.I 2diff
X need be on hand.
X A `latest version' appears on
X the standard output.
X@@ -212,7 +212,7 @@
X file to the other are marked in both files with with `! '.
X 
X Changes which lie within <context> lines of each other are grouped
X-together on output.  (This is a change from the previous ``diff -c''
X+together on output.  (This is a change from the previous ``2diff -c''
X but the resulting output is usually much easier to interpret.)
X .TP 9
X .B \-h
X@@ -223,7 +223,7 @@
X .TP
X .B \-Dstring
X causes
X-.I diff
X+.I 2diff
X to create a merged version of
X .I file1
X and
X@@ -260,12 +260,12 @@
X .SH FILES
X /tmp/d?????
X .br
X-/usr/libexec/diffh for 
X+%%PREFIX%%/libexec/2diffh for 
X .B \-h
X .br
X-/bin/diff for directory diffs
X+%%PREFIX%%/bin/2diff for directory diffs
X .br
X-/bin/pr
X+/usr/bin/pr
X .SH "SEE ALSO"
X cmp(1), cc(1), comm(1), ed(1), diff3(1)
X .SH DIAGNOSTICS
X@@ -279,11 +279,11 @@
X When comparing directories with the
X \fB\-b, -w\fP or \fB-i\fP
X options specified,
X-.I diff
X+.I 2diff
X first compares the files ala
X .I cmp,
X and then decides to run the
X-.I diff
X+.I 2diff
X algorithm if they are not equal.
X This may cause a small amount of spurious output if the files
X then turn out to be identical because the only differences are
END-of-2bsd-diff/files/patch-diff.1
echo x - 2bsd-diff/files/patch-diff.c
sed 's/^X//' >2bsd-diff/files/patch-diff.c << 'END-of-2bsd-diff/files/patch-diff.c'
X--- diff.c.orig	Wed Nov 13 05:31:26 1991
X+++ diff.c	Wed Mar 19 01:31:23 2003
X@@ -176,9 +176,10 @@
X 	return (a > b ? a : b);
X }
X 
X+sig_t
X done()
X {
X-	if (tempfile)
X+	if (tempfile[0])
X 		unlink(tempfile);
X 	exit(status);
X }
X@@ -198,7 +199,6 @@
X char *p;
X {
X 	register char *q;
X-	char *realloc();
X 
X 	if ((q = realloc(p, (unsigned)n)) == NULL)
X 		noroom();
END-of-2bsd-diff/files/patch-diff.c
echo x - 2bsd-diff/files/patch-diff.h
sed 's/^X//' >2bsd-diff/files/patch-diff.h << 'END-of-2bsd-diff/files/patch-diff.h'
X--- diff.h.orig	Thu Aug 29 06:44:35 1985
X+++ diff.h	Wed Mar 19 01:35:49 2003
X@@ -5,10 +5,11 @@
X  */
X 
X #include <stdio.h>
X+#include <stdlib.h>
X #include <ctype.h>
X #include <sys/param.h>
X #include <sys/stat.h>
X-#include <sys/dir.h>
X+#include <dirent.h>
X #include <signal.h>
X 
X /*
X@@ -61,7 +62,7 @@
X  */
X int	status;
X int	anychange;
X-char	*tempfile;		/* used when comparing against std input */
X+char	tempfile[MAXPATHLEN];	/* used when comparing against std input */
X 
X /*
X  * Variables for diffdir.
X@@ -77,9 +78,9 @@
X char	*file1, *file2, *efile1, *efile2;
X struct	stat stb1, stb2;
X 
X-char	*malloc(), *talloc(), *ralloc();
X+char	*talloc(), *ralloc();
X char	*savestr(), *splice(), *splicen();
X-char	*mktemp(), *copytemp(), *rindex();
X-int	done();
X+char	*copytemp();
X+sig_t	done();
X 
X extern	char diffh[], diff[], pr[];
END-of-2bsd-diff/files/patch-diff.h
echo x - 2bsd-diff/files/patch-diffdir.c
sed 's/^X//' >2bsd-diff/files/patch-diffdir.c << 'END-of-2bsd-diff/files/patch-diffdir.c'
X--- diffdir.c.orig	Wed Nov 13 05:31:29 1991
X+++ diffdir.c	Wed Mar 19 01:36:38 2003
X@@ -172,7 +172,7 @@
X 	char *cp;
X {
X 	register struct dir *dp = 0, *ep;
X-	register struct direct *rp;
X+	register struct dirent *rp;
X 	register int nitems, n;
X 	DIR *dirp;
X 
END-of-2bsd-diff/files/patch-diffdir.c
echo x - 2bsd-diff/files/patch-diffreg.c
sed 's/^X//' >2bsd-diff/files/patch-diffreg.c << 'END-of-2bsd-diff/files/patch-diffreg.c'
X--- diffreg.c.orig	Tue Jan 11 14:39:33 1994
X+++ diffreg.c	Wed Mar 19 01:38:48 2003
X@@ -270,12 +270,12 @@
X 	char buf[BUFSIZ];
X 	register int i, f;
X 
X-	signal(SIGHUP,done);
X-	signal(SIGINT,done);
X-	signal(SIGPIPE,done);
X-	signal(SIGTERM,done);
X-	tempfile = mktemp("/tmp/dXXXXX");
X-	f = creat(tempfile,0600);
X+	signal(SIGHUP, (sig_t) done);
X+	signal(SIGINT, (sig_t) done);
X+	signal(SIGPIPE, (sig_t) done);
X+	signal(SIGTERM, (sig_t) done);
X+	strcpy(tempfile, "/tmp/dXXXXX");
X+	f = mkstemp(tempfile);
X 	if (f < 0) {
X 		fprintf(stderr, "diff: ");
X 		perror(tempfile);
END-of-2bsd-diff/files/patch-diffreg.c
echo x - 2bsd-diff/pkg-descr
sed 's/^X//' >2bsd-diff/pkg-descr << 'END-of-2bsd-diff/pkg-descr'
XThis is the original diff program from 2.11BSD.  It works better
Xwith very large files on systems with datasize limits.
X
XDefault FreeBSD limits datasize to 524288 kbytes.  This means that
XGNU diff processes that require more than this much ram will fail.
XThe 2.11BSD diff did not load the files in core and could operate
Xon considerably less ram.
END-of-2bsd-diff/pkg-descr
echo x - 2bsd-diff/pkg-plist
sed 's/^X//' >2bsd-diff/pkg-plist << 'END-of-2bsd-diff/pkg-plist'
Xbin/2diff
Xlibexec/2diffh
END-of-2bsd-diff/pkg-plist
exit
Comment 4 Norikatsu Shigemura freebsd_committer freebsd_triage 2003-03-23 07:24:59 UTC
State Changed
From-To: analyzed->closed

Committed, thanks!