Skip to content

Commit ed499fa

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

30 files changed

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