Conan: Weird behaviour with exports_sources in package containing symlink

Created on 23 Jul 2018  路  6Comments  路  Source: conan-io/conan

Happens on conan 1.6.0, Ubuntu 16.04, CMake 3.11 (don't think CMake is relevant here).

Attached an example conanfile to reproduce the issue conan_symlink.tar.gz.

The directory layout is the following :

another_directory
    not_to_copy.txt
another_other_directory
    another_directory => (symlink to another_directory)
src
    main.cpp
CMakeLists.txt
conanfile.py

In the exports_sources section, I only specify the src folder and the CMakeLists.txt :
exports_sources = ["src/*", "CMakeLists.txt"]
After a conan export . test/test the folder in the .conan/.../export_source folder contains the folder another_other_directory (the one which was containing the symlink).

If I go further and create a sub folder which contains another symlink, the subfolder is also copied.

  • [X] I've read the CONTRIBUTING guide.
  • [x] I've specified the Conan version, operating system version and any tool that can be relevant.
  • [X] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.
bug

All 6 comments

Hi @dkgs, thanks a lot for reporting.

I managed to reproduce your example in Windows too. Seems this is a bug.

Ignore the message, I posted and deleted I noticed I was using an old version of conan so reported an old bug!

Sorry @dkgs, there was a mistake from my side and finally I am not able to reproduce your issue. I have submitted a PR #3396 with some tests to check and they are passing and Conan works as expected.

Could you please check again you setup and verify it from your side? Thanks

Hello @danimtb ,

I updated to conan 1.6.1 and I confirm the problem.

The content of the conanfile:

from conans import ConanFile, CMake

class ConanSymlink(ConanFile):
    name = "ConanSymlink"
    version = "3.0.0"
    settings = "os", "compiler", "arch", "build_type"
    exports_sources = ["src/*", "CMakeLists.txt"]
    no_copy_source = True
    generators = "cmake", "txt"

    def build(self):
        cmake = CMake(self)
        self.run('cmake "%s" %s' % (self.source_folder, cmake.command_line))
        self.run("cmake --build . %s" % cmake.build_config)  

Here are the outputs of ll ** on my folders:

Folder containing the conanfile.py:

-rw-rw-r-- 1 user user  138 Aug 27 12:40 CMakeLists.txt
-rw-rw-r-- 1 user user  467 Aug 27 12:40 conanfile.py

another_directory:
total 12
drwxrwxr-x 2 user user 4096 Aug 27 12:40 .
drwxrwxr-x 5 user user 4096 Aug 27 12:40 ..
-rw-rw-r-- 1 user user   32 Aug 27 12:40 not_to_copy.txt

another_other_directory:
total 8
drwxrwxr-x 2 user user 4096 Aug 27 12:40 .
drwxrwxr-x 5 user user 4096 Aug 27 12:40 ..
lrwxrwxrwx 1 user user   21 Aug 27 12:40 another_directory -> ../another_directory/

src:
total 12
drwxrwxr-x 2 user user 4096 Aug 27 12:40 .
drwxrwxr-x 5 user user 4096 Aug 27 12:40 ..
-rw-rw-r-- 1 user user  117 Aug 27 12:40 main.cpp

The export_source folder in ~/.conan/data/ConanSymlink/3.0.0/test/test/export_source after the command conan export . test/test and I deleted the directory ~/.conan/data/ConanSymlink before to be sure:

-rw-rw-r-- 1 user user  138 Aug 27 12:40 CMakeLists.txt

another_other_directory:
total 8
drwxrwxr-x 2 user user 4096 Aug 27 12:41 .
drwxrwxr-x 4 user user 4096 Aug 27 12:41 ..

src:
total 12
drwxrwxr-x 2 user user 4096 Aug 27 12:41 .
drwxrwxr-x 4 user user 4096 Aug 27 12:41 ..
-rw-rw-r-- 1 user user  117 Aug 27 12:40 main.cpp

As you can see the another_directory is created but it shouldn't.

Hej @danimtb ,
I checked your tests and made some comments.
As I am no python expert, I may be completely wrong.

Please check comment on os.symlink and comment on assertFalse

Hi @dkgs,

Thanks a lot for the comments. I double checked and it seems the tests were not fully resembling your case. I will come up with a new PR to get this fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Polibif picture Polibif  路  3Comments

bobeff picture bobeff  路  3Comments

uilianries picture uilianries  路  3Comments

uilianries picture uilianries  路  3Comments

petermbauer picture petermbauer  路  3Comments