Skip to content

Make file writable before applying strip#12

Open
dominicletz wants to merge 1 commit intomainfrom
cursor/file-writeable-before-strip-5dbd
Open

Make file writable before applying strip#12
dominicletz wants to merge 1 commit intomainfrom
cursor/file-writeable-before-strip-5dbd

Conversation

@dominicletz
Copy link
Contributor

Summary

Fixes elixir-desktop/desktop-example-app#31

On macOS, the strip command fails with "Permission denied" when processing .so files (e.g. NIF libraries like asn1rt_nif.so) that have read-only permissions. strip modifies files in-place and requires write access.

Changes

  • Call File.chmod!(file, Bitwise.bor(File.lstat!(file).mode, 0o200)) before running strip in strip_symbols/1
  • This adds the write bit to the file's mode, matching the pattern already used in file_replace/3 in the same module
  • Refactored strip_symbols/1 to avoid duplicating the chmod call across the three strip branches

Testing

The fix follows the existing file_replace/3 pattern which already uses File.chmod! to ensure files are writable before modification.

Open in Web Open in Cursor 

Fixes elixir-desktop/desktop-example-app#31

The strip command modifies files in-place and fails with 'Permission denied'
when files (e.g. .so NIF libraries) have read-only permissions. Ensure the
file is writable with File.chmod! before running strip, matching the pattern
already used in file_replace/3.

Co-authored-by: Dominic Letz <dominicletz@users.noreply.github.com>
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.

MacOS install error

2 participants