[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: lsb-release: please review for release exception



Steve Langasek:
> Reviewing the diff between -15 and -20, I notice this change in
> init-functions:
> 
>      if [ "x$TERM" != "xdumb" ] && [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1 && $TPUT setaf 1 >/dev/null 2>&1; then
> -        FANCYTTY=1
> -        true
> +        [ -z $FANCYTTY ] && FANCYTTY=1
>      else
>          FANCYTTY=0
> -        false
>      fi
> +    case "$FANCYTTY" in
> +        1|Y|yes|true)   true;;
> +        *)              false;;
> +    esac
> 
> 
> The addition of the [ -z $FANCYTTY ] && FANCYTTY=1 isn't going to work right
> under set -e; if FANCYTTY is non-empty for whatever reason, then [ -z
> $FANCYTTY ] returns false -- and short-circuits, causing the function to
> return false immediately instead of returning true farther down as intended.

That is not true: set -e has no effect on AND and OR lists.
That is, if FANCYTTY is non-empty for whatever reason, then [ -z $FANCYTTY ] 
returns false and short-circuits causing the rest of the AND list not to be 
executed. The AND list returns false, but because the AND list is not the 
last command in the function, the return status of the AND list is ignored 
-- even under set -e.



Reply to: