forked from pool/fdupes
osc rm fdupes-check-permissions.patch fdupes-endianness.patch fdupes-speedup.patch
OBS-URL: https://build.opensuse.org/package/show/utilities/fdupes?expand=0&rev=7
This commit is contained in:
parent
ebd601a9d7
commit
296a788922
@ -1,103 +0,0 @@
|
|||||||
Index: fdupes-1.50-PR2/fdupes.c
|
|
||||||
===================================================================
|
|
||||||
--- fdupes-1.50-PR2.orig/fdupes.c 2012-10-12 12:10:19.403690606 +0200
|
|
||||||
+++ fdupes-1.50-PR2/fdupes.c 2012-10-12 12:11:13.551605189 +0200
|
|
||||||
@@ -51,6 +51,7 @@
|
|
||||||
#define F_RECURSEAFTER 0x0200
|
|
||||||
#define F_NOPROMPT 0x0400
|
|
||||||
#define F_SUMMARIZEMATCHES 0x0800
|
|
||||||
+#define F_PERMISSIONS 0x1000
|
|
||||||
|
|
||||||
char *program_name;
|
|
||||||
|
|
||||||
@@ -467,6 +468,19 @@
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+int same_permissions(char* name1, char* name2)
|
|
||||||
+{
|
|
||||||
+ struct stat s1, s2;
|
|
||||||
+
|
|
||||||
+ if (stat(name1, &s1) != 0) return -1;
|
|
||||||
+ if (stat(name2, &s2) != 0) return -1;
|
|
||||||
+
|
|
||||||
+ return (s1.st_mode == s2.st_mode &&
|
|
||||||
+ s1.st_uid == s2.st_uid &&
|
|
||||||
+ s1.st_gid == s2.st_gid);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
file_t **checkmatch(filetree_t **root, filetree_t *checktree, file_t *file)
|
|
||||||
{
|
|
||||||
int cmpresult;
|
|
||||||
@@ -489,6 +503,10 @@
|
|
||||||
cmpresult = -1;
|
|
||||||
else
|
|
||||||
if (fsize > checktree->file->size) cmpresult = 1;
|
|
||||||
+ else
|
|
||||||
+ if (ISFLAG(flags, F_PERMISSIONS) &&
|
|
||||||
+ !same_permissions(file->d_name, checktree->file->d_name))
|
|
||||||
+ cmpresult = -1;
|
|
||||||
else {
|
|
||||||
if (checktree->file->crcpartial == NULL) {
|
|
||||||
crcsignature = getcrcpartialsignature(checktree->file->d_name);
|
|
||||||
@@ -577,8 +595,8 @@
|
|
||||||
|
|
||||||
int confirmmatch(FILE *file1, FILE *file2)
|
|
||||||
{
|
|
||||||
- unsigned char c1[8192] = 0;
|
|
||||||
- unsigned char c2[8192] = 0;
|
|
||||||
+ unsigned char c1[8192];
|
|
||||||
+ unsigned char c2[8192];
|
|
||||||
size_t r1;
|
|
||||||
size_t r2;
|
|
||||||
|
|
||||||
@@ -955,6 +973,7 @@
|
|
||||||
printf(" -N --noprompt \ttogether with --delete, preserve the first file in\n");
|
|
||||||
printf(" \teach set of duplicates and delete the rest without\n");
|
|
||||||
printf(" \twithout prompting the user\n");
|
|
||||||
+ printf(" -p --permissions \tdon't consider files with different owner/group or permission bits as duplicates\n");
|
|
||||||
printf(" -v --version \tdisplay fdupes version\n");
|
|
||||||
printf(" -h --help \tdisplay this help message\n\n");
|
|
||||||
#ifdef OMIT_GETOPT_LONG
|
|
||||||
@@ -997,6 +1016,7 @@
|
|
||||||
{ "noprompt", 0, 0, 'N' },
|
|
||||||
{ "summarize", 0, 0, 'm'},
|
|
||||||
{ "summary", 0, 0, 'm' },
|
|
||||||
+ { "permissions", 0, 0, 'p' },
|
|
||||||
{ 0, 0, 0, 0 }
|
|
||||||
};
|
|
||||||
#define GETOPT getopt_long
|
|
||||||
@@ -1008,7 +1028,7 @@
|
|
||||||
|
|
||||||
oldargv = cloneargs(argc, argv);
|
|
||||||
|
|
||||||
- while ((opt = GETOPT(argc, argv, "frRq1Ss::HlndvhNm"
|
|
||||||
+ while ((opt = GETOPT(argc, argv, "frRq1Ss::HlndvhNmp"
|
|
||||||
#ifndef OMIT_GETOPT_LONG
|
|
||||||
, long_options, NULL
|
|
||||||
#endif
|
|
||||||
@@ -1056,6 +1076,9 @@
|
|
||||||
case 'm':
|
|
||||||
SETFLAG(flags, F_SUMMARIZEMATCHES);
|
|
||||||
break;
|
|
||||||
+ case 'p':
|
|
||||||
+ SETFLAG(flags, F_PERMISSIONS);
|
|
||||||
+ break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
fprintf(stderr, "Try `fdupes --help' for more information.\n");
|
|
||||||
Index: fdupes-1.50-PR2/fdupes.1
|
|
||||||
===================================================================
|
|
||||||
--- fdupes-1.50-PR2.orig/fdupes.1 2005-09-10 03:50:15.000000000 +0200
|
|
||||||
+++ fdupes-1.50-PR2/fdupes.1 2012-10-12 12:10:19.429691524 +0200
|
|
||||||
@@ -56,6 +56,9 @@
|
|
||||||
when used together with --delete, preserve the first file in each
|
|
||||||
set of duplicates and delete the others without prompting the user
|
|
||||||
.TP
|
|
||||||
+.B -p --permissions
|
|
||||||
+don't consider files with different owner/group or permission bits as duplicates
|
|
||||||
+.TP
|
|
||||||
.B -v --version
|
|
||||||
display fdupes version
|
|
||||||
.TP
|
|
@ -1,20 +0,0 @@
|
|||||||
Index: fdupes-1.50-PR2/md5/md5.c
|
|
||||||
===================================================================
|
|
||||||
--- fdupes-1.50-PR2.orig/md5/md5.c 2002-05-31 09:44:26.000000000 +0200
|
|
||||||
+++ fdupes-1.50-PR2/md5/md5.c 2012-10-12 11:59:25.961614072 +0200
|
|
||||||
@@ -45,6 +45,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.
|
|
@ -1,44 +0,0 @@
|
|||||||
Index: fdupes.c
|
|
||||||
===================================================================
|
|
||||||
--- fdupes.c.orig 2007-04-08 04:53:24.000000000 +0200
|
|
||||||
+++ fdupes.c 2012-10-12 11:58:13.255046246 +0200
|
|
||||||
@@ -356,7 +356,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);
|
|
||||||
fclose(file); // bugfix
|
|
||||||
@@ -577,8 +577,8 @@
|
|
||||||
|
|
||||||
int confirmmatch(FILE *file1, FILE *file2)
|
|
||||||
{
|
|
||||||
- unsigned char c1 = 0;
|
|
||||||
- unsigned char c2 = 0;
|
|
||||||
+ unsigned char c1[8192] = 0;
|
|
||||||
+ unsigned char c2[8192] = 0;
|
|
||||||
size_t r1;
|
|
||||||
size_t r2;
|
|
||||||
|
|
||||||
@@ -586,14 +586,14 @@
|
|
||||||
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 */
|
|
||||||
+
|
|
||||||
+ if (memcmp(c1, c2, r1) != 0) return 0; /* file contents are different */
|
|
||||||
} while (r1 && r2);
|
|
||||||
|
|
||||||
- if (r1 != r2) return 0; /* file lengths are different */
|
|
||||||
-
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user