diff --git a/lib.sh b/lib.sh index 601a303..1b6430a 100755 --- a/lib.sh +++ b/lib.sh @@ -116,7 +116,7 @@ function get_normalized_package_list { architecture=$(dpkg --print-architecture) local result - #IMPORTANT: we rely on a list style input to the apt_query binary with ${packages}, do remove this lint disable! + # IMPORTANT: we rely on a list style input to the apt_query binary with ${packages}, do remove this lint disable! if [ "${architecture}" == "arm64" ]; then # shellcheck disable=SC2086 result=$("${script_dir}/apt_query-arm64" normalized-list ${packages} 2>&1) @@ -134,11 +134,11 @@ function get_normalized_package_list { return 1 fi - # Remove "Reverse=Provides: " prefix from strings if present + # WORKAROUND: Remove "Reverse=Provides: " prefix from strings if present, + # the go binary can return this prefix sometimes and it messes a bunch of things up. local clean_result clean_result="${result//Reverse=Provides: /}" - # Debug logging to stderr (won't interfere with return value captured via command substitution) if [[ "${-}" == *x* ]] || [ "${DEBUG:-${debug}}" = "true" ]; then echo "packages after sed: '${packages}'" >&2 echo "original apt-query result: '${result}'" >&2 diff --git a/post_cache_action.sh b/post_cache_action.sh index f8c7707..388dd14 100755 --- a/post_cache_action.sh +++ b/post_cache_action.sh @@ -49,7 +49,9 @@ fi if test "${cache_hit}" = "true"; then "${script_dir}/restore_pkgs.sh" "${cache_dir}" "${cache_restore_root}" "${execute_install_scripts}" "${debug}" else - "${script_dir}/install_and_cache_pkgs.sh" "${cache_dir}" "${debug}" "${add_repository}" "${packages}" + # shellcheck disable=SC2086 + # INTENTIONAL: packages must be unquoted to expand into separate arguments for install_and_cache_pkgs.sh + "${script_dir}/install_and_cache_pkgs.sh" "${cache_dir}" "${debug}" "${add_repository}" ${packages} fi log_empty_line diff --git a/src/cmd/apt_query/testlogs/testnormalizedlist_virtualpackagesexists_stdoutsconcretepackage.log b/src/cmd/apt_query/testlogs/testnormalizedlist_virtualpackagesexists_stdoutsconcretepackage.log index 8c2d1b2..58d6b77 100644 --- a/src/cmd/apt_query/testlogs/testnormalizedlist_virtualpackagesexists_stdoutsconcretepackage.log +++ b/src/cmd/apt_query/testlogs/testnormalizedlist_virtualpackagesexists_stdoutsconcretepackage.log @@ -1,15 +1,19 @@ -2025/11/03 17:44:59 Debug log created at /Users/mac/Documents/src/cache-apt-pkgs-action/src/cmd/apt_query/apt_query.log -2025/11/03 17:44:59 EXECUTION-OBJ-START +2025/03/15 22:29:14 Debug log created at /home/awalsh128/cache-apt-pkgs-action/src/cmd/apt_query/apt_query.log +2025/03/15 22:29:14 EXECUTION-OBJ-START { "Cmd": "apt-cache --quiet=0 --no-all-versions show libvips", + "Stdout": "", + "Stderr": "N: Can't select candidate version from package libvips as it has no candidate\nN: Can't select versions from package 'libvips' as it is purely virtual\nN: No packages found\n", "CombinedOut": "N: Can't select candidate version from package libvips as it has no candidate\nN: Can't select versions from package 'libvips' as it is purely virtual\nN: No packages found\n", "ExitCode": 0 } EXECUTION-OBJ-END -2025/11/03 17:44:59 EXECUTION-OBJ-START +2025/03/15 22:29:14 EXECUTION-OBJ-START { - "Cmd": "bash -c apt-cache showpkg libvips | grep -A 1 \"Reverse Provides\" | grep -v \"Reverse Provides\" | tail -1", - "CombinedOut": "libvips42t64 8.16.0-2build1 (= )\n", + "Cmd": "bash -c apt-cache showpkg libvips | grep -A 1 \"Reverse Provides\" | tail -1", + "Stdout": "libvips42 8.9.1-2 (= )\n", + "Stderr": "", + "CombinedOut": "libvips42 8.9.1-2 (= )\n", "ExitCode": 0 } EXECUTION-OBJ-END