Fix GitHub Actions Static Analyzer Check

Dockerfile
----------

This dockerfile was used to emulate GitHub actions.

<details><summary>Dockerfile source (click to expand)</summary>

```dockerfile
FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive

RUN set -ex; \
apt-get update; \
apt-get install -y build-essential meson appstream clang clang-format clang-tools libdbus-1-dev libinih-dev libsystemd-dev git

RUN set -ex; \
yes | adduser ci-user

USER ci-user
```

</details>

Commands to reproduce
---------------------

I simulated GitHub actions with a local docker environment.

    docker build -t ci .

I ran the following commands to reproduce the issue so that I could bugfix the static analyzer script.

```bash
docker run -e CI=true --rm -v "$PWD:$PWD" -w "$PWD" --init ci ./scripts/static-analyser-check.sh
docker run -e CI=true --rm -v "$PWD:$PWD" -w "$PWD" --init ci ./bootstrap.sh -Dwith-examples=true
docker run --rm -v "$PWD:$PWD" -w "$PWD" --init ci meson test -C builddir
docker run --rm -v "$PWD:$PWD" -w "$PWD" --init ci dbus-run-session -- gamemode-simulate-game
docker run --rm -v "$PWD:$PWD" -w "$PWD" --init ci ./scripts/static-analyser-check.sh
```

All commands reuse the same workspace which is how it works in GH actions.

Legitimate bugs
---------------

Now the error displayed in build failure appears to be a legitimate bug.  Four were found related to null pointer dereference.  I'm not fixing the bug but the check should work properly for those who do.

If you following my docker setup in this description you can view the bug report by starting the report server.

```bash
docker run -p 127.0.0.1:8181:8181 -it --rm -v "$PWD:$PWD" -w "$PWD" --init ci scan-view --host 0.0.0.0 --allow-all-hosts builddir/meson-logs/scanbuild/*
```

After the report server is started you can visit `http://127.0.0.1:8181/` to view the bugs.

Screenshot of report
--------------------

![Screenshot of bug report](https://user-images.githubusercontent.com/875669/155830028-473db1ea-7c98-4a82-bc3a-290d5c155108.png)
This commit is contained in:
Sam Gleske 2022-02-26 00:00:23 -05:00 committed by afayaz-feral
parent 23493e5cc3
commit b8fa857b35
2 changed files with 4 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/builddir

View File

@ -1,5 +1,7 @@
#!/bin/bash
set -exo pipefail
# Ensure we are at the project root
cd "$(dirname $0)"/..
@ -7,4 +9,4 @@ cd "$(dirname $0)"/..
ninja scan-build -C builddir | tee builddir/meson-logs/scan-build.txt
# Invert the output - if this string exists it's a fail
exit ! grep -E '[0-9]+ bugs? found.' builddir/meson-logs/scan-build.txt
! grep -E '[0-9]+ bugs? found.' builddir/meson-logs/scan-build.txt