Address code review feedback: fix ls failure handling and unquoted var in restore loop

This commit is contained in:
copilot-swe-agent[bot] 2026-06-13 23:36:08 +00:00 committed by GitHub
parent da3be0d789
commit 8c828841f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

View file

@ -12,6 +12,9 @@ on:
pull_request:
types: [opened, synchronize]
permissions:
contents: read
env:
DEBUG: ${{ github.event.inputs.debug || false }}
# Test for overrides in built in shell options (regression issue 98).

View file

@ -108,8 +108,8 @@ for installed_package in ${installed_packages}; do
# Include all dpkg info files for this package (list, md5sums,
# conffiles, triggers, preinst, postinst, prerm, postrm, etc.)
# so dpkg recognizes the package after cache restore.
ls -1 /var/lib/dpkg/info/${package_name}.* 2>/dev/null &&
ls -1 /var/lib/dpkg/info/${package_name}:*.* 2>/dev/null ; } |
ls -1 /var/lib/dpkg/info/${package_name}.* 2>/dev/null ||:
ls -1 /var/lib/dpkg/info/${package_name}:*.* 2>/dev/null ||:; } |
while IFS= read -r f; do
if test -f "${f}" -o -L "${f}"; then
get_tar_relpath "${f}"

View file

@ -69,7 +69,7 @@ dpkg_status_dir="${cache_dir}"
status_files=$(ls -1 "${dpkg_status_dir}"/*.dpkg-status 2>/dev/null || true)
if test -n "${status_files}"; then
log "Registering restored packages with dpkg..."
for status_file in ${status_files}; do
while IFS= read -r status_file; do
pkg_name=$(head -1 "${status_file}" | sed 's/^Package: //')
# Skip if dpkg already knows about this package (e.g., it was pre-installed).
if dpkg -s "${pkg_name}" > /dev/null 2>&1; then
@ -83,6 +83,6 @@ if test -n "${status_files}"; then
echo "" | sudo tee -a "${cache_restore_root}var/lib/dpkg/status" > /dev/null
cat "${status_file}" | sudo tee -a "${cache_restore_root}var/lib/dpkg/status" > /dev/null
log "- ${pkg_name} registered."
done
done <<< "${status_files}"
log "done"
fi