Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

setlocalversion: add -e option

Set the -e option to ensure this script fails on any unexpected errors.

Without this change, the kernel build may continue running with an
incorrect string in include/config/kernel.release.

Currently, try_tag() returns 1 when the expected tag is not found as an
ancestor, but this is a case where the script should continue.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

+8 -4
+8 -4
scripts/setlocalversion
··· 10 10 # 11 11 # 12 12 13 + set -e 14 + 13 15 usage() { 14 16 echo "Usage: $0 [--no-local] [srctree]" >&2 15 17 exit 1 ··· 36 34 tag="$1" 37 35 38 36 # Is $tag an annotated tag? 39 - [ "$(git cat-file -t "$tag" 2> /dev/null)" = tag ] || return 1 37 + if [ "$(git cat-file -t "$tag" 2> /dev/null)" != tag ]; then 38 + return 39 + fi 40 40 41 41 # Is it an ancestor of HEAD, and if so, how many commits are in $tag..HEAD? 42 42 # shellcheck disable=SC2046 # word splitting is the point here ··· 47 43 # $1 is 0 if and only if $tag is an ancestor of HEAD. Use 48 44 # string comparison, because $1 is empty if the 'git rev-list' 49 45 # command somehow failed. 50 - [ "$1" = 0 ] || return 1 46 + if [ "$1" != 0 ]; then 47 + return 48 + fi 51 49 52 50 # $2 is the number of commits in the range $tag..HEAD, possibly 0. 53 51 count="$2" 54 - 55 - return 0 56 52 } 57 53 58 54 scm_version()