From 7d8518f0af961cbfdcfa22c9e35a9233965ecd0a Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Fri, 2 Feb 2018 18:31:38 +0100 Subject: recursiveloader: Do not recur into directories when file was expected When verifying, do not let os.walk() recur into a directory for which we have an entry requesting it to be a file. The verification is going to fail on the directory entry anyway, so there is no point in seeking matches further and this could have currently resulted in crossing filesystem boundaries (since the cross-fs test is deferred to verifying thread). --- gemato/recursiveloader.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gemato/recursiveloader.py b/gemato/recursiveloader.py index 6dd456c..815afbb 100644 --- a/gemato/recursiveloader.py +++ b/gemato/recursiveloader.py @@ -1,6 +1,6 @@ # gemato: Recursive loader for Manifests # vim:fileencoding=utf-8 -# (c) 2017 Michał Górny +# (c) 2017-2018 Michał Górny # Licensed under the terms of 2-clause BSD license import errno @@ -615,8 +615,11 @@ class ManifestRecursiveLoader(object): raise gemato.exceptions.ManifestCrossDevice(syspath) continue + # if we have an entry for the directory, it's either + # ignored, or is supposed to be a file -- in both + # cases, we want not to recur + skip_dirs.append(d) if de.tag == 'IGNORE': - skip_dirs.append(d) del dirdict[d] # skip scanning ignored directories -- cgit v1.2.3