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 deleting duplicated rpaths #208

Merged
merged 5 commits into from
Mar 21, 2024
Merged

Conversation

isuruf
Copy link
Collaborator

@isuruf isuruf commented Mar 21, 2024

No description provided.

Copy link

codecov bot commented Mar 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.80%. Comparing base (43ad6b3) to head (9b59f36).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #208      +/-   ##
==========================================
- Coverage   96.80%   96.80%   -0.01%     
==========================================
  Files          15       15              
  Lines        1285     1283       -2     
==========================================
- Hits         1244     1242       -2     
  Misses         41       41              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@HexDecimal HexDecimal left a comment

Choose a reason for hiding this comment

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

There are performance implications to calling replace_signature multiple times. It is already called too many times for the same file in the current code.

Let delete_rpath take multiple paths. Counter can be useful to track when a parameter must be given multiple times. Actually just iterating over the paths one at a time is fine as long as replace_signature is called only once.

If a new function must be added then make it private: def _delete_rpath

Mind editing the docs for get_rpaths to clarify that duplicate rpaths may be returned?

@isuruf
Copy link
Collaborator Author

isuruf commented Mar 21, 2024

Sorry, didn't see your edit. Shall I revert the Counter changes?

Copy link
Collaborator

@HexDecimal HexDecimal left a comment

Choose a reason for hiding this comment

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

I still think _delete_rpath should take an iterable of paths to remove (paths: Iterable[str]). replace_signature and logging would be moved into _delete_rpath.

Then _remove_absolute_rpaths would be simplified to this:

_delete_rpath(
    filename,
    (rpath for rpath in get_rpaths(filename) if not _is_rpath_sanitary(rpath)),
)

Copy link
Collaborator

@HexDecimal HexDecimal left a comment

Choose a reason for hiding this comment

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

Close to finishing. This should also be mentioned as a fix in the changelog.

Comment on lines 901 to 903

if ad_hoc_sign:
replace_signature(filename, "-")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Redundant since _delete_rpaths handles signing.

Suggested change
if ad_hoc_sign:
replace_signature(filename, "-")

Changelog.md Outdated
Comment on lines 28 to 29
- Fixes deleting duplicated rpaths when sanitize-rpaths option is turned on.
[#208](https://github.com/matthew-brett/delocate/pull/208)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Less vague changelog item.

Suggested change
- Fixes deleting duplicated rpaths when sanitize-rpaths option is turned on.
[#208](https://github.com/matthew-brett/delocate/pull/208)
- `--sanitize-rpaths` was not removing duplicate rpaths.
[#208](https://github.com/matthew-brett/delocate/pull/208)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed this to '--sanitize-rpaths was failing with duplicate rpaths.' as it was failing with an exception from subprocess.

Copy link
Collaborator

@HexDecimal HexDecimal left a comment

Choose a reason for hiding this comment

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

Latest commit mentioned but did not touch the redundant replace_signature call.

At this point I can handle the rest if you're finished.

@HexDecimal HexDecimal self-assigned this Mar 21, 2024
@isuruf isuruf merged commit eed8f25 into matthew-brett:master Mar 21, 2024
15 checks passed
@isuruf isuruf deleted the delete_rpath branch March 21, 2024 20:42
@isuruf
Copy link
Collaborator Author

isuruf commented Mar 21, 2024

Thanks @HexDecimal for the reviews.

@isuruf
Copy link
Collaborator Author

isuruf commented Mar 22, 2024

@HexDecimal is there a release planned for delocate?

@HexDecimal
Copy link
Collaborator

I'm slightly hesitant with the recent changes and the changes I've been considering, but nothing is actually preventing a release it in its current state. I'll do a release now. I probably should've done one earlier.

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.

2 participants