From 137931b37ccc58c7b966c75c18cfec0107ea6227 Mon Sep 17 00:00:00 2001 From: alexandrev-tibco Date: Tue, 21 Jul 2026 13:58:20 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20upload=20script:=20limpieza=20.p8=20v?= =?UTF-8?q?=C3=ADa=20TRAPEXIT=20global=20(bug=20zsh:=20trap=20EXIT=20en=20?= =?UTF-8?q?funci=C3=B3n=20se=20dispara=20al=20retornar,=20borraba=20la=20k?= =?UTF-8?q?ey=20antes=20del=20archive)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01LZFmGhbWzibhApev3C4554 --- Scripts/archive_and_upload_appstore.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Scripts/archive_and_upload_appstore.sh b/Scripts/archive_and_upload_appstore.sh index b2cdee0..5bbac5b 100755 --- a/Scripts/archive_and_upload_appstore.sh +++ b/Scripts/archive_and_upload_appstore.sh @@ -27,6 +27,13 @@ ISSUER_ID="$(_pass_or_env "${APPSTORE_ISSUER_ID:-}" appstore/issuer-id)" TEAM_ID="$(_pass_or_env "${DEVELOPMENT_TEAM_ID:-}" appstore/team-id)" P8_PATH="${APPSTORE_P8_PATH:-}" P8_DIR="" +# Fichero .p8 temporal a limpiar al salir. OJO zsh: un `trap ... EXIT` puesto DENTRO +# de una función se dispara al RETORNAR la función (no al salir el script, como bash), +# lo que borraba la clave antes del archive. Por eso la limpieza va en TRAPEXIT global. +P8_TEMP="" +TRAPEXIT() { + [[ -n "$P8_TEMP" ]] && rm -f "$P8_TEMP" +} fail() { echo "Error: $*" >&2 @@ -54,8 +61,8 @@ find_p8_file() { local tmp_p8="/tmp/AuthKey_${KEY_ID}.p8" pass show appstore/api-key-p8 > "$tmp_p8" chmod 600 "$tmp_p8" - # Registrar para limpieza al salir del script (trap en el shell principal). - trap "rm -f '$tmp_p8'" EXIT + # Limpieza al salir del script vía TRAPEXIT global (ver arriba por qué no un trap local). + P8_TEMP="$tmp_p8" P8_PATH="$tmp_p8" return fi