Skip to content

Commit

Permalink
scripts/setlocalversion: fix a bug when LOCALVERSION is empty
Browse files Browse the repository at this point in the history
The commit 042da42 ("scripts/setlocalversion: simplify the short
version part") reduces indentation. Unfortunately, it also changes behavior
in a subtle way - if the user has empty "LOCALVERSION" variable, the plus
sign is appended to the kernel version. It wasn't appended before.

This patch reverts to the old behavior - we append the plus sign only if
the LOCALVERSION variable is not set.

Fixes: 042da42 ("scripts/setlocalversion: simplify the short version part")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
  • Loading branch information
Mikulas Patocka authored and masahir0y committed Jul 18, 2021
1 parent e73f0f0 commit 5df99be
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions scripts/setlocalversion
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,14 @@ res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}"
if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
# full scm version string
res="$res$(scm_version)"
elif [ -z "${LOCALVERSION}" ]; then
# append a plus sign if the repository is not in a clean
# annotated or signed tagged state (as git describe only
# looks at signed or annotated tags - git tag -a/-s) and
# LOCALVERSION= is not specified
elif [ "${LOCALVERSION+set}" != "set" ]; then
# If the variable LOCALVERSION is not set, append a plus
# sign if the repository is not in a clean annotated or
# signed tagged state (as git describe only looks at signed
# or annotated tags - git tag -a/-s).
#
# If the variable LOCALVERSION is set (including being set
# to an empty string), we don't want to append a plus sign.
scm=$(scm_version --short)
res="$res${scm:++}"
fi
Expand Down

0 comments on commit 5df99be

Please sign in to comment.