From 5ebc4febe6f1f0b926470bed700183f2da731996 Mon Sep 17 00:00:00 2001 From: Hieu Nguyen Date: Thu, 15 Aug 2024 13:35:20 -0400 Subject: [PATCH] Fix problem of RepackApexPayload when using option --signing_args The apex_util -> deapexer transition still passes signing args in as 1 huge string, just without the double qoutes. Once deapexer receives the arugment, deapexer would attempt to shlex it, but double quotes prevents proper shlexing, hence remove the double quotes. As we added to log to monitor args parser when run apexer from RepackApexPayload 2024-07-30 12:42:03 - common.py - INFO : Individual args list: ['/home/hieu/aosp/out/host/linux-x86/bin/apexer', '--force', '--payload_only', '--do_not_check_keyname', '--apexer_tool_path', '/home/hieu/aosp/out/host/linux-x86/bin:/home/hieu/aosp/out/host/linux-x86/bin:/home/hieu/aosp/out/host/linux-x86/bin:/home/hieu/aosp/prebuilts/clang/host/linux-x86/llvm-binutils-stable:/home/hieu/aosp/prebuilts/asuite/acloud/linux-x86:/home/hieu/aosp/prebuilts/asuite/aidegen/linux-x86:/home/hieu/aosp/prebuilts/asuite/atest/linux-x86:/home/hieu/aosp/prebuilts/jdk/jdk17/linux-x86/bin:/home/hieu/aosp/build/bazel/bin:/home/hieu/aosp/development/scripts:/home/hieu/aosp/prebuilts/devtools/tools:/home/hieu/aosp/prebuilts/misc/linux-x86/dtc:/home/hieu/aosp/prebuilts/misc/linux-x86/libufdt:/home/hieu/aosp/prebuilts/android-emulator/linux-x86_64:/home/hieu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_2.2.4.0_x64__8wekyb3d8bbwe:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/7-Zip:/mnt/c/Users/hnguy140/AppData/Local/Microsoft/WindowsApps:/snap/bin', '--manifest', '/tmp/tmpjk8as91m/apex_manifest.pb', '--build_info', '/tmp/tmpjk8as91m/apex_build_info.pb', '--key', 'key_dir/avb.pem', '--signing_args', '--signing_helper_with_files external/fnv/production-sign-tools/production-signing-scripts/IVIMB/signing_helper/avb_signing_helper.py', '/tmp/tmpji2gvei4', '/tmp/tmpjk8as91m/apex_payload.img', '-v'] As monitor from the above log '--signing_helper_with_files .../avb_signing_helper.py' is considered as a single argument which make apexer to be confused. The correct ways of parsing arguments is '--signing_helper_with_files' and '.../avb_signing_helper' should be separate to 2 arguments instead merge it as one like current implementation. Change-Id: I913b6b3f2ff03d8ce2333b1c2c38178967766778 Signed-off-by: Hieu Nguyen --- tools/releasetools/apex_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py index 3abef3bece..1b0b89a2cc 100644 --- a/tools/releasetools/apex_utils.py +++ b/tools/releasetools/apex_utils.py @@ -198,7 +198,7 @@ class ApexApkSigner(object): # --signing_args "--signing_helper_with_files=%path" to apexer if signing_args: generate_image_cmd.extend( - ['--signing_args', '"{}"'.format(signing_args)]) + ['--signing_args', signing_args]) # optional arguments for apex repacking manifest_json = os.path.join(apex_dir, 'apex_manifest.json')