Fix occasional ci/commit_verify.sh script failure with exit status 141/SIGPIPE (regression in 8ef68f10)
-
The YDBGUI
commit-verify
jobs started failing after merging YottaDB/UI/YDBGUI@7cb8da09 See https://gitlab.com/YottaDB/UI/YDBGUI/-/jobs/5804936291 for example failure. -
The failure was at the following line.
ci/commit_verify.sh
curyear=$(git show --summary --pretty=format:'%cd' --date=format:%Y HEAD | head -1)
-
The
git show
was exiting with an exit status of 141.$ set -o pipefail $ git show --summary --pretty=format:'%cd' --date=format:%Y HEAD | head -1 2023 $ echo ${PIPESTATUS[@]} 141 0
-
This is an infamous problem with
SIGPIPE
resulting in the exit status of 141. See https://stackoverflow.com/a/19120674 for more details. -
In this case, the
git show
had a lot of lines of output (it was a huge commit with lots of files that got created) and so it got a SIGPIPE signal when thehead -1
terminated the pipe after seeing just one line of output. -
Thanks to https://stackoverflow.com/a/19120674 for a solution which is to use
sed -n 1p
instead ofhead -1
. That avoids the SIGPIPE error so that is what is done in this commit.