lasote: Solve the conflict and merge
lasote: Still broken

diff --git a/conans/client/cmd/uploader.py b/conans/client/cmd/uploader.py
index 619aea22f..650e28827 100644
--- a/conans/client/cmd/uploader.py
+++ b/conans/client/cmd/uploader.py
@@ -136,10 +136,14 @@ class CmdUpload(object):
                     raise NotFoundException(("There is no local conanfile exported as %s" %
                                              str(ref)))
 
-                package_layout = self._cache.package_layout(ref)
-                if all_packages:
-                    packages_ids = package_layout.conan_packages()
-                elif query:
+                # TODO: This search of binary packages has to be improved, more robust
+                # So only real packages are retrieved
+                if all_packages or query:
+                    if all_packages:
+                        query = None
+                    # better to do a search, that will retrieve real packages with ConanInfo
+                    # Not only "package_id" folders that could be empty
+                    package_layout = self._cache.package_layout(ref.copy_clear_rev())
                     packages = search_packages(package_layout, query)
                     packages_ids = list(packages.keys())
                 elif package_id:
@@ -164,7 +168,11 @@ class CmdUpload(object):
                 prefs = []
                 # Gather all the complete PREFS with PREV
                 for package_id in packages_ids:
+                    if package_id not in metadata.packages:
+                        raise ConanException("Binary package %s:%s not found"
+                                             % (str(ref), package_id))
                     package_revision = metadata.packages[package_id].revision
+                    assert package_revision is not None, "PREV cannot be None to upload"
                     prefs.append(PackageReference(ref, package_id, package_revision))
                 refs_by_remote[remote].append((ref, conanfile, prefs))
 
diff --git a/conans/client/remover.py b/conans/client/remover.py
index c8bc01227..0ae51bc67 100644
--- a/conans/client/remover.py
+++ b/conans/client/remover.py
@@ -51,7 +51,8 @@ class DiskRemover(object):
         if not ids:
             path = package_layout.builds()
             for build in package_layout.conan_builds():
-                self._remove(os.path.join(path, build), package_layout.ref, "build folder:%s" % build)
+                self._remove(os.path.join(path, build), package_layout.ref,
+                             "build folder:%s" % build)
             self._remove(path, package_layout.ref, "builds")
         else:
             for id_ in ids:

conan info generates bad .conan_link files
To help us debug your issue please explain:

