build: Do not recurse on symlinks to directories when building tarballs
authorMartin Schwenke <martin@meltin.net>
Tue, 8 Aug 2017 10:50:25 +0000 (20:50 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 10 Aug 2017 04:43:13 +0000 (06:43 +0200)
DIST_FILES() causes all files in any specified directory to be
recursively added to the tarball.  However, a symbolic link to a
directory is detected as a regular directory so is also subject to
recursion.  This means that a symbolic link to a directory is
dereferenced and the directory of files beyond it are added to the
tarball under a directory corresponding to the link.  This is almost
certainly not what is intended because it will usually result in
duplicate files.  This is because the contents of a symbolic link's
target directory will already be present in the tarball.

Instead, do not treat symbolic links to directories as directories,
but add them to the tarball like normal files.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
buildtools/wafsamba/samba_dist.py

index 4dacba23d2e4789e01d4ec2c1aa5db3abedc84b8..2e52820697b39872c51acd0179575a9f14cff95e 100644 (file)
@@ -182,7 +182,7 @@ def dist(appname='', version=''):
 
             absfile = os.path.join(srcdir, file)
 
-            if os.path.isdir(absfile):
+            if os.path.isdir(absfile) and not os.path.islink(absfile):
                 destdir = destfile
                 dir = file
                 files = list_directory_files(dir)