[Rpm-metadata] [PATCH] Fix handling of symlinks pointing to a directory. BZ 969754
Zdenek Pavlas
zpavlas at redhat.com
Mon Jun 3 11:44:15 UTC 2013
> 2) process each symlink only once. This breaks directory loops.
> Since we may have processed the target dir already, we process
> it at most twice.
Maybe we should not try to detect loops, but ANY means of processing
the same directory twice.. and err out instead:
--- a/createrepo/__init__.py
+++ b/createrepo/__init__.py
@@ -304,8 +304,15 @@ class MetaDataGenerator:
recurse dirs. Returns a list object"""
extlen = len(ext)
+ seen = set()
def extension_visitor(filelist, dirname, names):
+ st = os.stat(dirname)
+ key = st.st_dev, st.st_ino
+ if key in seen:
+ msg = _('Directory \'%s\' listed more than once')
+ raise MDError, msg % dirname[len(startdir):]
+ seen.add(key)
for fn in names:
fn = os.path.join(dirname, fn)
if os.path.isdir(fn):
More information about the Rpm-metadata
mailing list