SHA256
1
0
forked from pool/fdupes

Accepting request 33323 from Base:System

Copy from Base:System/fdupes based on submit request 33323 from user coolo

OBS-URL: https://build.opensuse.org/request/show/33323
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/fdupes?expand=0&rev=8
This commit is contained in:
OBS User autobuild 2010-02-24 01:04:01 +00:00 committed by Git OBS Bridge
parent ae2dbe92e6
commit 939b99a27e
4 changed files with 79 additions and 2 deletions

20
fdupes-endianness.patch Normal file
View File

@ -0,0 +1,20 @@
Index: fdupes-1.40/md5/md5.c
===================================================================
--- fdupes-1.40.orig/md5/md5.c 2010-02-15 15:36:58.000000000 +0100
+++ fdupes-1.40/md5/md5.c 2010-02-15 16:01:34.350140290 +0100
@@ -41,6 +41,15 @@
#include "md5.h"
#include <string.h>
+/* endianness check using glibc endian.h */
+#include <endian.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define ARCH_IS_BIG_ENDIAN 1
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
+# define ARCH_IS_BIG_ENDIAN 0
+#endif
+
#ifdef TEST
/*
* Compile with -DTEST to create a self-contained executable test program.

44
fdupes-speedup.patch Normal file
View File

@ -0,0 +1,44 @@
Index: fdupes.c
===================================================================
--- fdupes.c.orig 2010-02-15 15:36:58.000000000 +0100
+++ fdupes.c 2010-02-15 15:38:11.091108207 +0100
@@ -259,7 +259,7 @@
}
while (fsize > 0) {
- toread = (fsize % CHUNK_SIZE) ? (fsize % CHUNK_SIZE) : CHUNK_SIZE;
+ toread = (fsize >= CHUNK_SIZE) ? CHUNK_SIZE : fsize;
if (fread(chunk, toread, 1, file) != 1) {
errormsg("error reading from file %s\n", filename);
return NULL;
@@ -561,22 +561,23 @@
int confirmmatch(FILE *file1, FILE *file2)
{
- unsigned char c1;
- unsigned char c2;
+ unsigned char c1[8192];
+ unsigned char c2[8192];
size_t r1;
size_t r2;
+ int res;
fseek(file1, 0, SEEK_SET);
fseek(file2, 0, SEEK_SET);
do {
- r1 = fread(&c1, sizeof(c1), 1, file1);
- r2 = fread(&c2, sizeof(c2), 1, file2);
+ r1 = fread(c1, sizeof(unsigned char), sizeof(c1), file1);
+ r2 = fread(c2, sizeof(unsigned char), sizeof(c2), file2);
- if (c1 != c2) return 0; /* file contents are different */
+ if (r1 != r2) return 0; /* file lengths are different */
+ res = memcmp(c1, c2, r1);
+ if ( 0 != res ) return 0; /* file contents are different */
} while (r1 && r2);
-
- if (r1 != r2) return 0; /* file lengths are different */
return 1;
}

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Feb 15 15:43:34 UTC 2010 - mvyskocil@suse.cz
- fix bnc#406825: speedup fdupes
* fdupes-speedup.patch fixes some performance gaps in code
* fdupes-endianness.patch speedups the built in md5 on little endian machines
-------------------------------------------------------------------
Wed Aug 26 12:53:54 CEST 2009 - mls@suse.de

View File

@ -1,7 +1,7 @@
#
# spec file for package fdupes (Version 1.40)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -23,12 +23,16 @@ Url: http://premium.caribe.net/~adrian2/fdupes.html
Group: Productivity/Archiving/Compression
Summary: Identifying or deleting duplicate files
Version: 1.40
Release: 110
Release: 111
License: MIT License (or similar)
Source0: %name-%{version}.tar.bz2
Source1: macros.fdupes
Patch0: %name.diff
Patch1: fdupes-sort-output.diff
#PATCH-FIX-OPENSUSE - bnc#406825
Patch2: fdupes-speedup.patch
#PATCH-FIX-OPENSUSE - bnc#406825
Patch3: fdupes-endianness.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -45,6 +49,8 @@ Authors:
%setup -q
%patch0
%patch1
%patch2 -p0 -b .speedup
%patch3 -p1 -b .endianness
%build
make