Comment 2 for bug 1838245

Revision history for this message
Alex G (flamefire) wrote :

But there is another bug: The following line reads `[ -z $kernels_module ] || return 0`

Previously the related section was:

    if [ -z $kernels_module ]; then
        # Magic split into array syntax saves trivial awk and cut calls.
        local -a obs=(${3//-/ })
        local -a my=(${1//-/ })
        local obsolete=0
        if [[ ${obs} && ${my} ]]; then
            if [[ $(VER ${obs}) == $(VER ${my}) && ! $force ]]; then
                # They get obsoleted possibly in this kernel release
                if [[ ! ${obs[1]} ]]; then
                    # They were obsoleted in this upstream kernel
                    obsolete=1
                elif [[ $(VER ${my[1]}) > $(VER ${obs[1]}) ]]; then
                    # They were obsoleted in an earlier ABI bump of the kernel
                    obsolete=1
                elif [[ $(VER ${my[1]}) = $(VER ${obs[1]}) ]]; then
                    # They were obsoleted in this ABI bump of the kernel
                    obsolete=1
                fi
            elif [[ $(VER ${my}) > $(VER ${obs}) && ! $force ]]; then
                # They were obsoleted in an earlier kernel release
                obsolete=1
            fi
        fi

        if ((obsolete == 1)); then
            echo $"" >&2
            echo $"Module has been obsoleted due to being included" >&2
            echo $"in kernel $3. We will avoid installing" >&2
            echo $"for future kernels above $3." >&2
            echo $"You may override by specifying --force." >&2
            return 1
  else
          return 0
        fi
    fi

See that misformatted `else`? This probably tricked the patch author. Essence is: If `[ -z $kernels_module ]` then either return with 1 or 0 depending on `obsolete`.

The correct line would hence be: `[ -z $kernels_module ] && return 0`