Updated to new upstream-release

Upstream changed versioning-scheme, Epoch is needed
Drop old patches, applied upstream
Update spec-file to recent guidelines
Drop el5-bits
epel9
Björn Esser 8 years ago
parent 93b73c6d63
commit 4be68f260c

1
.gitignore vendored

@ -1,2 +1,3 @@
fdupes-1.50-PR2.tar.gz
/fdupes-1.51.tar.gz
/fdupes-1.6.1.tar.gz

@ -1,92 +0,0 @@
# cherry picked from commit: c62a5331a5feef2b09556546d02a2b2fc67f6e67
# which fixed this CVE in upstream master
diff -Naur fdupes-1.51.orig/fdupes.1 fdupes-1.51/fdupes.1
--- fdupes-1.51.orig/fdupes.1 2013-04-20 12:00:09.000000000 -0500
+++ fdupes-1.51/fdupes.1 2013-07-16 13:01:16.264491871 -0500
@@ -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
diff -Naur fdupes-1.51.orig/fdupes.c fdupes-1.51/fdupes.c
--- fdupes-1.51.orig/fdupes.c 2013-04-20 13:02:18.000000000 -0500
+++ fdupes-1.51/fdupes.c 2013-07-16 13:03:04.529344704 -0500
@@ -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);
@@ -958,6 +976,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(" \tprompting 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
@@ -1000,6 +1019,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
@@ -1011,7 +1031,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
@@ -1059,6 +1079,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");

@ -1,32 +0,0 @@
# cherry picked from commit: 5d9143b8168cbf7fe55e2273f42486bcc9175208
# and adapted
# This effective patch has already been applied to upstream
diff -Naur fdupes-1.51.orig/Makefile fdupes-1.51/Makefile
--- fdupes-1.51.orig/Makefile 2013-04-20 12:51:58.000000000 -0500
+++ fdupes-1.51/Makefile 2013-07-16 09:22:30.169197997 -0500
@@ -46,6 +46,8 @@
#
PROGRAM_NAME=fdupes
+DESTDIR =
+
#
# BIN_DIR indicates directory where program is to be installed.
# Suggested value is "$(PREFIX)/bin"
@@ -103,12 +105,12 @@
$(CC) $(CFLAGS) -o fdupes $(OBJECT_FILES)
installdirs:
- test -d $(BIN_DIR) || $(MKDIR) $(BIN_DIR)
- test -d $(MAN_DIR) || $(MKDIR) $(MAN_DIR)
+ test -d $(DESTDIR)$(BIN_DIR) || $(MKDIR) $(DESTDIR)$(BIN_DIR)
+ test -d $(DESTDIR)$(MAN_DIR) || $(MKDIR) $(DESTDIR)$(MAN_DIR)
install: fdupes installdirs
- $(INSTALL_PROGRAM) fdupes $(BIN_DIR)/$(PROGRAM_NAME)
- $(INSTALL_DATA) fdupes.1 $(MAN_DIR)/$(PROGRAM_NAME).$(MAN_EXT)
+ $(INSTALL_PROGRAM) fdupes $(DESTDIR)$(BIN_DIR)/$(PROGRAM_NAME)
+ $(INSTALL_DATA) fdupes.1 $(DESTDIR)$(MAN_DIR)/$(PROGRAM_NAME).$(MAN_EXT)
clean:
$(RM) $(OBJECT_FILES)

@ -1,38 +0,0 @@
From b8f3a4ea82bbff053ba785fb2e719d2ac6d82e15 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <bjoern.esser@gmail.com>
Date: Fri, 19 Jun 2015 22:15:52 -0400
Subject: [PATCH] obey ldflags
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
backport of patch submitted to fedora dist-git repo for fdupes
cherry picked from commit: b8f3a4ea82bbff053ba785fb2e719d2ac6d82e15
commit 2fefedf7da42a6e73894e6d361e65b054ce80001
Author: Björn Esser <bjoern.esser@gmail.com>
Date: Tue Mar 18 13:51:11 2014 +0100
added Patch3: fdupes-1.51-obey-ldflags.patch to repo
Signed-off-by: Jon Schlueter <jschluet@redhat.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 921d910..e6947ea 100644
--- a/Makefile
+++ b/Makefile
@@ -102,7 +102,7 @@ OBJECT_FILES = fdupes.o md5/md5.o $(ADDITIONAL_OBJECTS)
all: fdupes
fdupes: $(OBJECT_FILES)
- $(CC) $(CFLAGS) -o fdupes $(OBJECT_FILES)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o fdupes $(OBJECT_FILES)
installdirs:
test -d $(DESTDIR)$(BIN_DIR) || $(MKDIR) $(DESTDIR)$(BIN_DIR)
--
2.1.0

@ -1,28 +0,0 @@
From cc2fe14c2397b84ff61d00e038462dc6dac3bda2 Mon Sep 17 00:00:00 2001
From: Alfie Costa <agcosta@gis.net>
Date: Fri, 12 Oct 2012 14:58:00 +0200
Subject: [PATCH 03/17] Fix a typo in a manpage
Fixes: http://bugs.debian.org/353789
cherry picked from commit: cc2fe14c2397b84ff61d00e038462dc6dac3bda2
---
fdupes.1 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fdupes.1 b/fdupes.1
index c0a02f0..71da2c4 100644
--- a/fdupes.1
+++ b/fdupes.1
@@ -87,7 +87,7 @@ If fdupes returns with an error message such as
.B fdupes: error invoking md5sum
it means the program has been compiled to use an external
program to calculate MD5 signatures (otherwise, fdupes uses
-interal routines for this purpose), and an error has occurred
+internal routines for this purpose), and an error has occurred
while attempting to execute it. If this is the case, the
specified program should be properly installed prior
to running fdupes.
--
2.1.0

