[PATCH util-modular v2] release.sh: unset GPGKEY if already existing
Andres Gomez
agomez at igalia.com
Thu Apr 20 05:18:45 UTC 2017
On Thu, 2017-04-20 at 10:17 +1000, Peter Hutterer wrote:
> On Wed, Apr 19, 2017 at 03:59:33PM +0300, Andres Gomez wrote:
> > GPGKEY may already exist in the environment. In that case, just
> > unset it.
> >
> > v2: unsetting is safer than redefining to quietly use a potentially
> > wrong key stored in the variable (Peter).
> >
> > Signed-off-by: Andres Gomez <agomez at igalia.com>
> > Cc: Emil Velikov <emil.velikov at collabora.com>
> > Cc: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> > release.sh | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/release.sh b/release.sh
> > index f976f94..b8a0aaf 100755
> > --- a/release.sh
> > +++ b/release.sh
> > @@ -808,6 +808,11 @@ if [ "x$GPG" = "x" ] ; then
> > fi
> > fi
> >
> > +# Unset GPGKEY if needed
> > +if [ ! -z ${GPGKEY+x} ] ; then
> > + unset GPGKEY
> > +fi
>
> wouldn't that fail if GPGKEY is set to the empty string? Plus, I had to look
> up what ${foo+x} actually does :) Should we just stick to the simple well
> known:
>
> if [ "x$GPGKEY" != "x" ] ; then
> unset GPGKEY
> fi
${foo+x} actually ensures it. That solution always unsets if the
variable is set, empty string or not.
I suppose this other version would work too but, then, we will have a
different outcome if GPGKEY is set with or without an empty string. In
that case I would go for an even simpler initialization:
GPGKEY=""
That way you ensure that GPGKEY is always set to an empty string.
Let me know what you prefer.
--
Br,
Andres
More information about the xorg-devel
mailing list