Package: findutils Version: 4.6.0+git+20181018-1 Tags: upstream patch Affects: piuparts X-Debbugs-CC: Andreas Beckmann <a...@debian.org>
Hi, The following testcase [1]: mkdir foo mknod foo/null c 1 3 touch foo/bindmntoverfile mount --bind foo/null foo/bindmntoverfile find foo -type f -ls 3857271640 0 crw-r--r-- 1 root root 1, 3 Oct 24 07:50 foo/bindmntoverfile i.e "-type f" wrongly matches a char device. The attached patch fixes this. Regards -- Mathieu Parent [1]: Thanks Andreas: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911334#25
From 54684823679197afcaa25d1a2ea136281fd7ca72 Mon Sep 17 00:00:00 2001 From: Mathieu Parent <math.par...@gmail.com> Date: Sun, 28 Oct 2018 21:13:21 +0100 Subject: [PATCH] Ensure type is checked with FTS_NSOK and FTS_NS Before this patch: mkdir foo mknod foo/null c 1 3 touch foo/bindmntoverfile mount --bind foo/null foo/bindmntoverfile find foo -type f -ls 3857271640 0 crw-r--r-- 1 root root 1, 3 Oct 24 07:50 foo/bindmntoverfile More info and context at: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911334#25 --- find/ftsfind.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/find/ftsfind.c b/find/ftsfind.c index f9b03e2..1b9c841 100644 --- a/find/ftsfind.c +++ b/find/ftsfind.c @@ -577,7 +577,11 @@ find (char *arg) state.already_issued_stat_error_msg = false; state.have_stat = false; - state.have_type = !!ent->fts_statp->st_mode; + if (ent->fts_info != FTS_NSOK && ent->fts_info != FTS_NS) { + state.have_type = !!ent->fts_statp->st_mode; + } else { + state.have_type = false; + } state.type = state.have_type ? ent->fts_statp->st_mode : 0; consider_visiting (p, ent); } -- 2.11.0