Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] The deployer runtime_deploy should preserve symlinks #17824

Merged
merged 8 commits into from
Feb 25, 2025

Conversation

uilianries
Copy link
Member

@uilianries uilianries commented Feb 21, 2025

Changelog: Fix: runtime_deploy preserves symbolic links along with their libraries.
Docs: conan-io/docs#3992

When some application links to a shared on Linux, it keeps its name expected to be loaded at runtime. The current runtime_deploy only provides *.so but doesn't preserve original symlinks, failing the application when running.

Still, there is a case of preserving subfolders in the structure, but I don't want to include it in this PR to keep it as simple as possible.

Related to #16938

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
@uilianries uilianries marked this pull request as ready for review February 21, 2025 09:11
@uilianries uilianries changed the title [hotfix] The deployer runtime_deploy should preserve symlinks [fix] The deployer runtime_deploy should preserve symlinks Feb 21, 2025
Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@pytest.mark.parametrize("symlink, expected",
[(True, ["libfoo.so.0.1.0", "libfoo.so.0", "libfoo.so"]),
(False, ["libfoo.so.0.1.0",])])
def test_runtime_deploy_symlinks(symlink, expected):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt this test be skipped for Windows?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be skipped for Windows, but keeping it we make sure we are not breaking in Windows as a regression test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isee, this test will fail in Windows machines without symlinks enabled:

>>> os.symlink("potato", "mypotato")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [WinError 1314] A required privilege is not held by the client

It passes because in our CI maybe we enabled it, it is not the default.
But ok, if it works in Windows if symlinks enabled, good then, I'll try to remind it when running locally.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment will be nice

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we protect users by checking if symlink is enabled in Windows and avoid copying symlinks. Or, raise a ConanException when symlinks=True and Windows symlinks is not enabled. At least, it would not break with a OSError for users.

@memsharded memsharded added this to the 2.13.0 milestone Feb 21, 2025
Co-authored-by: James <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
@czoido czoido merged commit 1ac69d3 into conan-io:develop2 Feb 25, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants