Skip to content

Commit 1a5c193

Browse files
committed
Rebrand, move to GitHub and related changes
1 parent 23d9f0a commit 1a5c193

30 files changed

Lines changed: 2391 additions & 521 deletions

.github/dependencies.apt.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
meson
2+
ninja-build
3+
python3-jsonschema
4+
python3-yaml

.github/workflows/check.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
workflow_dispatch:
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
timeout-minutes: 10
16+
steps:
17+
# 6.0.2
18+
- name: Checkout repository
19+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
20+
with:
21+
persist-credentials: false
22+
23+
- name: Install uv
24+
# 7.2.0
25+
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b
26+
with:
27+
version: "0.9.21"
28+
enable-cache: true
29+
save-cache: ${{ github.ref == 'refs/heads/main' }}
30+
cache-dependency-glob: |
31+
**/uv.lock
32+
**/pyproject.toml
33+
34+
- name: Install python dependencies
35+
run: uv sync --all-extras --all-groups --frozen
36+
37+
- name: Check Python code formatting
38+
run: uv run ruff format --check
39+
40+
- name: Check Python code lint
41+
run: uv run ruff check --output-format=github
42+
43+
- name: Check Python code types
44+
run: uv run mypy .
45+
46+
- name: Run tests
47+
run: uv run pytest
48+
49+
build:
50+
strategy:
51+
matrix:
52+
os: ['ubuntu-24.04', 'ubuntu-24.04-arm']
53+
compiler: ['gcc', 'clang']
54+
runs-on: ${{ matrix.os }}
55+
container:
56+
image: ubuntu:26.04
57+
options: --privileged
58+
permissions:
59+
contents: read
60+
timeout-minutes: 20
61+
env:
62+
CC: ${{ matrix.compiler }}
63+
BUILDDIR: builddir
64+
CONFIG_OPTS: -Dtests=true
65+
MESON_TEST_TIMEOUT_MULTIPLIER: 2
66+
DEBIAN_FRONTEND: noninteractive
67+
steps:
68+
- name: Install dependencies
69+
run: apt-get update && apt-get install -y git findutils
70+
71+
- name: Set git safe directory
72+
run: git config --global safe.directory "*"
73+
74+
# 6.0.2
75+
- name: Checkout repository
76+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
77+
with:
78+
persist-credentials: false
79+
80+
- name: Install build dependencies
81+
run: |
82+
apt-get install -y ${{ matrix.compiler }} uncrustify \
83+
$(xargs < .github/dependencies.apt.txt)
84+
85+
- name: Run uncrustify
86+
run: ./uncrustify.sh && git diff --exit-code
87+
88+
- name: Configure with meson
89+
run: |
90+
if [ "${{ matrix.compiler }}" = "gcc" ]; then
91+
SANITIZE_OPTS="-Db_sanitize=address,undefined"
92+
else
93+
SANITIZE_OPTS=""
94+
fi
95+
96+
meson setup --wrap-mode nodownload ${CONFIG_OPTS} \
97+
-Dwerror=true ${SANITIZE_OPTS} ${BUILDDIR} .
98+
99+
- name: Build with meson
100+
run: meson compile -C ${BUILDDIR}
101+
102+
- name: Run tests with Meson
103+
env:
104+
ASAN_OPTIONS: "detect_leaks=1:fast_unwind_on_malloc=0:malloc_context_size=20:symbolize=1"
105+
UBSAN_OPTIONS: "print_stacktrace=1"
106+
run: |
107+
export LSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/tests/lsan.supp"
108+
meson test -C ${BUILDDIR} --verbose --timeout-multiplier ${MESON_TEST_TIMEOUT_MULTIPLIER}
109+
110+
- name: Upload test logs
111+
# 7.0.0
112+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
113+
if: failure() || cancelled()
114+
with:
115+
name: test logs
116+
path: |
117+
builddir/meson-logs/testlog.txt
118+
installed-test-logs/
119+
120+
- name: Create dist tarball
121+
run: |
122+
meson setup --wrap-mode nodownload --reconfigure ${CONFIG_OPTS} ${BUILDDIR}_dist .
123+
meson dist --include-subprojects -C ${BUILDDIR}_dist

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
builddir/
2+
3+
__pycache__/
4+
.venv/
5+
venv/
6+
.pytest_cache/
7+
.mypy_cache/
8+
.ruff_cache/

.gitlab-ci.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

.ruff.toml

Lines changed: 0 additions & 23 deletions
This file was deleted.

LICENSE

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,9 @@ safest to attach them to the start of each source file to most effectively
470470
convey the exclusion of warranty; and each file should have at least the
471471
"copyright" line and a pointer to where the full notice is found.
472472

473-
shared-library-guard
474-
Copyright (C) 2019 freedesktop-sdk
473+
libloadguard
474+
Copyright (C) 2026 bbhtt
475+
Copyright (C) 2019-2026 freedesktop-sdk
475476

476477
This library is free software; you can redistribute it and/or
477478
modify it under the terms of the GNU Lesser General Public

README

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Audit library to help Flatpak applications cope with badly behaving
2+
programs. Versioning follows YY.MM.release
3+
4+
Format:
5+
6+
C code is formatted using Uncrustify [1]. `./uncrustify.sh` can be
7+
executed to format them. Python devlopment environment can be set up
8+
using uv [2].
9+
10+
```
11+
uv sync --all-extras --all-groups --frozen
12+
uv run ruff format
13+
uv run ruff check . --fix
14+
```
15+
16+
Build:
17+
18+
```
19+
meson setup --reconfigure builddir -Dtests=true
20+
meson compile -C builddir
21+
```
22+
23+
Test:
24+
25+
```
26+
meson test -C builddir
27+
uv run pytest
28+
```
29+
30+
[1]: https://github.com/uncrustify/uncrustify
31+
[2]: https://docs.astral.sh/uv/

Readme.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

meson.build

Lines changed: 47 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,54 @@
11
project(
2-
'shared-library-guard',
2+
'libloadguard',
33
'c',
4-
license : 'LGPL-2.1-or-later',
5-
meson_version : '>=0.56.0',
6-
version : '25.03.1',
7-
)
8-
9-
conf_data = configuration_data()
10-
conf_data.set_quoted('SHARED_LIBRARY_GUARD_CONFIG', get_option('shared_library_guard_config'))
11-
configure_file(output : 'config.h', configuration : conf_data)
12-
13-
14-
shared_library('shared-library-guard', 'shared-library-guard.c',
15-
install : true)
16-
17-
install_data(
18-
'shared-library-guard-config-converter.py',
19-
install_dir : get_option('bindir'),
20-
rename : 'shared-library-guard-config-converter',
21-
install_mode : 'rwxr-xr-x',
4+
license: 'LGPL-2.1-or-later',
5+
meson_version: '>=0.56.0',
6+
version: '26.05.0',
7+
default_options: 'c_std=gnu99',
228
)
239

10+
cc = meson.get_compiler('c')
11+
12+
project_c_args = [
13+
'-Werror=empty-body',
14+
'-Werror=strict-prototypes',
15+
'-Werror=missing-prototypes',
16+
'-Werror=implicit-function-declaration',
17+
'-Werror=format=2',
18+
'-Werror=format-security',
19+
'-Werror=format-nonliteral',
20+
'-Werror=pointer-arith',
21+
'-Werror=init-self',
22+
'-Werror=missing-declarations',
23+
'-Werror=return-type',
24+
'-Werror=overflow',
25+
'-Werror=int-conversion',
26+
'-Werror=parentheses',
27+
'-Werror=incompatible-pointer-types',
28+
'-Werror=misleading-indentation',
29+
'-Werror=missing-include-dirs',
30+
'-D_GNU_SOURCE',
31+
]
32+
33+
foreach arg: project_c_args
34+
if cc.has_argument(arg)
35+
add_project_arguments(arg, language: 'c')
36+
endif
37+
endforeach
38+
39+
if cc.get_id() == 'clang'
40+
clang_args = [
41+
'-Wno-typedef-redefinition',
42+
]
43+
foreach arg: clang_args
44+
if cc.has_argument(arg)
45+
add_project_arguments(arg, language: 'c')
46+
endif
47+
endforeach
48+
endif
2449

50+
subdir('src')
51+
subdir('utils')
2552
if get_option('tests')
26-
tester = executable('tester', 'tester.c')
27-
test('empty_file', tester, args : ['tester', join_paths(meson.project_source_root(), 'test_data/empty_file.txt')])
28-
test('single_match', tester, args : ['tester', join_paths(meson.project_source_root(), 'test_data/single_library.txt'), '/foo/bar/baz.so'])
29-
test('wrong_process', tester, args : ['tester2', join_paths(meson.project_source_root(), 'test_data/single_library.txt')])
30-
test('complex', tester, args : ['tester', join_paths(meson.project_source_root(), 'test_data/complex.txt'), '/foo/bar/baz.so', '/meep.so'])
31-
test('absolute_path', tester, args : ['/foo/bar/tester', join_paths(meson.project_source_root(), 'test_data/single_library.txt'), '/foo/bar/baz.so'])
32-
33-
test_match = executable('test_match', 'test_match.c')
34-
35-
test('absolute_match', test_match, args : ['true', '/some/absolute/path', '/some/absolute/path'])
36-
test('absolute_non_match', test_match, args : ['false', '/some/absolute/path', '/root/some/absolute/path'])
37-
38-
test('relative_match', test_match, args : ['true', '*(/*)/relative/path', '/root/some/relative/path'])
39-
test('relative_match', test_match, args : ['false', 'relative/path', '/root/some/relative/path/not/finished'])
40-
41-
test('relative_match_hidden', test_match, args : ['false', '*(/*)/relative/path', '/root/.some/relative/path'])
42-
test('relative_match_hidden', test_match, args : ['true', '*(/*|/.*)/relative/path', '/root/.some/relative/path'])
53+
subdir('tests')
4354
endif

meson_options.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
option('shared_library_guard_config', type : 'string', value : '/etc/freedesktop-sdk.ld.so.blockedlist', description : 'File whose lines are file pattern library pattern pairs')
2-
option('tests', type : 'boolean', value : true, description : 'Build and run tests')
1+
option('libloadguard_config', type : 'string', value : '/app/etc/libloadguard.blockedlist', description : 'File whose lines are file pattern library pattern pairs')
2+
option('tests', type : 'boolean', value : false, description : 'Build and run tests')

0 commit comments

Comments
 (0)