On Wed, Feb 17, 2016 at 10:34:19AM +0100, Tzafrir Cohen wrote:

> The patch is indeed too agressive, but the problem is that copying all
> the top-level files in the tree may fail if one of them is a symlink to
> somewhere below in the tree.
> Note that symlink is readable. It's not a dandling symlink. However the
> copying of the packaging files only copies the top-level files.

Sorry for the delay. Attached a more direct fix for the issue: when
copying packaging files, skip symlinks to any files that are not in hte
same directory.

Tzafrir Cohen         | tzaf...@jabber.org | VIM is
http://tzafrir.org.il |                    | a Mutt's
tzaf...@cohens.org.il |                    |  best
tzaf...@debian.org    |                    | friend
>From 83db4976c96b51c6ece2a806073e561aeba37924 Mon Sep 17 00:00:00 2001
From: Tzafrir Cohen <tzaf...@debian.org>
Date: Tue, 15 Mar 2016 14:00:52 +0200
Subject: [PATCH] buildpackage-rpm: packaging: no symlink to other dirs

Don't export a potential packaging file which is a symbolic link that
points to a file in a different directory.

The buildpackage-rpm considers all files in the top-level directory as
(potential) packaging files.

However if you use it within the full source tree, the top-level
directory may include symbolic links to files elsewhere in the tree. In
this case, you get an error exporting packaging file.

Signed-off-by: Tzafrir Cohen <tzaf...@debian.org>
 gbp/scripts/buildpackage_rpm.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py
index 00582df..1dc1ab2 100644
--- a/gbp/scripts/buildpackage_rpm.py
+++ b/gbp/scripts/buildpackage_rpm.py
@@ -548,6 +548,8 @@ def main(argv):
                 src = os.path.join(dump_dir, fname)
                 if fname == spec.specfile:
                     dst = os.path.join(spec_dir, fname)
+                elif os.path.islink(src) and os.readlink(src).find('/') >= 0:
+                    continue # A non-local symlink
                     dst = os.path.join(source_dir, fname)

git-buildpackage mailing list

Reply via email to