@ -0,0 +1,24 @@
From 88f3d2dd31fbef7e539b2523724221e8e8e5a9f0 Mon Sep 17 00:00:00 2001
From: Falk <falkartis@gmail.com>
Date: Thu, 27 Oct 2016 18:10:48 +0200
Subject: [PATCH] allow to type just a instead of all
Typing all many times can be boring/annoying, So I propose to allow people to type just a for all.
(sometimes there can be very large duplicate sets)
---
fdupes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fdupes.c b/fdupes.c
index 7eee165..7a8a6ed 100644
--- a/fdupes.c
+++ b/fdupes.c
@@ -886,7 +886,7 @@ void deletefiles(file_t *files, int prompt, FILE *tty)
token = strtok(preservestr, " ,\n");
while (token != NULL) {
- if (strcasecmp(token, "all") == 0)
+ if (strcasecmp(token, "all") == 0 || strcasecmp(token, "a") == 0)
for (x = 0; x <= counter; x++) preserve[x] = 1;
number = 0;

@ -0,0 +1,88 @@
From 315f6702f1cc37036d9f826314245b44a781c387 Mon Sep 17 00:00:00 2001
From: Adrian Lopez <adrianlopezroche@gmail.com>
Date: Sun, 21 Aug 2016 02:04:15 -0400
Subject: [PATCH] Delete old TODO file.
---
TODO | 72 --------------------------------------------------------------------
1 file changed, 72 deletions(-)
delete mode 100644 TODO
diff --git a/TODO b/TODO
deleted file mode 100644
index f7f77c4..0000000
--- a/TODO
+++ /dev/null
@@ -1,72 +0,0 @@
-- A bug with -S shows wrong results.
-
-- A bug causes the following behavior:
-
- $ fdupes --symlinks testdir
- testdir/with spaces b
- testdir/with spaces a
-
- testdir/zero_b
- testdir/zero_a
-
- testdir/symlink_two
- testdir/twice_one
-
- $ cp testdir/two testdir/two_again
- $ fdupes --symlinks testdir
- testdir/two_again
- testdir/two
- testdir/twice_one
- testdir/symlink_two
-
- testdir/with spaces b
- testdir/with spaces a
-
- testdir/zero_b
- testdir/zero_a
-
- ** This is not the desired behavior. Likewise:
-
- $ fdupes testdir
- testdir/with spaces b
- testdir/with spaces a
-
- testdir/zero_b
- testdir/zero_a
-
- testdir/twice_one
- testdir/two
-
- $ fdupes --symlinks testdir
- testdir/with spaces b
- testdir/with spaces a
-
- testdir/zero_b
- testdir/zero_a
-
- testdir/symlink_two
- testdir/twice_one
-
-- Don't assume that stat always works.
-
-- Add partial checksumming where instead of MD5ing whole
- files we MD5 and compare every so many bytes, caching
- these partial results for subsequent comparisons.
-
-- Option -R should not have to be separated from the rest,
- such that "fdupes -dR testdir", "fdupes -d -R testdir",
- "fdupes -Rd testdir", etc., all yield the same results.
-
-- Add option to highlight or identify symlinked files (suggest
- using --classify to identify symlinks with @ suffix... when
- specified, files containing @ are listed using \@).
-
-- Consider autodeletion option without user intervention.
-
-- Consider option to match only to files in specific directory.
-
-- Do a little commenting, to avoid rolling eyes and/or snickering.
-
-- Fix problem where MD5 collisions will result in one of the
- files not being registered (causing it to be ignored).
-

@ -0,0 +1,167 @@
From e95ec42dc178eff0410880c3dc4c0dac3df442df Mon Sep 17 00:00:00 2001
From: Adrian Lopez <adrianlopezroche@gmail.com>
Date: Tue, 23 Aug 2016 18:21:18 -0400
Subject: [PATCH] Add an option to sort duplicate files by ctime.
---
README | 5 +++--
fdupes.1 | 2 +-
fdupes.c | 49 +++++++++++++++++++++++++++++++++++++------------
3 files changed, 41 insertions(+), 15 deletions(-)
diff --git a/README b/README
index c748d05..c27f043 100644
--- a/README
+++ b/README
@@ -37,8 +37,9 @@ Usage: fdupes [options] DIRECTORY...
grouping into sets; implies --noprompt
-p --permissions don't consider files with different owner/group or
permission bits as duplicates
- -o --order=BY select sort order for output, linking and deleting; by
- mtime (BY='time'; default) or filename (BY='name')
+ -o --order=BY select sort order for output and deleting; by file
+ modification time (BY='time'; default), status
+ change time (BY='ctime'), or filename (BY='name')
-i --reverse reverse order while sorting
-v --version display fdupes version
-h --help display this help message
diff --git a/fdupes.1 b/fdupes.1
index 5ddad87..969a5d8 100644
--- a/fdupes.1
+++ b/fdupes.1
@@ -72,7 +72,7 @@ don't consider files with different owner/group or permission bits as duplicates
.TP
.B -o --order\fR=\fIWORD\fR
order files according to WORD:
-time - sort by mtime, name - sort by filename
+time - sort by modification time, ctime - sort by status change time, name - sort by filename
.TP
.B -i --reverse
reverse order while sorting
diff --git a/fdupes.c b/fdupes.c
index ef64c45..7eee165 100644
--- a/fdupes.c
+++ b/fdupes.c
@@ -56,7 +56,8 @@
#define F_IMMEDIATE 0x8000
typedef enum {
- ORDER_TIME = 0,
+ ORDER_MTIME = 0,
+ ORDER_CTIME,
ORDER_NAME
} ordertype_t;
@@ -64,6 +65,8 @@ char *program_name;
unsigned long flags = 0;
+ordertype_t ordertype = ORDER_MTIME;
+
#define CHUNK_SIZE 8192
#define INPUT_SIZE 256
@@ -97,7 +100,7 @@ typedef struct _file {
md5_byte_t *crcsignature;
dev_t device;
ino_t inode;
- time_t mtime;
+ time_t sorttime;
int hasdupes; /* true only if file is first on duplicate chain */
struct _file *duplicates;
struct _file *next;
@@ -183,6 +186,14 @@ time_t getmtime(char *filename) {
return s.st_mtime;
}
+time_t getctime(char *filename) {
+ struct stat s;
+
+ if (stat(filename, &s) != 0) return 0;
+
+ return s.st_ctime;
+}
+
char **cloneargs(int argc, char **argv)
{
int x;
@@ -435,7 +446,17 @@ void getfilestats(file_t *file)
file->size = filesize(file->d_name);
file->inode = getinode(file->d_name);
file->device = getdevice(file->d_name);
- file->mtime = getmtime(file->d_name);
+
+ switch (ordertype)
+ {
+ case ORDER_CTIME:
+ file->sorttime = getctime(file->d_name);
+ break;
+ case ORDER_MTIME:
+ default:
+ file->sorttime = getmtime(file->d_name);
+ break;
+ }
}
int registerfile(filetree_t **branch, file_t *file)
@@ -911,11 +932,11 @@ int sort_pairs_by_arrival(file_t *f1, file_t *f2)
return !ISFLAG(flags, F_REVERSE) ? -1 : 1;
}
-int sort_pairs_by_mtime(file_t *f1, file_t *f2)
+int sort_pairs_by_time(file_t *f1, file_t *f2)
{
- if (f1->mtime < f2->mtime)
+ if (f1->sorttime < f2->sorttime)
return !ISFLAG(flags, F_REVERSE) ? -1 : 1;
- else if (f1->mtime > f2->mtime)
+ else if (f1->sorttime > f2->sorttime)
return !ISFLAG(flags, F_REVERSE) ? 1 : -1;
return 0;
@@ -1038,8 +1059,9 @@ void help_text()
printf(" \tgrouping into sets; implies --noprompt\n");
printf(" -p --permissions \tdon't consider files with different owner/group or\n");
printf(" \tpermission bits as duplicates\n");
- printf(" -o --order=BY \tselect sort order for output, linking and deleting; by\n");
- printf(" \tmtime (BY='time'; default) or filename (BY='name')\n");
+ printf(" -o --order=BY \tselect sort order for output and deleting; by file\n");
+ printf(" \tmodification time (BY='time'; default), status\n");
+ printf(" \tchange time (BY='ctime'), or filename (BY='name')\n");
printf(" -i --reverse \treverse order while sorting\n");
printf(" -v --version \tdisplay fdupes version\n");
printf(" -h --help \tdisplay this help message\n\n");
@@ -1061,7 +1083,6 @@ int main(int argc, char **argv) {
int progress = 0;
char **oldargv;
int firstrecurse;
- ordertype_t ordertype = ORDER_TIME;
#ifndef OMIT_GETOPT_LONG
static struct option long_options[] =
@@ -1161,7 +1182,9 @@ int main(int argc, char **argv) {
if (!strcasecmp("name", optarg)) {
ordertype = ORDER_NAME;
} else if (!strcasecmp("time", optarg)) {
- ordertype = ORDER_TIME;
+ ordertype = ORDER_MTIME;
+ } else if (!strcasecmp("ctime", optarg)) {
+ ordertype = ORDER_CTIME;
} else {
errormsg("invalid value for --order: '%s'\n", optarg);
exit(1);
@@ -1247,10 +1270,12 @@ int main(int argc, char **argv) {
if (confirmmatch(file1, file2)) {
if (ISFLAG(flags, F_DELETEFILES) && ISFLAG(flags, F_IMMEDIATE))
deletesuccessor(match, curfile,
- (ordertype == ORDER_TIME) ? sort_pairs_by_mtime : sort_pairs_by_filename );
+ (ordertype == ORDER_MTIME ||
+ ordertype == ORDER_CTIME) ? sort_pairs_by_time : sort_pairs_by_filename );
else
registerpair(match, curfile,
- (ordertype == ORDER_TIME) ? sort_pairs_by_mtime : sort_pairs_by_filename );
+ (ordertype == ORDER_MTIME ||
+ ordertype == ORDER_CTIME) ? sort_pairs_by_time : sort_pairs_by_filename );
}
fclose(file1);

@ -1,26 +1,21 @@
# Place rpm-macros into proper location.
%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; /bin/echo $d)
Name: fdupes
Version: 1.51
Release: 12%{?dist}
Summary: Finds duplicate files in a given set of directories
%{?el5:Group: Applications/File}
Name: fdupes
Epoch: 1
Version: 1.6.1
Release: 1%{?dist}
Summary: Finds duplicate files in a given set of directories
License: MIT
URL: https://github.com/adrianlopezroche/fdupes
Source0: https://github.com/adrianlopezroche/%{name}/archive/%{name}-%{version}.tar.gz
Source1: macros.fdupes
License: MIT
URL: https://github.com/adrianlopezroche/%{name}
Source0: %{url}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: macros.%{name}
Patch0: fdupes-1.51-destdir.patch
# http://bugs.debian.org/353789
Patch1: fdupes-1.51-typo.patch
# Fix CVE
Patch2: fdupes-1.51-check-permissions.patch
# Apply proper LDFLAGS
Patch3: fdupes-1.51-obey-ldflags.patch
%{?el5:BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)}
# From upstream.
Patch0: %{url}/commit/315f6702f1cc37036d9f826314245b44a781c387.patch#/%{name}-1.6.1-delete_old_TODO.patch
Patch1: %{url}/commit/e95ec42dc178eff0410880c3dc4c0dac3df442df.patch#/%{name}-1.6.1-option_sort_by_ctime.patch
Patch2: %{url}/commit/88f3d2dd31fbef7e539b2523724221e8e8e5a9f0.patch#/%{name}-1.6.1-allow_a_instead_of_all.patch
%description
FDUPES is a program for identifying duplicate files residing within specified
@ -28,19 +23,49 @@ directories.
%prep
%setup -q -n %{name}-%{name}-%{version}
%patch2 -p1 -b .cve
%patch0 -p1 -b .destdir
%patch1 -p1 -b .typo
%patch3 -p1 -b .ldflags
%autosetup -p 1
# From README.
%{__cat} << EOF > LICENSE
FDUPES Copyright (c) 1999 Adrian Lopez
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
EOF
%build
make %{?_smp_mflags} \
%make_build \
COMPILER_OPTIONS="%{?optflags}" \
LDFLAGS="%{?__global_ldflags}"
%install
%make_install \
INSTALL="%{__install} -p" \
BIN_DIR=%{_bindir} \
MAN_BASE_DIR=%{_mandir}
%{__install} -Dpm 0644 %{SOURCE1} \
%{buildroot}%{macrosdir}/macros.%{name}
%check
./%{name} testdir
./%{name} --omitfirst testdir
@ -48,29 +73,22 @@ make %{?_smp_mflags} \
./%{name} --size testdir
%install
%{?el5:rm -rf %{buildroot}}
make install INSTALL="%{__install} -p" \
BIN_DIR=%{_bindir} \
MAN_BASE_DIR=%{_mandir} \
DESTDIR=%{buildroot}
mkdir -p %{buildroot}%{macrosdir}
install -pm 0644 %{SOURCE1} %{buildroot}%{macrosdir}
%clean
%{?el5:rm -rf %{buildroot}}
%files
%doc CHANGES CONTRIBUTORS README TODO
%license CONTRIBUTORS LICENSE
%doc CHANGES README
%doc %{_mandir}/man1/%{name}.1*
%{_bindir}/%{name}
%{macrosdir}/macros.fdupes
%changelog
* Sun Apr 09 2017 Björn Esser <besser82@fedoraproject.org> - 1:1.6.1-1
- Updated to new upstream-release
- Upstream changed versioning-scheme, Epoch is needed
- Drop old patches, applied upstream
- Update spec-file to recent guidelines
- Drop el5-bits
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.51-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

@ -1 +1 @@
cc90047dea9f1e0a849c3c1a6e8b2d68 fdupes-1.51.tar.gz
SHA512 (fdupes-1.6.1.tar.gz) = 6c6662b70068c2f48f4be64a6830c81a66852d650391d0756f20b9ac0df7d70c1a32918bd7cbd50e19de524d9ebc09ea338c19636e1807b071eb96b325e641db

Loading…
Cancel
Save