ITADN

[Bug]: scripts/generate-bootstraps.sh: --build argument cross-pollutes the second bootstrap with incompatible binaries if more than one architecture is specified by --architectures

#8Closedrobertkirkman 创建于 2024-12-09
R
robertkirkmancommented
### Problem description Trying to install and run any x86_64 termux-play-store bootstrap on Android-x86 that was built in certain ways that allow packages from a previously-built aarch64 bootstrap to pollute the next bootstrap built, will produce this error: ``` error: "/data/data/com.termux/files/usr/bin/dash" is for EM_AARCH64 (183) instead of EM_X86_64 (62) [Process completed (code 1) - press Enter] ``` ### What steps will reproduce the bug? ```bash git clone https://github.com/termux-play-store/termux-packages.git cd termux-packages scripts/run-docker.sh scripts/generate-bootstraps.sh --build --architectures aarch64,x86_64 # (also reproducible with this command because the default is the same as with the explicit argument) # scripts/run-docker.sh scripts/generate-bootstraps.sh --build unzip -d bootstrap-x86_64 bootstrap-x86_64.zip file bootstrap-x86_64/bin/dash ``` Troubleshooting print statement to help pinpoint the root cause of the problem: ```diff --- a/scripts/generate-bootstraps.sh +++ b/scripts/generate-bootstraps.sh @@ -132,6 +132,12 @@ pull_package() { PACKAGE_METADATA["$deb_package_name"]="$control" if [ "$package_name" = "$deb_package_name" ]; then built_package_deb="$f" + echo "============= pull_package info ==============" + echo "TERMUX_BUILD_BOOTSTRAPS: true" + echo "package_name: $package_name" + echo "package_arch: $package_arch" + echo "filename: $built_package_deb" + echo "==============================================" fi done if [ -z "$built_package_deb" ]; then ``` Snippet of output from troubleshooting print statement: ``` ============= pull_package info ============== TERMUX_BUILD_BOOTSTRAPS: true package_name: libbz2 package_arch: x86_64 filename: output/libbz2_1.0.8-7_aarch64.deb ============================================== ``` Note the mismatch between the desired architecture, and the architecture in the filename of the detected package file. I think it is possible that the cause could be directly related to this line which is detecting packages of all architectures in the `output` folder, not only the intended architecture and the "all"-architecture packages. https://github.com/termux-play-store/termux-packages/blob/83d2967f2a131d75e35b44ad3c24014210a43f1b/scripts/generate-bootstraps.sh#L129 ### What is the expected behavior? The expected behavior can be forced by applying any one of the following workarounds: - build bootstraps using separate commands instead of a single command ```bash scripts/run-docker.sh scripts/generate-bootstraps.sh --build --architectures aarch64 scripts/run-docker.sh scripts/generate-bootstraps.sh --build --architectures x86_64 ``` - only build a single bootstrap (viable workaround if only one bootstrap is needed) ```bash scripts/run-docker.sh scripts/generate-bootstraps.sh --build --architectures x86_64 ``` ### System information ```shell N/A ```
关闭于 2025-01-10 1 条评论