update to 2.1.2 [release 2.1.2-1mamba;Wed Sep 09 2020]

This commit is contained in:
Silvan Calarco 2024-01-05 22:14:28 +01:00
parent 2a4cd36f2f
commit ff24e5e570
5 changed files with 23 additions and 194 deletions

View File

@ -1,20 +0,0 @@
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.

View File

@ -1,64 +0,0 @@
--- fdupes.c
+++ fdupes.c
@@ -581,24 +581,45 @@
return 1;
}
+/* from qsort man page */
+static int
+cmpstringp(const void *p1, const void *p2)
+{
+ /* The actual arguments to this function are "pointers to
+ pointers to char", but strcmp(3) arguments are "pointers
+ to char", hence the following cast plus dereference */
+
+ return strcmp(* (char * const *) p1, * (char * const *) p2);
+}
+
void printmatches(file_t *files)
{
file_t *tmpfile;
while (files != NULL) {
if (files->hasdupes) {
+ char **names = (char**)malloc(sizeof(char*)*(files->hasdupes+1));
+ int count = 0, index;
+ names[count++] = files->d_name;
+ tmpfile = files->duplicates;
+ while (tmpfile != NULL) {
+ names[count++] = tmpfile->d_name;
+ tmpfile = tmpfile->duplicates;
+ }
+ qsort(names, count, sizeof(char *), cmpstringp);
+
if (!ISFLAG(flags, F_OMITFIRST)) {
if (ISFLAG(flags, F_SHOWSIZE)) printf("%ld byte%seach:\n", files->size,
(files->size != 1) ? "s " : " ");
- if (ISFLAG(flags, F_DSAMELINE)) escapefilename("\\ ", &files->d_name);
- printf("%s%c", files->d_name, ISFLAG(flags, F_DSAMELINE)?' ':'\n');
+ if (ISFLAG(flags, F_DSAMELINE)) escapefilename("\\ ", &names[0]);
+ printf("%s%c", names[0], ISFLAG(flags, F_DSAMELINE)?' ':'\n');
}
- tmpfile = files->duplicates;
- while (tmpfile != NULL) {
- if (ISFLAG(flags, F_DSAMELINE)) escapefilename("\\ ", &tmpfile->d_name);
- printf("%s%c", tmpfile->d_name, ISFLAG(flags, F_DSAMELINE)?' ':'\n');
- tmpfile = tmpfile->duplicates;
+ for (index = 1; index < count; index++) {
+ if (ISFLAG(flags, F_DSAMELINE)) escapefilename("\\ ", &names[index]);
+ printf("%s%c", names[index], ISFLAG(flags, F_DSAMELINE)?' ':'\n');
+
}
+ free(names);
printf("\n");
}
@@ -869,7 +890,7 @@
}
if (confirmmatch(file1, file2)) {
- match->hasdupes = 1;
+ match->hasdupes++;
curfile->duplicates = match->duplicates;
match->duplicates = curfile;
}

View File

@ -1,44 +0,0 @@
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,45 +0,0 @@
--- Makefile
+++ Makefile
@@ -2,13 +2,13 @@
# INSTALLDIR indicates directory where program is to be installed.
# Suggested values are "/usr/local/bin" or "/usr/bin".
#
-INSTALLDIR = /usr/local/bin
+INSTALLDIR = /usr/bin
#
# MANPAGEDIR indicates directory where the fdupes man page is to be
# installed. Suggested values are "/usr/local/man" or "/usr/man".
#
-MANPAGEDIR = /usr/local/man
+MANPAGEDIR = /usr/share/man
#
# VERSION determines the program's version number.
@@ -35,7 +35,7 @@
#####################################################################
fdupes: fdupes.c md5/md5.c
- gcc fdupes.c md5/md5.c -Wall -o fdupes -DVERSION=\"$(VERSION)\" $(EXTERNAL_MD5) $(EXPERIMENTAL_RBTREE)
+ gcc fdupes.c md5/md5.c $(RPM_OPT_FLAGS) -o fdupes -DVERSION=\"$(VERSION)\" $(EXTERNAL_MD5) $(EXPERIMENTAL_RBTREE)
install: fdupes
cp fdupes $(INSTALLDIR)
--- md5/md5.c
+++ md5/md5.c
@@ -39,6 +39,7 @@
*/
#include "md5.h"
+#include <string.h>
#ifdef TEST
/*
@@ -46,7 +47,6 @@
* The test program should print out the same values as given in section
* A.5 of RFC 1321, reproduced below.
*/
-#include <string.h>
main()
{
static const char *const test[7] = {

View File

@ -1,40 +1,36 @@
Name: fdupes
Version: 1.51
Version: 2.1.2
Release: 1mamba
Summary: A program for identifying or deleting duplicate files residing within specified directories.identifying or deleting duplicate files
Summary: A program for identifying or deleting duplicate files residing within specified directories
Group: Applications/File
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://code.google.com/p/fdupes/
Source0: https://fdupes.googlecode.com/files/fdupes-%{version}.tar.gz
URL: https://github.com/adrianlopezroche/fdupes
Source0: https://github.com/adrianlopezroche/fdupes.git/v%{version}/fdupes-%{version}.tar.bz2
# from opensuse
Source1: macros.fdupes
Patch0: fdupes.diff
Patch1: fdupes-sort-output.diff
Patch2: fdupes-speedup.patch
Patch3: fdupes-endianness.patch
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: ldconfig
BuildRequires: libncurses-devel
BuildRequires: libpcre2-devel
## AUTOBUILDREQ-END
License: MIT
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
FDUPES is a program for identifying or deleting duplicate files residing within specified directories.
%debug_package
%prep
%setup -q
#%patch0
#%patch1
#%patch2 -p0 -b .speedup
%patch3 -p1 -b .endianness
autoreconf -f -i
%build
%make
%configure
%check
./fdupes testdir
./fdupes --omitfirst testdir
./fdupes --recurse testdir
./fdupes --size testdir
%make
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
@ -54,10 +50,16 @@ install -pm 644 fdupes.1 %{buildroot}%{_mandir}/man1/
%defattr(-,root,root)
%{_sysconfdir}/rpm/macros.fdupes
%{_bindir}/fdupes
%{_mandir}/man1/fdupes.1.gz
%doc CHANGES README TODO
%{_mandir}/man1/fdupes.1*
%doc README
%changelog
* Wed Sep 09 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 2.1.2-1mamba
- update to 2.1.2
* Fri Mar 27 2020 Ercole 'ercolinux' Carpanetto <ercole69@gmail.com> 2.0.0-1mamba
- update to 2.0.0
* Mon May 13 2013 Automatic Build System <autodist@mambasoft.it> 1.51-1mamba
- update to 1.51