version.sh has some non-portable constructs

Tags:

#1 nimaimalle

From the source code, the version.sh file needed a few changes to make it work on Mac. First, the method of deriving the patch number from git needs to trim leading white space.

Before, After:

git log --pretty=oneline 2>/dev/null | wc -l

git log --pretty=oneline 2>/dev/null | wc -l | tr -d ' '

Second, echo -n is not portable across linux versions. To achieve output without a new-line, use printf instead.

Before, After:

echo -n "${VERSION}.${VERSION_PATCH}" |sed s/M//

printf "${VERSION}.${VERSION_PATCH}"

I'm not sure what the sed s/M// was for, but maybe it had to do with the svn codepath, which I did not test.

#2 b0ti Nxlog ✓
#1 nimaimalle
From the source code, the version.sh file needed a few changes to make it work on Mac. First, the method of deriving the patch number from git needs to trim leading white space. Before, After: git log --pretty=oneline 2>/dev/null | wc -l git log --pretty=oneline 2>/dev/null | wc -l | tr -d ' ' Second, echo -n is not portable across linux versions. To achieve output without a new-line, use printf instead. Before, After: echo -n "${VERSION}.${VERSION_PATCH}" |sed s/M// printf "${VERSION}.${VERSION_PATCH}" I'm not sure what the sed s/M// was for, but maybe it had to do with the svn codepath, which I did not test.

You may want to create a merge request or an issue under https://gitlab.com/nxlog-public/nxlog-ce