diff --git a/findutils-4.5.12-fts-cycle.patch b/findutils-4.5.12-fts-cycle.patch new file mode 100644 index 0000000..b67c36b --- /dev/null +++ b/findutils-4.5.12-fts-cycle.patch @@ -0,0 +1,40 @@ +From 8ec378f9a0211e98179a8230da2eda20782d0a11 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Wed, 11 Feb 2015 13:48:12 +0100 +Subject: [PATCH] fts: fix a crash triggered by recursive bind mount + +Reported by Michael Chapman in: https://bugzilla.redhat.com/1188498 +* lib/fts.c (fts_read): Avoid removing the original hash table item +when leaving a directory that caused a cycle, and preserve the FTS_DC +flag. +--- + gl/lib/fts.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/gl/lib/fts.c b/gl/lib/fts.c +index 9c38c4f..9b97fe3 100644 +--- a/gl/lib/fts.c ++++ b/gl/lib/fts.c +@@ -1091,9 +1091,16 @@ cd_dot_dot: + p->fts_errno = errno; + SET(FTS_STOP); + } +- p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP; +- if (p->fts_errno == 0) +- LEAVE_DIR (sp, p, "3"); ++ ++ /* If the directory causes a cycle, preserve the FTS_DC flag and keep ++ * the corresponding dev/ino pair in the hash table. It is going to be ++ * removed when leaving the original directory. ++ */ ++ if (p->fts_info != FTS_DC) { ++ p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP; ++ if (p->fts_errno == 0) ++ LEAVE_DIR (sp, p, "3"); ++ } + return ISSET(FTS_STOP) ? NULL : p; + } + +-- +2.1.0 + diff --git a/findutils.spec b/findutils.spec index 36c43a2..ea53ca0 100644 --- a/findutils.spec +++ b/findutils.spec @@ -1,7 +1,7 @@ Summary: The GNU versions of find utilities (find and xargs) Name: findutils Version: 4.5.12 -Release: 7%{?dist} +Release: 8%{?dist} Epoch: 1 License: GPLv3+ Group: Applications/File @@ -11,6 +11,8 @@ Source0: ftp://alpha.gnu.org/gnu/findutils/%{name}-%{version}.tar.gz # do not build locate Patch1: findutils-4.4.0-no-locate.patch +Patch2: findutils-4.5.12-fts-cycle.patch + # add a new option -xautofs to find to not descend into directories on autofs # file systems Patch3: findutils-4.4.2-xautofs.patch @@ -49,6 +51,7 @@ useful for finding things on your system. %setup -q rm -rf locate %patch1 -p1 +%patch2 -p1 %patch3 -p1 %patch4 -p1 %patch5 -p1