From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Nov 16 13:30:04 2009 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 753921065670 for ; Mon, 16 Nov 2009 13:30:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 48CBF8FC1D for ; Mon, 16 Nov 2009 13:30:04 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nAGDU4kl036249 for ; Mon, 16 Nov 2009 13:30:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nAGDU4ZW036246; Mon, 16 Nov 2009 13:30:04 GMT (envelope-from gnats) Resent-Date: Mon, 16 Nov 2009 13:30:04 GMT Resent-Message-Id: <200911161330.nAGDU4ZW036246@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alex de Kruijff Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 183F01065670 for ; Mon, 16 Nov 2009 13:21:05 +0000 (UTC) (envelope-from akruijff@www.kruijff.org) Received: from rotring.dds.nl (rotring.dds.nl [85.17.178.138]) by mx1.freebsd.org (Postfix) with ESMTP id 97D978FC24 for ; Mon, 16 Nov 2009 13:21:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by rotring.dds.nl (Postfix) with ESMTP id 7930D5838D for ; Mon, 16 Nov 2009 14:21:03 +0100 (CET) Received: from www.kruijff.org (195-241-9-169.adsl.dds.nl [195.241.9.169]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by rotring.dds.nl (Postfix) with ESMTP id E29D558333; Mon, 16 Nov 2009 14:20:53 +0100 (CET) Received: from Server1.lan (localhost [127.0.0.1]) by www.kruijff.org (8.13.6/8.13.6) with ESMTP id nAGDKqFx023133; Mon, 16 Nov 2009 14:20:52 +0100 (CET) (envelope-from akruijff@Server1.lan) Received: (from root@localhost) by Server1.lan (8.13.6/8.13.6/Submit) id nAGDKqhS023132; Mon, 16 Nov 2009 14:20:52 +0100 (CET) (envelope-from akruijff) Message-Id: <200911161320.nAGDKqhS023132@Server1.lan> Date: Mon, 16 Nov 2009 14:20:52 +0100 (CET) From: Alex de Kruijff To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Alex de Kruijff Subject: ports/140601: [MAINTAINER] sysutils/samesame patches for 1.6 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Alex de Kruijff List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 13:30:04 -0000 >Number: 140601 >Category: ports >Synopsis: [MAINTAINER] sysutils/samesame patches for 1.6 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Mon Nov 16 13:30:03 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Alex de Kruijff >Release: >Organization: >Environment: >Description: This included patches for version 1.6. PR ports/140587 includes the update to 1.6 >How-To-Repeat: >Fix: --- patches.diff begins here --- diff -Nru port.orig/files/patch-src-configure.h port/files/patch-src-configure.h --- port.orig/files/patch-src-configure.h Thu Jan 1 01:00:00 1970 +++ port/files/patch-src-configure.h Mon Nov 16 13:58:32 2009 @@ -0,0 +1,11 @@ +--- src/configure.h Sun Nov 15 02:23:34 2009 ++++ src/configure.h Mon Nov 16 02:34:14 2009 +@@ -9,7 +9,7 @@ + /* If READ_ONLY_ONCES is defined the code will read each file only ones. + * If READ_ONLY_ONCES is not defined the code will use less memory. + */ +-#ifdef LOW_MEMORY_PROFILE ++#ifndef LOW_MEMORY_PROFILE + #define READ_ONLY_ONCES + #endif // LOW_MEMORY_PROFILE + diff -Nru port.orig/files/patch-src-main.cpp port/files/patch-src-main.cpp --- port.orig/files/patch-src-main.cpp Thu Jan 1 01:00:00 1970 +++ port/files/patch-src-main.cpp Mon Nov 16 14:13:03 2009 @@ -0,0 +1,17 @@ +--- src/main.cpp Sun Nov 15 00:06:17 2009 ++++ src/main.cpp Mon Nov 16 14:09:26 2009 +@@ -375,8 +375,12 @@ + size_t oldMinSize = minSize; + Holder holder; + +- // Reserve 1M memory for later (better memory management) +- char *dummy = new char[1048576]; ++ // Reserve memory for later (better memory management) ++#ifdef LOW_MEMORY_PROFILE ++ char *dummy = new char[1048576]; // 1 MB ++#else // LOW_MEMORY_PROFILE ++ char *dummy = new char[5 * 1048576]; // 5 MB ++#endif // LOW_MEMORY_PROFILE + + // Stage1 - reading the input + if (S_VERBOSE_LEVEL2(flags)) diff -Nru port.orig/files/patch-src-matchmatrix.cpp port/files/patch-src-matchmatrix.cpp --- port.orig/files/patch-src-matchmatrix.cpp Thu Jan 1 01:00:00 1970 +++ port/files/patch-src-matchmatrix.cpp Mon Nov 16 13:54:52 2009 @@ -0,0 +1,94 @@ +--- src/matchmatrix.cpp Sat Nov 14 04:27:23 2009 ++++ src/matchmatrix.cpp Mon Nov 16 02:34:10 2009 +@@ -98,6 +98,50 @@ + return arr[i][j - i]; + } + ++size_t MatchMatrix::getEqual(size_t i) const throw() ++{ ++ if (i > n) ++ { ++ fprintf(stderr, "%s:%u i (%u) must be smaller then %u\n", ++ __FILE__, __LINE__, i, n); ++ exit(EXIT_FAILURE); ++ } ++ return equal[i]; ++} ++ ++int MatchMatrix::getFd(size_t i) const throw() ++{ ++ if (i > n) ++ { ++ fprintf(stderr, "%s:%u i (%u) must be smaller then %u\n", ++ __FILE__, __LINE__, i, n); ++ exit(EXIT_FAILURE); ++ } ++ return fd[i]; ++} ++ ++void *MatchMatrix::getMm(size_t i) const throw() ++{ ++ if (i > n) ++ { ++ fprintf(stderr, "%s:%u i (%u) must be smaller then %u\n", ++ __FILE__, __LINE__, i, n); ++ exit(EXIT_FAILURE); ++ } ++ return mm[i]; ++} ++ ++void MatchMatrix::increaseEqual(size_t i) const throw() ++{ ++ if (i > n) ++ { ++ fprintf(stderr, "%s:%u i (%u) must be smaller then %u\n", ++ __FILE__, __LINE__, i, n); ++ exit(EXIT_FAILURE); ++ } ++ ++equal[i]; ++} ++ + void MatchMatrix::set(size_t i, size_t j, int result) throw() + { + if (i > n) +@@ -114,6 +158,40 @@ + } + arr[i][j - i] = result; + } ++ ++void MatchMatrix::setEqual(size_t i, size_t x) throw() ++{ ++ if (i > n) ++ { ++ fprintf(stderr, "%s:%u i (%u) must be smaller then %u\n", ++ __FILE__, __LINE__, i, n); ++ exit(EXIT_FAILURE); ++ } ++ equal[i] = x; ++} ++ ++int MatchMatrix::setFd(size_t i, int x) throw() ++{ ++ if (i > n) ++ { ++ fprintf(stderr, "%s:%u i (%u) must be smaller then %u\n", ++ __FILE__, __LINE__, i, n); ++ exit(EXIT_FAILURE); ++ } ++ return fd[i] = x; ++} ++ ++void MatchMatrix::setMm(size_t i, void *x) throw() ++{ ++ if (i > n) ++ { ++ fprintf(stderr, "%s:%u i (%u) must be smaller then %u\n", ++ __FILE__, __LINE__, i, n); ++ exit(EXIT_FAILURE); ++ } ++ mm[i] = x; ++} ++ + #endif // DEBUG + + void MatchMatrix::reset(size_t n) throw() diff -Nru port.orig/files/patch-src-matchmatrix.h port/files/patch-src-matchmatrix.h --- port.orig/files/patch-src-matchmatrix.h Thu Jan 1 01:00:00 1970 +++ port/files/patch-src-matchmatrix.h Mon Nov 16 13:53:45 2009 @@ -0,0 +1,59 @@ +--- src/matchmatrix.h Fri Nov 13 18:44:01 2009 ++++ src/matchmatrix.h Mon Nov 16 02:30:30 2009 +@@ -28,12 +28,11 @@ + { + size_t n; + signed char **arr; +- +-public: + size_t *equal; + int *fd; + void **mm; +- ++ ++public: + /** + * Creates a MatchMatrix that is able to store the match results of + * n elements. +@@ -46,12 +45,41 @@ + int get(size_t i, size_t j) const throw() + { return arr[i][j - i]; } + ++ size_t getEqual(size_t i) const throw() ++ { return equal[i]; } ++ ++ int getFd(size_t i) const throw() ++ { return fd[i]; } ++ ++ void *getMm(size_t i) const throw() ++ { return mm[i]; } ++ ++ void increaseEqual(size_t i) const throw() ++ { ++equal[i]; } ++ + void set(size_t i, size_t j, int result) throw() + { arr[i][j - i] = result; } + ++ void setEqual(size_t i, size_t x) throw() ++ { equal[i] = x; } ++ ++ int setFd(size_t i, int x) throw() ++ { return fd[i] = x; } ++ ++ void setMm(size_t i, void *x) throw() ++ { mm[i] = x; } + #else // DEBUG + int get(size_t i, size_t j) const throw(); ++ size_t getEqual(size_t i) const throw(); ++ int getFd(size_t i) const throw(); ++ void *getMm(size_t i) const throw(); ++ ++ void increaseEqual(size_t i) const throw(); ++ + void set(size_t i, size_t j, int result) throw(); ++ void setEqual(size_t i, size_t x) throw(); ++ int setFd(size_t i, int x) throw(); ++ void setMm(size_t i, void *x) throw(); + #endif // DEBUG + + /** diff -Nru port.orig/files/patch-src-sizegroup.cpp port/files/patch-src-sizegroup.cpp --- port.orig/files/patch-src-sizegroup.cpp Thu Jan 1 01:00:00 1970 +++ port/files/patch-src-sizegroup.cpp Mon Nov 16 13:51:30 2009 @@ -0,0 +1,168 @@ +--- src/sizegroup.cpp Sat Nov 14 23:34:59 2009 ++++ src/sizegroup.cpp Mon Nov 16 02:29:51 2009 +@@ -36,7 +36,7 @@ + static struct SameGroupBuffer + { + size_t n, size, pagesize; +- char *buffer; ++ char *buf; + + SameGroupBuffer(); + ~SameGroupBuffer(); +@@ -53,12 +53,12 @@ + #else // LOW_MEMORY_PROFILE + size = 1 << 24; + #endif // LOW_MEMORY_PROFILE +- buffer = new char[size]; ++ buf = new char[size]; + } + + SameGroupBuffer::~SameGroupBuffer() + { +- delete buffer; ++ delete buf; + } + + void SameGroupBuffer::setN(size_t n) +@@ -77,7 +77,7 @@ + exit(EXIT_FAILURE); + } + #endif // DEBUG +- return buffer + index * pagesize; ++ return buf + index * pagesize; + } + #endif // READ_ONLY_ONCES + +@@ -136,7 +136,7 @@ + __FILE__, __LINE__); + exit(EXIT_FAILURE); + } +-#endif ++#endif // DEBUG + for (size_t i = 0; i < n; ++i) + hash[i]->sort(compareFilename); + #ifdef DEBUG +@@ -147,7 +147,7 @@ + __FILE__, __LINE__); + exit(EXIT_FAILURE); + } +-#endif ++#endif // DEBUG + hash.sort(compare); + } + +@@ -188,8 +188,6 @@ + int (&f)(const SizeGroup &, const FileGroup &, const Filename &, + const FileGroup &, const Filename &, int), + size_t fileSize, size_t &nIdenticals, +-#ifndef READ_ONLY_ONCES +-#endif // READ_ONLY_ONCES + int flags, size_t &i, size_t &j, size_t &n, + FileGroup &left, FileGroup &right) + { +@@ -213,7 +211,7 @@ + + #ifndef READ_ONLY_ONCES + // Do a physically check if we couldn't use logic +- if (!(result)) ++ if (!result) + { + result = left.fcmp(right, fileSize); + if (result > 0 && result & FILE_IDENTICAL) +@@ -306,10 +304,6 @@ + * If READ_ONLY_ONCES is not defined the code will use less memory. + */ + #ifdef READ_ONLY_ONCES +- size_t *equal = match.equal; +- int *fd = match.fd; +- void **mm = match.mm; +- + // Open files + buffer.setN(n); + for (size_t i = 0; i < n; ++i) +@@ -333,12 +327,15 @@ + if (preCheck != NULL && preCheck(*this, *hash[i], *hash[j])) + { + match.set(i, j, FILE_DIFFERENT); +- ++equal[i], ++equal[j]; ++ match.increaseEqual(i); ++ match.increaseEqual(j); + } + + // Open files +- if (equal[i] < n -1 && (fd[i] = hash[i]->open(O_RDONLY)) < 0) ++ if (match.getEqual(i) < n -1 && ++ match.setFd(i, hash[i]->open(O_RDONLY)) < 0) + match.set(i, n-1, FILE_OPEN1_ERROR); ++ + } + + // Compare the files +@@ -350,50 +347,51 @@ + + // read pages + for (size_t i = 0; i < n; ++i) +- if (match.get(i, n-1) >= 0 && equal[i] < n - 1) ++ if (match.get(i, n-1) >= 0 && match.getEqual(i) < n - 1) + if (USE_MMAP(fileSize)) + { +- mm[i] = mmap(0, size, PROT_READ, MAP_SHARED, fd[i], offset); +- mm[i] = mmap(0, size, PROT_READ, MAP_SHARED, fd[i], offset); +- if (mm[i] == MAP_FAILED) ++ void *mm = mmap(0, size, PROT_READ, MAP_SHARED, match.getFd(i), offset); ++ match.setMm(i, mm); ++ if (mm == MAP_FAILED) + match.set(i, n-1, FILE_READ1_ERROR); +- posix_madvise(mm[i], size, POSIX_MADV_WILLNEED); ++ posix_madvise(mm, size, POSIX_MADV_WILLNEED); + } +- else if (read(fd[i], buffer[i], size) < 0) ++ else if (read(match.getFd(i), buffer[i], size) < 0) + match.set(i, n-1, FILE_READ1_ERROR); + + // compare pages + for (size_t i = 0; i < n; ++i) + { +- if (equal[i] == n - 1 || match.get(i, n-1) < 0) ++ if (match.getEqual(i) == n - 1 || match.get(i, n-1) < 0) + continue; + for (size_t j = i + 1; j < n; ++j) + if (match.get(i, j) == FILE_DIFFERENT) + continue; + else if (memcmp( +- USE_MMAP(fileSize) ? mm[i] : buffer[i], +- USE_MMAP(fileSize) ? mm[j] : buffer[j], ++ USE_MMAP(fileSize) ? match.getMm(i) : buffer[i], ++ USE_MMAP(fileSize) ? match.getMm(j) : buffer[j], + size) != 0) + { + match.set(i, j, FILE_DIFFERENT); +- ++equal[i], ++equal[j]; ++ match.increaseEqual(i); ++ match.increaseEqual(j); + } + } + + // unread? + for (size_t i = 0; i < n; ++i) +- if (mm[i] != NULL) ++ if (match.getMm(i) != NULL) + { +- posix_madvise(mm[i], size, POSIX_MADV_NORMAL); +- munmap(mm[i], size); +- mm[i] = NULL; ++ posix_madvise(match.getMm(i), size, POSIX_MADV_NORMAL); ++ munmap(match.getMm(i), size); ++ match.setMm(i, NULL); + } + } + + // close files + for (size_t i = 0; i < n; ++i) +- if (fd[i] != 0) +- close(fd[i]); ++ if (!match.getFd(i) != 0) ++ close(match.getFd(i)); + + // mark identicals + for (size_t i = 0; i < n; ++i) --- patches.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: