[pacman-dev] [PATCH] repo-add: Fix error messages on SIGHUP/SIGQUIT

Dan McGee dpmcgee at gmail.com
Tue Oct 11 13:19:42 EDT 2011


On Tue, Oct 11, 2011 at 12:00 PM, Lukas Fleischer
<archlinux at cryptocrack.de> wrote:
> Instead of always showing "==> ERROR: TERM signal caught. Exiting...",
> replace "TERM" with whatever signal is actually caught.
>
> Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
> ---
>  scripts/repo-add.sh.in |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
> index 753200b..7fc8637 100644
> --- a/scripts/repo-add.sh.in
> +++ b/scripts/repo-add.sh.in
> @@ -569,7 +569,9 @@ tmpdir=$(mktemp -d /tmp/repo-tools.XXXXXXXXXX) || (\
>  mkdir $tmpdir/tree
>
>  trap 'clean_up' EXIT
> -trap 'trap_exit "$(gettext "TERM signal caught. Exiting...")"' TERM HUP QUIT
> +for signal in TERM HUP QUIT; do
> +       trap 'trap_exit "$(gettext "'"$signal"' signal caught. Exiting...")"' "$signal"
You need to use '%s' in the gettext string, and then pass $signal to
the trap_exit invocation; e.g.
    trap 'trap_exit "$(gettext "'%s' signal caught. Exiting...")"
$signal' $signal

> +done
>  trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT
>  trap 'trap_exit "$(gettext "An unknown error has occured. Exiting...")"' ERR
We should also correct this spelling mistake- ouch. s/occured/occurred/ here.
>
> --
> 1.7.7


More information about the pacman-dev mailing list