Fix relaunching scancode on Apple silicon using Rosetta 2 emulation #2835 - #3018
Merged
Merged
Conversation
Running `uname -m` on Apple silicon machines always results in `arm64`, regardless if Bash is running in Rosetta 2 emulation or natively. Check if scancode and configure is running in emulation mode (see [1]), before relaunching it, to avoid an infinite loop. [1]: https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment Signed-off-by: Marcel Bochtler <git@bochtler.io>
Calling `bash -c` with `$@` results in only the first parameter being passed to the subshell. Use `$*` to ensure all parameters are correctly passed to the Rosetta 2 emulated subshell. Signed-off-by: Marcel Bochtler <git@bochtler.io>
pombredanne
approved these changes
Jul 11, 2022
pombredanne
left a comment
Member
There was a problem hiding this comment.
@MarcelBochtler Thank you ++ for testing and fixing this.... you are awesome!
This commit carries over a patch applied to the scancode and configure scripts to ensure that extractcode can work correctly in X86 emulated mode on Apple ARM silicon, * Only relaunch extractcode when not in emulation mode Running `uname -m` on Apple silicon machines always results in `arm64`, regardless if Bash is running in Rosetta 2 emulation or natively. Check if extractcode is running in emulation mode (see [1]), before relaunching it, to avoid an infinite loop. *Pass all parameters to the relaunched shell Calling `bash -c` with `$@` results in only the first parameter being passed to the subshell. Use `$*` to ensure all parameters are correctly passed to the Rosetta 2 emulated subshell. [1]: https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment Reported-by: Marcel Bochtler <git@bochtler.io> Authored-by: Marcel Bochtler <git@bochtler.io> Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Member
|
@MarcelBochtler I carried over your patch to the |
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #2835.
Tasks
Run tests locally to check for errors.