appium / appium-xcuitest-driver

Appium iOS driver, backed by Apple XCTest
https://appium.github.io/appium-xcuitest-driver/
Apache License 2.0
752 stars 420 forks source link

fix: use lipo -info instead of file for architecture detection #2478

Closed arietis closed 1 month ago

arietis commented 1 month ago

Summary:

This PR updates the verifyApplicationPlatform function to use lipo -info instead of the file command for determining the architectures supported by the app’s executable. The change improves accuracy when verifying compatibility on both Intel and Apple Silicon devices by aligning with the consistent output format of lipo.

Reasoning:

Inconsistent file Output: The file command’s output can vary based on the system, leading to unreliable architecture detection.

Consistent lipo Output: lipo -info provides consistent architecture details, which makes it a better choice for ensuring the correct Simulator architecture is detected.

Simplified Logic: This change also simplifies string matching and error handling, reducing potential issues with cross-architecture setups.

Example of inconsistent file Output

# System version:
/usr/bin/file --version
file-5.41
/usr/bin/file test.app
test.app/test: Mach-O 64-bit executable arm64

# Custom version in PATH:
file --version
file-5.45
file test.app
test.app/test: Mach-O 64-bit arm64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE>

Example of consistent lipo Output

lipo -info test.app
Non-fat file: test.app/test is architecture: arm64
linux-foundation-easycla[bot] commented 1 month ago

CLA Signed


The committers listed above are authorized under a signed CLA.

github-actions[bot] commented 1 month ago

:tada: This PR is included in version 7.27.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

jlipps commented 2 weeks ago

Hi @arietis, congrats, the Appium project wants to compensate you for this contribution! Please reply to this comment mentioning me and sharing your OpenCollective account name, so that we can initiate payment! Or let me know if you decline to receive compensation via OpenCollective. Thank you!

arietis commented 2 weeks ago

@jlipps sergei-guselnikov Thank you!