Repository: conan-io/conan

Issue:
Case insensitivity when exporting package
Hi,
When I export a package which alredy exists with different large or lower case, my package will assume the other package's name. Due to case-sensitivity issues my package won't be exported with the name I gave it. This is problematic when trying to access it with the name I intended for it.
E.g.:
**conan serach** gives us a
Hello/0.1@demo/testing

Trying to **conan export  demo2/testing** a package named hello will result in Hello/0.1@demo2/testing
being created. The way I understand it this is a windows filesystem problem(case-sensitivity). It would be nice if a warning would be generated, informing the user about case problems when creating packages.



Discussion:

Resolving patch:
diff --git a/conans/client/cmake.py b/conans/client/cmake.py
--- a/conans/client/cmake.py
+++ b/conans/client/cmake.py
@@ -41,8 +41,6 @@ def generator(self):
 
         if operating_system == "Windows":
             if compiler == "gcc":
-                if self._settings.compiler.version == "4.9":
-                    return "Unix Makefiles"
                 return "MinGW Makefiles"
             if compiler in ["clang", "apple-clang"]:
                 return "MinGW Makefiles"
diff --git a/conans/client/manager.py b/conans/client/manager.py
--- a/conans/client/manager.py
+++ b/conans/client/manager.py
@@ -98,6 +98,15 @@ def export(self, user, conan_file_path, keep_source=False):
                                    "It is recommended to add the package license as attribute")
 
         conan_ref = ConanFileReference(conan_file.name, conan_file.version, user_name, channel)
+
+        conan_ref_str = str(conan_ref)
+        # Maybe a platform check could be added, but depends on disk partition
+        info = self.file_manager.search(conan_ref_str, ignorecase=True)
+        refs = {s for s in info.iterkeys() if str(s).lower() == conan_ref_str.lower()}
+        if refs and conan_ref not in refs:
+            raise ConanException("Cannot export package with same name but different case\n"
+                                 "You exported '%s' but already existing '%s'"
+                                 % (conan_ref_str, " ".join(str(s) for s in refs)))
         output = ScopedOutput(str(conan_ref), self._user_io.out)
         export_conanfile(output, self._paths,
                          conan_file.exports, conan_file_path, conan_ref, keep_source)


Test patch:
diff --git a/conans/test/command/export_test.py b/conans/test/command/export_test.py
--- a/conans/test/command/export_test.py
+++ b/conans/test/command/export_test.py
@@ -6,6 +6,7 @@
 from conans.test.utils.cpp_test_files import cpp_hello_conan_files
 from conans.model.manifest import FileTreeManifest
 from conans.test.tools import TestClient
+from conans.errors import ConanException
 
 
 class ExportTest(unittest.TestCase):
@@ -38,6 +39,15 @@ def test_basic(self):
                          'helloHello0.h': '9448df034392fc8781a47dd03ae71bdd'}
         self.assertEqual(expected_sums, manif.file_sums)
 
+    def test_case_sensitive(self):
+        self.files = cpp_hello_conan_files("hello0", "0.1")
+        self.conan_ref = ConanFileReference("hello0", "0.1", "lasote", "stable")
+        self.conan.save(self.files)
+        error = self.conan.run("export lasote/stable", ignore_error=True)
+        self.assertTrue(error)
+        self.assertIn("ERROR: Cannot export package with same name but different case",
+                      self.conan.user_io.out)
+
     def test_export_filter(self):
         content = """
 from conans import ConanFile