Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
b59b36f
Asan Pipeline.
May 16, 2026
db545cf
Bump upload artifact version.
May 16, 2026
ca57429
Bump upload artifact version.
May 16, 2026
1473041
Bump upload artifact version.
May 16, 2026
251523d
Run on container.
May 16, 2026
a6af72c
Get deps.
May 16, 2026
58fd26d
Force dep run.
May 16, 2026
628824b
Force dep run.
May 17, 2026
792a9c5
Fix missing env source.
May 17, 2026
863933d
Turns out the bash default is there for a reason
May 17, 2026
1f15e10
Run in VM instead?
May 17, 2026
bd3f0b8
Run in VM instead?
May 17, 2026
e9b633d
Temporarily added report results.
May 17, 2026
241c144
Fix CodeChecker Workflow.
Jan-Frase May 22, 2026
d01ae14
Add sudo to apt calls.
Jan-Frase May 22, 2026
741608a
Fix path and remove results.
Jan-Frase May 22, 2026
ea820b8
I forgot to save my changes :)
Jan-Frase May 22, 2026
aada7e9
Fix typos.
Jan-Frase May 22, 2026
b6047de
Add more analyzers.
Jan-Frase May 22, 2026
f0bdd4f
Fix typo.
Jan-Frase May 22, 2026
8d91e24
Catch exit code 2.
Jan-Frase May 22, 2026
d63f0fb
Ignore exit code.
Jan-Frase May 22, 2026
acf5506
Add docs and try sensitive profile.
Jan-Frase May 22, 2026
1bd62bb
Reverted unneeded changes.
Jan-Frase May 22, 2026
a91bedf
Truly remove old changes.
Jan-Frase May 22, 2026
075e653
Merge branch 'parcio:master' into static_analysis
Jan-Frase May 30, 2026
d5b75d8
Fix NULL pointer dereference.
May 30, 2026
f0e74b0
Fix: reserved identifier
May 30, 2026
24be1b1
Fix: removed unused variable
May 30, 2026
a9529c8
Fix: implicit conversion
May 30, 2026
7d2f864
Fix: implicit conversion
May 30, 2026
aefa838
Merge branch 'static_analysis' into sa-fixes
May 30, 2026
9a722f4
Fix: ignored selocale result.
May 30, 2026
4fe6cc8
Dont die just because 1 file could not be analyzed with 1 checker tha…
May 30, 2026
54b4f8f
Merge branch 'static_analysis' into sa-fixes
May 30, 2026
66f28e6
More ignored results.
May 30, 2026
cf866f9
Fix: reserved identifier.
May 30, 2026
84b7425
Fix: reserved identifier.
May 30, 2026
2a8b6f4
Fix rename mistakes.
May 31, 2026
25395b3
Fix reserved identifiers.
May 31, 2026
305a968
Fix unused stores.
May 31, 2026
057b5d9
Fix more reserved names.
May 31, 2026
20dffaa
Fix cyclic import.
May 31, 2026
a61db7d
Fix unitialized objects.
May 31, 2026
0784b31
Fix bugprone-signed-char-misuse.
May 31, 2026
5b102e5
Fix disregarded setlocale calls.
May 31, 2026
d1d151e
Merge branch 'parcio:master' into sa-fixes
Jan-Frase May 31, 2026
da08e28
Fix formatting.
May 31, 2026
2ed8c5b
Fix dead code stores.
May 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# JULEA - Flexible storage framework
# Copyright (C) 2026 Jan Frase
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

name: static-analysis.yml
on: [push, pull_request]
defaults:
run:
shell: bash

jobs:
# This job is responsible for running Codechecker.
code-checker:
name: Code checker
runs-on: ubuntu-24.04
timeout-minutes: 60
env:
JULEA_SPACK_DIR: /julea-dependencies


steps:
# First, checkout julea.
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
show-progress: false

# Get the dependencies.
- name: Install dependencies
run: |
sudo apt update
sudo apt --yes --no-install-recommends install meson ninja-build pkgconf libglib2.0-dev libbson-dev libfabric-dev libgdbm-dev liblmdb-dev libsqlite3-dev libleveldb-dev libmongoc-dev libmariadb-dev librocksdb-dev libfuse3-dev libopen-trace-format-dev librados-dev

# Then, generate compile_commands.json.
- name: Generate compile_commands.json
env:
CC: clang
run: |
. scripts/environment.sh
meson setup bld

# Install CodeChecker, gcc and cppcheck.
- name: Install CodeChecker
run: |
pip install codechecker
sudo apt install --yes --no-install-recommends cppcheck gcc

- name: Install Infer
run: |
VERSION=1.3.0; \
curl -sSL "https://github.com/facebook/infer/releases/download/v$VERSION/infer-linux-x86_64-v$VERSION.tar.xz" \
| sudo tar -C /opt -xJ && \
sudo ln -s "/opt/infer-linux-x86_64-v$VERSION/bin/infer" /usr/local/bin/infer

# Run the analysis.
- name: Run CodeChecker
# Since we already have ~100 warnings, i have disabled the sensitive checks for now.
# Should we ever run out of warnings, feel free to enable them again :D
run: CodeChecker analyze ./bld/compile_commands.json -o results --ctu || true #--enable sensitive

# Parse the results and generate an HTML report.
- name: Generate HTML report
run: |
# The parse command returns with exit code 2 if it finds any bugs.
# Thus, we ignore the exit code with "|| true", to avoid failing the workflow.
CodeChecker parse --export html --output ./reports_html ./results || true

