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

Fix relaunching scancode on Apple silicon using Rosetta 2 emulation #2835 #3018

Merged
merged 3 commits into from
Jul 11, 2022

Commits on Jul 9, 2022

  1. Only relaunch scancode when not in emulation mode aboutcode-org#2835

    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 <[email protected]>
    MarcelBochtler committed Jul 9, 2022
    Configuration menu
    Copy the full SHA
    6a01546 View commit details
    Browse the repository at this point in the history
  2. 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.
    
    Signed-off-by: Marcel Bochtler <[email protected]>
    MarcelBochtler committed Jul 9, 2022
    Configuration menu
    Copy the full SHA
    58b8a89 View commit details
    Browse the repository at this point in the history

Commits on Jul 11, 2022

  1. Support extractcode on Apple ARM chip nexB#2835

    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 <[email protected]>
    Authored-by: Marcel Bochtler <[email protected]>
    Signed-off-by: Philippe Ombredanne <[email protected]>
    pombredanne authored Jul 11, 2022
    Configuration menu
    Copy the full SHA
    f6064ea View commit details
    Browse the repository at this point in the history