Repository: conan-io/conan

Issue:
"conan install .. " broken for Wrong package recipe reference (1.12.0)
- [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.

If a launch 'conan install ..' in my build director, where .. has a conanfile.py file.
I got an exeption "Wrong package recipe reference".
I have add a display and it seems that conan tries to parse ".." as a recipe.
the same happens if I use "conan install ../conanfile.py"
Regards,



Discussion:
Hi @dfleury2 

I am trying to reproduce without success. What "display" have you added? If you are tracing conan code execution, could you please elaborate a bit more which steps did it take to get there? 

In which OS and terminal is it happening? Also, are you in the CppLang slack channel? We could try to talk there to pair-debug this issue, looking weird. Thanks!

Hi, 
I am on Debian Jessie.
I have added a comment for displaying which text throw the exception (before I see It was already displayed on the exception et ref.py line 115)
Yes I am on CppLang slack same id.
I got this issue when I use editable package as requirement (requires in the conanfile.py)

Edit: And this requirement is already present for another require.

To sum up : I got 3 projects A, B and C. 
A requires B and C
B requires C
C is editable
conan install broke.
if I change "A requires B", conan install works fine

Edit: Here the assertion I got

  File "/usr/local/lib/python3.4/dist-packages/conans/client/graph/graph_builder.py", line 113, in _load_deps
    conflict = self._conflicting_references(previous_node.ref, require.ref)
  File "/usr/local/lib/python3.4/dist-packages/conans/client/graph/graph_builder.py", line 141, in _conflicting_references
    assert(previous_ref.revision is not None)
AssertionError

Look like my versioning scheme is not compatible with the assert (1.11-rc)
_conflicting_references (graph_builder.py near line 138)
Thanks for the feedback!
Yes, it seems there is something failing with the "Editable" packages and revisions. Working on a fix, thanks for reporting.

Resolving patch:
diff --git a/conans/client/graph/graph_builder.py b/conans/client/graph/graph_builder.py
--- a/conans/client/graph/graph_builder.py
+++ b/conans/client/graph/graph_builder.py
@@ -137,11 +137,10 @@ def _load_deps(self, node, down_reqs, dep_graph, public_deps, down_ref, down_opt
     def _conflicting_references(previous_ref, new_ref):
         if previous_ref.copy_clear_rev() != new_ref.copy_clear_rev():
             return REFERENCE_CONFLICT
-        # Computed node, has to have a revision, at least 0
-        assert(previous_ref.revision is not None)
+        # Computed node, if is Editable, has revision=None
         # If new_ref.revision is None we cannot assume any conflict, the user hasn't specified
         # a revision, so it's ok any previous_ref
-        if new_ref.revision and previous_ref.revision != new_ref.revision:
+        if previous_ref.revision and new_ref.revision and previous_ref.revision != new_ref.revision:
             return REVISION_CONFLICT
         return False
 


Test patch:
diff --git a/conans/test/functional/editable/transitive_editable_test.py b/conans/test/functional/editable/transitive_editable_test.py
new file mode 100644
--- /dev/null
+++ b/conans/test/functional/editable/transitive_editable_test.py
@@ -0,0 +1,32 @@
+# coding=utf-8
+
+import os
+import unittest
+
+from conans.test.utils.tools import TestClient
+from conans.test.utils.conanfile import TestConanFile
+from conans.util.files import mkdir
+
+
+class TransitiveEditableTest(unittest.TestCase):
+
+    def test_transitive_editables(self):
+        # https://github.com/conan-io/conan/issues/4445
+        client = TestClient()
+        conanfileC = TestConanFile("LibC", "0.1")
+        client.save({"conanfile.py": str(conanfileC)})
+        client.run("link . LibC/0.1@user/testing")
+
+        client2 = TestClient(client.base_folder)
+        conanfileB = TestConanFile("LibB", "0.1", requires=["LibC/0.1@user/testing"])
+
+        client2.save({"conanfile.py": str(conanfileB)})
+        client2.run("create . user/testing")
+
+        conanfileA = TestConanFile("LibA", "0.1", requires=["LibB/0.1@user/testing",
+                                                            "LibC/0.1@user/testing"])
+        client2.save({"conanfile.py": str(conanfileA)})
+        client2.run("install .")
+        client2.current_folder = os.path.join(client2.current_folder, "build")
+        mkdir(client2.current_folder)
+        client2.run("install ..")