# Lastly, upload the results to the CI.
- name: Upload results
uses: actions/upload-artifact@v7.0.1
with:
name: "CodeChecker Bug Reports"
path: ./reports_html
6 changes: 3 additions & 3 deletions backend/db/mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ j_sql_finalize(gpointer backend_db, void* _stmt, GError** error)
g_return_val_if_fail(backend_db != NULL, FALSE);
g_return_val_if_fail(_stmt != NULL, FALSE);

if (wrapper->stmt && (status = mysql_stmt_close(wrapper->stmt)))
if (wrapper->stmt && (status = (unsigned char)mysql_stmt_close(wrapper->stmt)))
{
g_set_error(error, J_BACKEND_SQL_ERROR, J_BACKEND_SQL_ERROR_FINALIZE, "sql finalize failed error was (%d):'%s'", status, mysql_stmt_error(wrapper->stmt));
goto _error;
Expand Down Expand Up @@ -477,7 +477,7 @@ j_sql_step(gpointer backend_db, void* _stmt, gboolean* found, GError** error)
{
if (wrapper->param_count_in)
{
if ((status = mysql_stmt_bind_param(wrapper->stmt, wrapper->bind_in)))
if ((status = (unsigned char)mysql_stmt_bind_param(wrapper->stmt, wrapper->bind_in)))
{
g_set_error(error, J_BACKEND_SQL_ERROR, J_BACKEND_SQL_ERROR_STEP, "sql step failed error was (%d):'%s'", status, mysql_stmt_error(wrapper->stmt));
goto _error;
Expand All @@ -486,7 +486,7 @@ j_sql_step(gpointer backend_db, void* _stmt, gboolean* found, GError** error)

if (wrapper->param_count_out)
{
if ((status = mysql_stmt_bind_result(wrapper->stmt, wrapper->bind_out)))
if ((status = (unsigned char)mysql_stmt_bind_result(wrapper->stmt, wrapper->bind_out)))
{
g_set_error(error, J_BACKEND_SQL_ERROR, J_BACKEND_SQL_ERROR_STEP, "sql step failed error was (%d):'%s'", status, mysql_stmt_error(wrapper->stmt));
goto _error;
Expand Down
9 changes: 7 additions & 2 deletions benchmark/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ j_benchmark_run_one(BenchmarkRun* run)
{
g_autofree gchar* size = NULL;

size = g_format_size((gdouble)run->bytes / elapsed_time);
size = g_format_size((guint64)((gdouble)run->bytes / elapsed_time));
g_print(" (%s/s)", size);
}

Expand Down Expand Up @@ -311,7 +311,12 @@ main(int argc, char** argv)
};

// Explicitly enable UTF-8 since functions such as g_format_size might return UTF-8 characters.
setlocale(LC_ALL, "C.UTF-8");
g_autofree const char* local_result = setlocale(LC_ALL, "C.UTF-8");
if (local_result == NULL)
{
g_warning("Failed to set locale!");
return 1;
}

context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, entries, NULL);
Expand Down
10 changes: 5 additions & 5 deletions benchmark/db/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
#define FLOAT_FACTOR (3.1415926)

static char*
_benchmark_db_get_identifier(gint64 i)
helper_fn_benchmark_db_get_identifier(gint64 i)
{
return g_strdup_printf("%x-benchmark-%ld", (guint32)(i * SIGNED_FACTOR % N_MODULUS), i);
}

static JDBSchema*
_benchmark_db_prepare_scheme(gchar const* namespace, gboolean use_batch, gboolean use_index_all, gboolean use_index_single, JBatch* batch, JBatch* delete_batch)
helper_fn_benchmark_db_prepare_scheme(gchar const* namespace, gboolean use_batch, gboolean use_index_all, gboolean use_index_single, JBatch* batch, JBatch* delete_batch)
{
gboolean ret;
g_autoptr(GError) b_s_error = NULL;
Expand Down Expand Up @@ -132,7 +132,7 @@ _benchmark_db_prepare_scheme(gchar const* namespace, gboolean use_batch, gboolea
}

static void
_benchmark_db_insert(BenchmarkRun* run, JDBSchema* scheme, gchar const* namespace, gboolean use_batch, gboolean use_index_all, gboolean use_index_single, gboolean use_timer)
helper_fn_benchmark_db_insert(BenchmarkRun* run, JDBSchema* scheme, gchar const* namespace, gboolean use_batch, gboolean use_index_all, gboolean use_index_single, gboolean use_timer)
{
gboolean ret;
g_autoptr(JBatch) delete_batch = NULL;
Expand All @@ -150,7 +150,7 @@ _benchmark_db_insert(BenchmarkRun* run, JDBSchema* scheme, gchar const* namespac
g_assert_null(scheme);
g_assert_nonnull(run);

b_scheme = _benchmark_db_prepare_scheme(namespace, use_batch, use_index_all, use_index_single, batch, delete_batch);
b_scheme = helper_fn_benchmark_db_prepare_scheme(namespace, use_batch, use_index_all, use_index_single, batch, delete_batch);
g_assert_nonnull(b_scheme);

j_benchmark_timer_start(run);
Expand All @@ -172,7 +172,7 @@ _benchmark_db_insert(BenchmarkRun* run, JDBSchema* scheme, gchar const* namespac
gint64 i_signed = ((i * SIGNED_FACTOR) % CLASS_MODULUS) - CLASS_LIMIT;
guint64 i_usigned = ((i * USIGNED_FACTOR) % CLASS_MODULUS);
gdouble i_float = i_signed * FLOAT_FACTOR;
g_autofree gchar* string = _benchmark_db_get_identifier(i);
g_autofree gchar* string = helper_fn_benchmark_db_get_identifier(i);
g_autoptr(JDBEntry) entry = j_db_entry_new(b_scheme, &b_s_error);
g_assert_null(b_s_error);

Expand Down
Loading
Loading