[PATCH] createrepo 0.4.10 and link directory traversals
Henning Schmiedehausen <[email protected]>
| Newsgroups | gmane.linux.rpm.metadata |
|---|---|
| Organization | INTERMETA - Gesellschaft fuer Mehrwertdienste mbH |
| Message-ID | <[email protected]> |
Hi, for various reasons I have a repository that is organized like this: foo | +---- arch1 --+--> symlink to dir1 | | | +--> symlink to dir2 | | | +--- repodata | createrepo 0.4.2 (the one included in RHEL5) built the repodata for this fine. createrepo 0.4.10 simply ignores the symlinks. I tracked that down to the extension_visitor and its treatment of symlinks. The attached patch restores the old behavior (I think the current one is wrong). Oh, and you need to document the very useful --skip-symlinks option. :-) Please apply for 0.4.11 Best regards Henning -- Henning P. Schmiedehausen -- [email protected] | J2EE, Linux, 91054 Buckenhof, Germany -- +49 9131 506540 | Apache person Open Source Consulting, Development, Design | Velocity - Turbine guy INTERMETA - Gesellschaft fuer Mehrwertdienste mbH - RG Fuerth, HRB 7350 Gesellschaftssitz: Buckenhof. Geschaeftsfuehrer: Henning Schmiedehausen "It's good to be a lunatic..." -- 10th doctor _______________________________________________ Rpm-metadata mailing list [email protected] https://lists.dulug.duke.edu/mailman/listinfo/rpm-metadata
createrepo-0.4.10-link.patch
(text/x-patch, 1.1 KB)
diff -urb createrepo-0.4.10/genpkgmetadata.py createrepo-0.4.10.p/genpkgmetadata.py
--- createrepo-0.4.10/genpkgmetadata.py 2007-06-07 12:33:34.000000000 +0200
+++ createrepo-0.4.10.p/genpkgmetadata.py 2007-10-22 20:48:24.000000000 +0200
@@ -83,11 +83,16 @@
def extension_visitor(filelist, dirname, names):
for fn in names:
- if os.path.isdir(fn):
+ fname = os.path.join(dirname, fn)
+ if os.path.islink(fname):
+ if self.cmds['skip-symlinks']:
+ continue
+ if os.path.isdir(fname):
+ os.path.walk(fname, extension_visitor, filelist)
continue
- if self.cmds['skip-symlinks'] and os.path.islink(fn):
+ if os.path.isdir(fname):
continue
- elif fn[-extlen:].lower() == '%s' % (ext):
+ if fn[-extlen:].lower() == '%s' % (ext):
relativepath = dirname.replace(startdir, "", 1)
relativepath = relativepath.lstrip("/")
filelist.append(os.path.join(relativepath,fn))