build: gen-version-i.sh: use errexit option
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 20 Jun 2023 01:28:12 +0000 (21:28 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 31 Aug 2023 14:38:42 +0000 (10:38 -0400)
commit3ccee65c5e2c22dae34f2a25a14601bbf795fbff
treeb94801979f36f24eb309af89dafed4988e0506a9
parent0416e340e3997c9f509bc3b47a5976e8577e7eef
build: gen-version-i.sh: use errexit option

Use `set -o errexit` in gen-version-i.sh, so that any unexpected
command failures stops the script.

The first `git describe` command can unexpectedly fail when the script
is ran by a user other than the owner of the git repository (and sudo
wasn't used, so SUDO_UID & co are not set):

    # git describe --tags --dirty
    fatal: detected dubious ownership in repository at '/home/smarchi/src/babeltrace'
    To add an exception for this directory, call:

            git config --global --add safe.directory /home/smarchi/src/babeltrace

For instance, this happens if the git repository is owned by a regular
user, and `make install` is ran in a root shell started with `su`.  Add
`|| true` to that command, to keep the existing behavior (even if
it's not ideal).

Change-Id: Idfbcb3a86158bcddff11a34a18a5d004def37742
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10103
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
src/common/gen-version-i.sh
This page took 0.027403 seconds and 4 git commands to generate.