conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.17k stars 974 forks source link

conan install crash when imports are present #756

Closed piponazo closed 7 years ago

piponazo commented 7 years ago

I recently noticed that the conan install command crashes when the files we are trying to import are already present. I will give more details about my particular case to fully explain the situation.

In my project, conanfile.txt looks like this:

[requires]
# whatever

[generators]
cmake

[options]

[imports]
lib, *.so*     -> ../bin64
lib, *.dylib   -> ../bin64
bin, *.dll     -> ../bin64

Let's imagine that I just cloned my repository in a local machine. When I run the conan install command from my $REPO/build directory, the first time everything works as expected. However, if I run that command a second time I get this error:

luis@p4dDesktop:~/projects/Pix4DMapper-Master/master-conan/pix4dmapper/build-mapper-gcc-Release/build$ conan install ../../
Requirements
    OpenMesh/4.1.1-0@pix4d/stable from conan-server
Packages
    OpenMesh/4.1.1-0@pix4d/stable:b1c1bba64e5b990636f4bcca97c3f5313c24bc3c

OpenMesh/4.1.1-0@pix4d/stable: Already installed!
PROJECT: Generated cmake created conanbuildinfo.cmake
PROJECT: Generated conaninfo.txt
Traceback (most recent call last):
  File "/usr/local/bin/conan", line 11, in <module>
    sys.exit(run())
  File "/home/luis/envs/conan/local/lib/python2.7/site-packages/conans/conan.py", line 6, in run
    main(sys.argv[1:])
  File "/home/luis/envs/conan/local/lib/python2.7/site-packages/conans/client/command.py", line 930, in main
    error = command.run(args)
  File "/home/luis/envs/conan/local/lib/python2.7/site-packages/conans/client/command.py", line 832, in run
    method(args[0][1:])
  File "/home/luis/envs/conan/local/lib/python2.7/site-packages/conans/client/command.py", line 440, in install
    no_imports=args.no_imports)
  File "/home/luis/envs/conan/local/lib/python2.7/site-packages/conans/client/manager.py", line 311, in install
    run_imports(conanfile, current_path, output)
  File "/home/luis/envs/conan/local/lib/python2.7/site-packages/conans/client/importer.py", line 12, in run_imports
    copied_files = file_importer.execute()
  File "/home/luis/envs/conan/local/lib/python2.7/site-packages/conans/client/importer.py", line 73, in execute
    files = file_copier(pattern, src=src_folder, links=True)
  File "/home/luis/envs/conan/local/lib/python2.7/site-packages/conans/client/file_copier.py", line 90, in __call__
    os.symlink(linkto, abs_dst_name)
OSError: [Errno 17] File exists

I would understand a warning message, but the application is crashing and I think that this is a bug. Please, let me know if you need more information about this issue.

memsharded commented 7 years ago

Yes, seems a bug. There is some PR still open related to imports, I will have a look to see if we can fix this for 0.17

memsharded commented 7 years ago

Latest commit of https://github.com/conan-io/conan/pull/746 should fix this.

piponazo commented 7 years ago

Fastest bug-fix ever :heart_eyes: . Thanks!