From dd861124da201dffe6d8cb1f08023044a103130a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 13 Jun 2026 23:53:03 +0000 Subject: [PATCH] Fix symlink chain caching for Ubuntu 24.04 restore --- .github/workflows/action-tests.yml | 71 ++++++++++++++++++++++++++++++ install_and_cache_pkgs.sh | 24 ++++++++-- 2 files changed, 91 insertions(+), 4 deletions(-) diff --git a/.github/workflows/action-tests.yml b/.github/workflows/action-tests.yml index ef0edca..4d9b1a5 100644 --- a/.github/workflows/action-tests.yml +++ b/.github/workflows/action-tests.yml @@ -925,6 +925,77 @@ jobs: version: ${{ github.run_id }}-${{ github.run_attempt }}-regression_106 debug: ${{ env.DEBUG }} + regression_156_install: + needs: [build_binaries] + runs-on: ubuntu-24.04 + name: "Restore ffmpegthumbnailer shared libraries (regression issue #156, install phase)." + steps: + - uses: actions/checkout@v3.1.0 + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + pattern: cache-apt-pkgs-* + path: distribute-artifacts + - name: Setup distribute directory + shell: bash + run: | + mkdir -p distribute/X64 distribute/X86 distribute/ARM64 distribute/ARM + for artifact_dir in distribute-artifacts/cache-apt-pkgs-*; do + if [ -d "$artifact_dir" ]; then + arch=$(basename "$artifact_dir" | sed 's/cache-apt-pkgs-\([^-]*\)-.*/\1/') + echo "Copying artifacts for architecture: $arch" + cp -r "$artifact_dir"/* "distribute/$arch/" 2>/dev/null || true + fi + done + ls -la distribute/*/ || true + - uses: ./ + with: + packages: ffmpegthumbnailer + version: ${{ github.run_id }}-${{ github.run_attempt }}-regression_156 + execute_install_scripts: true + debug: ${{ env.DEBUG }} + + regression_156_restore: + needs: [regression_156_install, build_binaries] + runs-on: ubuntu-24.04 + name: "Restore ffmpegthumbnailer shared libraries (regression issue #156, restore phase)." + steps: + - uses: actions/checkout@v3.1.0 + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + pattern: cache-apt-pkgs-* + path: distribute-artifacts + - name: Setup distribute directory + shell: bash + run: | + mkdir -p distribute/X64 distribute/X86 distribute/ARM64 distribute/ARM + for artifact_dir in distribute-artifacts/cache-apt-pkgs-*; do + if [ -d "$artifact_dir" ]; then + arch=$(basename "$artifact_dir" | sed 's/cache-apt-pkgs-\([^-]*\)-.*/\1/') + echo "Copying artifacts for architecture: $arch" + cp -r "$artifact_dir"/* "distribute/$arch/" 2>/dev/null || true + fi + done + ls -la distribute/*/ || true + - name: Execute + id: execute + uses: ./ + with: + packages: ffmpegthumbnailer + version: ${{ github.run_id }}-${{ github.run_attempt }}-regression_156 + execute_install_scripts: true + debug: ${{ env.DEBUG }} + - name: Verify cache hit + if: steps.execute.outputs.cache-hit != 'true' + run: | + echo "cache-hit = ${{ steps.execute.outputs.cache-hit }}" + exit 1 + shell: bash + - name: Verify binary + run: ffmpegthumbnailer -h > /dev/null + shell: bash + multi_arch_cache_key: needs: [build_binaries] runs-on: ubuntu-latest diff --git a/install_and_cache_pkgs.sh b/install_and_cache_pkgs.sh index 5181d24..5e002e1 100755 --- a/install_and_cache_pkgs.sh +++ b/install_and_cache_pkgs.sh @@ -105,10 +105,26 @@ for installed_package in ${installed_packages}; do if test -f "${f}" -o -L "${f}"; then get_tar_relpath "${f}" if [ -L "${f}" ]; then - target="$(readlink -f "${f}")" - if [ -f "${target}" ]; then - get_tar_relpath "${target}" - fi + symlink_path="${f}" + for i in $(seq 1 40); do + if [ ! -L "${symlink_path}" ]; then + break + fi + + target="$(readlink "${symlink_path}")" + if [ "${target:0:1}" = "/" ]; then + target_path="${target}" + else + target_path="$(dirname "${symlink_path}")/${target}" + fi + + if [ -f "${target_path}" ] || [ -L "${target_path}" ]; then + get_tar_relpath "${target_path}" + symlink_path="${target_path}" + else + break + fi + done fi fi done