Skip to content

darwin: preserve hardlinks on codesign/install_name_tool#47808

Merged
alalazo merged 7 commits intodevelopfrom
hs/darwin/codesign-in-place
Nov 28, 2024
Merged

darwin: preserve hardlinks on codesign/install_name_tool#47808
alalazo merged 7 commits intodevelopfrom
hs/darwin/codesign-in-place

Conversation

@haampie
Copy link
Copy Markdown
Member

@haampie haampie commented Nov 26, 2024

closes #47691

codesign and install_name_tool create a new inodes, which breaks hardlinks. So instead run it on a file copy and copy contents back to the original file.

@spackbot-app spackbot-app bot added binary-packages core PR affects Spack core functionality labels Nov 26, 2024
@paulgessinger
Copy link
Copy Markdown
Contributor

Hey @haampie, I tried out this patch, and it does not currently work on it's own. I tried to debug when the hard-link gets broken, and to me it seems like it happens already when the bin/git binary is relocated, i.e. before codesign runs.

I tried adding the same temporary file mechanism to the install_name_tool invocation, and that seems to work for me.

I have a patch for this in this gist.

@haampie
Copy link
Copy Markdown
Member Author

haampie commented Nov 26, 2024

Hm, forgot that we used that. That's rather annoying, install name tool technically has no good reason to modify files out of place. Maybe a regression in the tool?

@paulgessinger
Copy link
Copy Markdown
Contributor

paulgessinger commented Nov 26, 2024

It could be. It's not obvious to me how install_name_tool is supposed to behave with hardlinks.

If it is a regression, would you want to gate the workaround based on tool version? Otherwise, is there any reason not to apply the workaround?

@haampie
Copy link
Copy Markdown
Member Author

haampie commented Nov 26, 2024

the workaround is fine, just wish we didn't have to. if it's a regression we should report a bug with xcode.

@spackbot-app spackbot-app bot added tests General test capability(ies) utilities labels Nov 27, 2024
@haampie haampie changed the title darwin: preserve hardlinks on codesign darwin: preserve hardlinks on codesign/install_name_tool Nov 27, 2024
@haampie
Copy link
Copy Markdown
Member Author

haampie commented Nov 27, 2024

Need to wrap more calls to install_name_tool still. Not entirely happy about the g.flush() bit, but don't see an obvious way to avoid doubly closing the file descriptor.

@haampie haampie force-pushed the hs/darwin/codesign-in-place branch from 23eef29 to d058a41 Compare November 28, 2024 10:00
@alalazo alalazo merged commit b74db34 into develop Nov 28, 2024
@alalazo alalazo deleted the hs/darwin/codesign-in-place branch November 28, 2024 13:57
@haampie haampie added the v0.23.1 PRs to backport for v0.23.1 label Nov 28, 2024
fryeguy52 pushed a commit to fryeguy52/spack that referenced this pull request Dec 17, 2024
kshea21 pushed a commit to kshea21/spack that referenced this pull request Dec 26, 2024
@haampie haampie mentioned this pull request Feb 3, 2025
27 tasks
teaguesterling pushed a commit to teaguesterling/spack that referenced this pull request Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

binary-packages core PR affects Spack core functionality tests General test capability(ies) utilities v0.23.1 PRs to backport for v0.23.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

darwin: hardlinks broken by codesign/install_name_tool

3 participants