- [x] I've read the [CONTRIBUTING guide](https://github.com/conan-io/conan/blob/develop/.github/CONTRIBUTING.md).
- [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.

Operating System: Windows 10 64-bit
Conan version: v1.11.2

I have a situation where I have two recipes - A and B, and recipe A depends on recipe B. What I do to determine the depdencies between my recipes is:
1. Run `conan export` over all recipes
2. Run `conan info -g out.dot` to generate the dependency graph for all recipes
3. Parse the dependency graph for each recipe to generate the full dependency graph

Once I have the complete graph, I can then traverse it to build the recipes in the right order.

The issue I have is when I run conan info on recipe A (which depends on B), on Windows, I get a `c:\Users\MyUser\.conan\data\recipeB\0.0.2\user\channel\package\69f10d1e6d78c1962fbe8fb80440f32b1fdf8423\.conan_link`.

And that `.conan_link` points to a directory which doesn't exist. So if I now tried to do an upload of all recipeB packages, I get an error from conan saying that particular package is corrupted. Removing that particular package folder (the one with a hash as its name) fixes the issue.

Do you think this issue can be fixed in conan? Currently, we work around the issue by specifically looking for these broken `.conan_link` files and removing the package folders they're in.
diff --git a/conans/test/functional/command/info_folders_test.py b/conans/test/functional/command/info_folders_test.py
index 71f9b4711..117120795 100644
--- a/conans/test/functional/command/info_folders_test.py
+++ b/conans/test/functional/command/info_folders_test.py
@@ -3,12 +3,15 @@ import platform
 import re
 import subprocess
 import unittest
+from textwrap import dedent
 
 from conans.client import tools
 from conans.model.ref import ConanFileReference, PackageReference
 from conans.paths import CONANFILE
 from conans.test.utils.test_files import temp_folder
-from conans.test.utils.tools import NO_SETTINGS_PACKAGE_ID, TestClient
+from conans.test.utils.tools import NO_SETTINGS_PACKAGE_ID, TestClient,\
+    TestServer
+
 
 conanfile_py = """
 from conans import ConanFile
@@ -108,9 +111,8 @@ class InfoFoldersTest(unittest.TestCase):
         self.assertIn(os.path.join(base_path, "build"), output)
         self.assertNotIn("package", output)
 
+    @unittest.skipIf(platform.system() != "Windows", "Needs windows for short_paths")
     def test_short_paths(self):
-        if platform.system() != "Windows":
-            return
         folder = temp_folder(False)
         short_folder = os.path.join(folder, ".cn")
 
@@ -141,23 +143,23 @@ class InfoFoldersTest(unittest.TestCase):
                 self.assertFalse(os.path.exists(path))
                 self.assertTrue(os.path.exists(os.path.dirname(path)))
 
+    @unittest.skipIf(platform.system() != "Windows", "Needs windows for short_paths")
     def test_short_paths_home_set_acl(self):
         """
         When CONAN_USER_HOME_SHORT is living in NTFS file systems, current user needs to be
-        granted with full control permission to avoid access problems when cygwin/msys2 windows subsystems
-        are mounting/using that folder.
+        granted with full control permission to avoid access problems when cygwin/msys2
+        windows subsystems are mounting/using that folder.
         """
-        if platform.system() != "Windows":
-            return
-
         folder = temp_folder(False)  # Creates a temporary folder in %HOME%\appdata\local\temp
 
-        out = subprocess.check_output("wmic logicaldisk %s get FileSystem" % os.path.splitdrive(folder)[0])
+        out = subprocess.check_output("wmic logicaldisk %s get FileSystem"
+                                      % os.path.splitdrive(folder)[0])
         if "NTFS" not in str(out):
             return
         short_folder = os.path.join(folder, ".cnacls")
 
-        self.assertFalse(os.path.exists(short_folder), "short_folder: %s shouldn't exists" % short_folder)
+        self.assertFalse(os.path.exists(short_folder), "short_folder: %s shouldn't exists"
+                         % short_folder)
         os.makedirs(short_folder)
 
         current_domain = os.environ['USERDOMAIN']
@@ -179,7 +181,8 @@ class InfoFoldersTest(unittest.TestCase):
 
         # Retrieve ACLs from short_folder
         try:
-            short_folder_acls = subprocess.check_output("cacls %s" % short_folder, stderr=subprocess.STDOUT)
+            short_folder_acls = subprocess.check_output("cacls %s" % short_folder,
+                                                        stderr=subprocess.STDOUT)
         except subprocess.CalledProcessError as e:
             raise Exception("Error %s getting ACL from short_folder: '%s'." % (e, short_folder))
 
@@ -196,3 +199,29 @@ class InfoFoldersTest(unittest.TestCase):
         self.assertNotIn("source_folder", output)
         self.assertNotIn("build_folder", output)
         self.assertNotIn("package_folder", output)
+
+    @unittest.skipIf(platform.system() != "Windows", "Needs windows for short_paths")
+    def test_short_paths_folders(self):
+        # https://github.com/conan-io/conan/issues/4612
+        folder = temp_folder(False)
+        short_folder = os.path.join(folder, ".cn")
+
+        conanfile = dedent("""
+            from conans import ConanFile
+
+            class Conan(ConanFile):
+                short_paths=True
+            """)
+        with tools.environment_append({"CONAN_USER_HOME_SHORT": short_folder}):
+            client = TestClient(base_folder=folder, servers={"default": TestServer()},
+                                users={"default": [("lasote", "mypass")]})
+            client.save({CONANFILE: conanfile})
+            client.run("export . pkga/0.1@lasote/testing")
+            client.run("info pkga/0.1@lasote/testing --paths")
+            self.assertIn("source_folder: %s" % short_folder, client.out)
+            self.assertIn("build_folder: %s" % short_folder, client.out)
+            self.assertIn("package_folder: %s" % short_folder, client.out)
+
+            client.run("upload pkga/0.1@lasote/testing --all")
+            self.assertIn("Uploaded conan recipe", client.out)
+            self.assertNotIn("Uploading package 1/1", client.out)
diff --git a/conans/test/functional/command/upload_test.py b/conans/test/functional/command/upload_test.py
index d578998fa..8064df461 100644
--- a/conans/test/functional/command/upload_test.py
+++ b/conans/test/functional/command/upload_test.py
@@ -12,6 +12,7 @@ from conans.paths import EXPORT_SOURCES_TGZ_NAME, PACKAGE_TGZ_NAME
 from conans.test.utils.cpp_test_files import cpp_hello_conan_files
 from conans.test.utils.tools import NO_SETTINGS_PACKAGE_ID, TestClient, TestServer
 from conans.util.files import gzopen_without_timestamps, is_dirty, save
+from conans.test.utils.conanfile import TestConanFile
 
 conanfile = """from conans import ConanFile
 class MyPkg(ConanFile):
@@ -37,6 +38,14 @@ class MyPkg(ConanFile):
 
 class UploadTest(unittest.TestCase):
 
+    def test_upload_not_existing(self):
+        client = TestClient(servers={"default": TestServer()},
+                            users={"default": [("lasote", "mypass")]})
+        client.save({"conanfile.py": str(TestConanFile("Hello", "0.1"))})
+        client.run("export . Hello/0.1@lasote/testing")
+        client.run("upload Hello/0.1@lasote/testing -p=123", assert_error=True)
+        self.assertIn("ERROR: Binary package Hello/0.1@lasote/testing:123 not found", client.out)
+
     def not_existing_error_test(self):
         """ Trying to upload with pattern not matched must raise an Error
         """
diff --git a/conans/test/functional/old/package_integrity_test.py b/conans/test/functional/old/package_integrity_test.py
index 39b51cdd1..dfa8ce988 100644
--- a/conans/test/functional/old/package_integrity_test.py
+++ b/conans/test/functional/old/package_integrity_test.py
@@ -3,8 +3,9 @@ import unittest
 
 from conans.model.ref import ConanFileReference, PackageReference
 from conans.test.utils.conanfile import TestConanFile
-from conans.test.utils.tools import TestClient, TestServer
-from conans.util.files import save, set_dirty
+from conans.test.utils.tools import TestClient, TestServer,\
+    NO_SETTINGS_PACKAGE_ID
+from conans.util.files import set_dirty
 
 
 class PackageIngrityTest(unittest.TestCase):
@@ -33,21 +34,17 @@ class PackageIngrityTest(unittest.TestCase):
         client = TestClient(servers={"default": test_server},
                             users={"default": [("lasote", "mypass")]})
         client.save({"conanfile.py": str(TestConanFile())})
-        client.run("export . lasote/testing")
+        client.run("create . lasote/testing")
         ref = ConanFileReference.loads("Hello/0.1@lasote/testing")
-        pref = PackageReference(ref, "12345")
+        pref = PackageReference(ref, NO_SETTINGS_PACKAGE_ID)
         package_folder = client.cache.package(pref)
-        recipe_rev = client.cache.package_layout(ref).recipe_revision()
-        with client.cache.package_layout(pref.ref).update_metadata() as metadata:
-            metadata.packages[pref.id].revision = "Fakerevision"
-            metadata.packages[pref.id].recipe_revision = recipe_rev
-        save(os.path.join(package_folder, "conanmanifest.txt"), "888")
         set_dirty(package_folder)
 
         client.run("upload * --all --confirm", assert_error=True)
-        self.assertIn("ERROR: Package Hello/0.1@lasote/testing:12345 is corrupted, aborting upload",
+        self.assertIn("ERROR: Package %s is corrupted, aborting upload" % str(pref),
                       client.out)
-        self.assertIn("Remove it with 'conan remove Hello/0.1@lasote/testing -p=12345'", client.out)
+        self.assertIn("Remove it with 'conan remove Hello/0.1@lasote/testing -p=%s'"
+                      % NO_SETTINGS_PACKAGE_ID, client.out)
 
-        client.run("remove Hello/0.1@lasote/testing -p=12345 -f")
+        client.run("remove Hello/0.1@lasote/testing -p=%s -f" % NO_SETTINGS_PACKAGE_ID)
         client.run("upload * --all --confirm")
diff --git a/conans/test/integration/revisions_test.py b/conans/test/integration/revisions_test.py
index 93ee17a1c..f069e37e8 100644
--- a/conans/test/integration/revisions_test.py
+++ b/conans/test/integration/revisions_test.py
@@ -1524,12 +1524,16 @@ class ServerRevisionsIndexes(unittest.TestCase):
         conanfile = GenConanfile()
         self.c_v1.create(self.ref, conanfile=conanfile)
         self.c_v1.upload_all(self.ref)
+
         pref = self.c_v2.create(self.ref, conanfile=conanfile.with_build_msg("Rev2"))
         self.c_v2.upload_all(self.ref)
 
         latest = self.server.server_store.get_last_revision(self.ref)
         self.assertEquals(latest.revision, pref.ref.revision)
 
+        if get_env("CONAN_TEST_WITH_ARTIFACTORY", False):
+            time.sleep(62)
+
         self.c_v1.create(self.ref, conanfile=conanfile.with_build_msg("Rev3"))
         self.c_v1.upload_all(self.ref)
 

pip install -e .[dev]
parse_log_pytest
requirements.txt
nose nose-cov pytest
apt-get update apt-get install -y gcc g++-multilib wget unzip
3.6
conans/requirements.txt conans/requirements_server.txt conans/requirements_dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
astroid==2.11.7
attrs==22.2.0
beautifulsoup4==4.12.3
bottle==0.12.25
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
colorama==0.4.5
-e git+https://github.com/conan-io/conan.git@c099be8e501154e9901c733736f8f846f00f026f#egg=conan
cov-core==1.15.0
coverage==4.2
deprecation==2.0.7
dill==0.3.4
distro==1.1.0
fasteners==0.19
future==0.16.0
idna==3.10
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
isort==5.10.1
Jinja2==2.11.3
lazy-object-proxy==1.7.1
MarkupSafe==2.0.1
mccabe==0.7.0
mock==1.3.0
node-semver==0.6.1
nose==1.3.7
nose-cov==1.6
packaging==21.3
parameterized==0.8.1
patch==1.16
pbr==6.1.1
platformdirs==2.4.0
pluggy==1.0.0
pluginbase==0.7
py==1.11.0
Pygments==2.14.0
PyJWT==1.7.1
pylint==2.13.9
pyparsing==3.1.4
pytest==7.0.1
PyYAML==3.13
requests==2.27.1
six==1.17.0
soupsieve==2.3.2.post1
tomli==1.2.3
tqdm==4.64.1
typed-ast==1.5.5
typing_extensions==4.1.1
urllib3==1.26.20
waitress==2.0.0
WebOb==1.8.9
WebTest==2.0.35
wrapt==1.16.0
zipp==3.6.0

name: conan
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - astroid==2.11.7
      - attrs==22.2.0
      - beautifulsoup4==4.12.3
      - bottle==0.12.25
      - charset-normalizer==2.0.12
      - codecov==2.1.13
      - colorama==0.4.5
      - cov-core==1.15.0
      - coverage==4.2
      - deprecation==2.0.7
      - dill==0.3.4
      - distro==1.1.0
      - fasteners==0.19
      - future==0.16.0
      - idna==3.10
      - importlib-metadata==4.8.3
      - importlib-resources==5.4.0
      - iniconfig==1.1.1
      - isort==5.10.1
      - jinja2==2.11.3
      - lazy-object-proxy==1.7.1
      - markupsafe==2.0.1
      - mccabe==0.7.0
      - mock==1.3.0
      - node-semver==0.6.1
      - nose==1.3.7
      - nose-cov==1.6
      - packaging==21.3
      - parameterized==0.8.1
      - patch==1.16
      - pbr==6.1.1
      - platformdirs==2.4.0
      - pluggy==1.0.0
      - pluginbase==0.7
      - py==1.11.0
      - pygments==2.14.0
      - pyjwt==1.7.1
      - pylint==2.13.9
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pyyaml==3.13
      - requests==2.27.1
      - six==1.17.0
      - soupsieve==2.3.2.post1
      - tomli==1.2.3
      - tqdm==4.64.1
      - typed-ast==1.5.5
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - waitress==2.0.0
      - webob==1.8.9
      - webtest==2.0.35
      - wrapt==1.16.0
      - zipp==3.6.0
prefix: /opt/conda/envs/conan

conans/test/functional/command/upload_test.py::UploadTest::test_upload_not_existing
conans/test/functional/command/info_folders_test.py::InfoFoldersTest::test_basic conans/test/functional/command/info_folders_test.py::InfoFoldersTest::test_deps_basic conans/test/functional/command/info_folders_test.py::InfoFoldersTest::test_deps_specific_information conans/test/functional/command/info_folders_test.py::InfoFoldersTest::test_direct_conanfile conans/test/functional/command/info_folders_test.py::InfoFoldersTest::test_single_field
conans/client/remover.py conans/client/cmd/uploader.py
conans/client/remover.py conans/client/cmd/uploader.py