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

Allow list of chunks to be given to strip*() #2114

Merged
merged 1 commit into from Mar 18, 2019

Conversation

michaelkschmidt
Copy link
Contributor

This allows other BEAM languages to specify additional chunks that should be preserved. The immediate need is 'Attr' for Elixir.

See whitfin/cachex#205 for full details on the original issue.

@CLAassistant
Copy link

CLAassistant commented Jan 28, 2019

CLA assistant check
All committers have signed the CLA.

@ferd
Copy link
Contributor

ferd commented Jan 28, 2019

Wait, does that mean that if I strip modules, I may end up with parts of my build keeping info I expect to be gone once in production? Some of these things you possibly do not want to ever hit a production server.

@michaelkschmidt
Copy link
Contributor Author

@ferd I agree--the issue is that some Elixir modules (like cachex) need the 'Attr' chunk. Without it module.__info__(:attributes)will not work.

Its standard practice for IoT devices to strip debug information prior to release. This change only exposes an API to allow the list of chunks to be passed in. It's still up to the end user to decide what chunks should be passed on to the final release. Without this, you wind up having to do hacks like https://github.com/se-apc/strip_plugin/blob/master/lib/strip_plugin.ex

@jhogberg jhogberg added the team:VM Assigned to OTP team VM label Jan 29, 2019
@jhogberg jhogberg self-assigned this Jan 29, 2019
Copy link
Contributor

@jhogberg jhogberg left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I think it's a reasonable extension, and it looks good aside from a minor issue with the new interface. Can you update the tests and documentation?

Wait, does that mean that if I strip modules, I may end up with parts of my build keeping info I expect to be gone once in production? Some of these things you possibly do not want to ever hit a production server.

The current behavior remains unchanged, so I think it will be fine as long as the build tools that use this feature are clear about what they're doing.

strip_release/1,
strip_release/2,
significant_chunks/0,
Copy link
Contributor

Choose a reason for hiding this comment

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

The loader requires all "significant chunks" to be present, so it feels a bit heavy to require the user to provide them in all calls to strip*/2. It would be simpler if the second parameter were the chunks to preserve in addition to the significant ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is a good point. I'll change it to prepend any additional chunks

@michaelkschmidt
Copy link
Contributor Author

@jhogberg I made the suggested change and updated the docs. Please let me know if you need anything else.

@jhogberg
Copy link
Contributor

jhogberg commented Feb 1, 2019

Thank you, can you add a test as well?

@jhogberg jhogberg added the waiting waiting for changes/input from author label Feb 6, 2019
@jhogberg jhogberg added stalled waiting for input by the Erlang/OTP team and removed waiting waiting for changes/input from author labels Feb 21, 2019
This allows extra chunks to be preserved for languages such as Elixir
@michaelkschmidt
Copy link
Contributor Author

@jhogberg sorry for the delay. I believe I have added a test which verifies the additional chunks are preserved, and I squashed all commits into 1

@bjorng bjorng added testing currently being tested, tag is used by OTP internal CI and removed stalled waiting for input by the Erlang/OTP team labels Mar 11, 2019
@michaelkschmidt
Copy link
Contributor Author

@jhogberg Are there any other changes you would like?

@jhogberg jhogberg merged commit 875eef3 into erlang:master Mar 18, 2019
@jhogberg
Copy link
Contributor

Sorry for the delay, I just got back from a cold. It looks good so I merged it to master, thanks again for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants