From 30a6f6402e385e76870618e3b1950ac989e93612 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sat, 22 Jun 2019 07:51:02 +0200 Subject: [PATCH] BUILD: makefile: use :space: instead of digits to count commits The 'tr' command on Solaris doesn't conform to POSIX and requires brackets around ranges. So the sequence '0-9' is understood as the 3 characters '0', '-', and '9'. This causes tagged versions (those with no commit after the last commit) to be numberred as an empty string, resulting in an error being reported while computing the version number. All implementations support '[:space:]' to delete heading spaces, so let's use this instead. This may be backported to all stable versions. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d62fead7a..1387097b1 100644 --- a/Makefile +++ b/Makefile @@ -399,7 +399,7 @@ ifeq ($(IGNOREGIT),) VERSION := $(shell [ -d .git/. ] && ref=`(git describe --tags --match 'v*' --abbrev=0) 2>/dev/null` && ref=$${ref%-g*} && echo "$${ref\#v}") ifneq ($(VERSION),) # OK git is there and works. -SUBVERS := $(shell comms=`git log --format=oneline --no-merges v$(VERSION).. 2>/dev/null | wc -l | tr -dc '0-9'`; commit=`(git log -1 --pretty=%h --abbrev=6) 2>/dev/null`; [ $$comms -gt 0 ] && echo "-$$commit-$$comms") +SUBVERS := $(shell comms=`git log --format=oneline --no-merges v$(VERSION).. 2>/dev/null | wc -l | tr -d '[:space:]'`; commit=`(git log -1 --pretty=%h --abbrev=6) 2>/dev/null`; [ $$comms -gt 0 ] && echo "-$$commit-$$comms") VERDATE := $(shell git log -1 --pretty=format:%ci | cut -f1 -d' ' | tr '-' '/') endif endif -- 2.47.3