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

MachO::MachOFile#delete_rpath does not work #355

Closed
carlocab opened this issue May 13, 2021 · 3 comments
Closed

MachO::MachOFile#delete_rpath does not work #355

carlocab opened this issue May 13, 2021 · 3 comments
Labels

Comments

@carlocab
Copy link
Member

If you compile a dylib, say libfoo.dylib and open it using

file = MachO::MachOFile.new("libfoo.dylib")

and then use file.delete_rpath to delete an LC_RPATH entry, nothing happens. I do get a large amount of text in my terminal, but that's from delete_rpath dumping raw_data entries in my terminal.

On the other hand, using MachO::Tools.delete_rpath does seem to work.

I'll try to dig into why one seems to be working when the other doesn't.

@carlocab
Copy link
Member Author

Not sure I understand why this is happening, though, since I think MachO::Tools.delete_rpath just makes use of MachO::MachOFile#delete_rpath:

def self.delete_rpath(filename, old_path, options = {})
file = MachO.open(filename)
file.delete_rpath(old_path, options)
file.write!
end

@carlocab
Copy link
Member Author

Oh, I see. It's the additional write! call that's needed here. This is why delegating delete_rpath never worked properly here:

https://github.com/Homebrew/brew/blob/7c68b1738b3dce2885d0146f327eaaf96b6d0029/Library/Homebrew/os/mac/mach.rb#L13

@carlocab
Copy link
Member Author

This seems to be by design, so I'm closing this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant