Skip to content

fix(libscap): wire savefile converter objects into the savefile engine#3011

Open
immanuwell wants to merge 1 commit into
falcosecurity:masterfrom
immanuwell:fix/libscap-savefile-converter-build
Open

fix(libscap): wire savefile converter objects into the savefile engine#3011
immanuwell wants to merge 1 commit into
falcosecurity:masterfrom
immanuwell:fix/libscap-savefile-converter-build

Conversation

@immanuwell
Copy link
Copy Markdown

/kind bug
/area build
/area libscap-engine-savefile
/area tests

What this PR does / why we need it:

This fixes a real build break in the documented libscap_test flow.

scap_engine_savefile was pulling the converter OBJECT library via target_link_libraries(). With Unix Makefiles that leaves libscap_test in a bad spot, make libscap_test can fail with No rule to make target ... converter.cpp.o. Kinda sneaky.

This switches the savefile engine to consume those object files through target_sources($<TARGET_OBJECTS:...>), so the objects are wired into the static archive the right way.

Which issue(s) this PR fixes:

None found.

Special notes for your reviewer:

Repro:

cmake -S . -B build-libscap-check \
  -DUSE_BUNDLED_DEPS=ON \
  -DCREATE_TEST_TARGETS=ON \
  -DBUILD_DRIVER=OFF \
  -DENABLE_LIBSCAP_TESTS=ON

cmake --build build-libscap-check --target libscap_test -j2

Before this patch, the build can fail with No rule to make target ... scap_savefile_converter.dir/converter.cpp.o.
After this patch, libscap_test builds ok, ./build-libscap-check/test/libscap/libscap_test passes, and a clean scap build still works.

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: immanuwell <pchpr.00@list.ru>
@poiana
Copy link
Copy Markdown
Contributor

poiana commented May 30, 2026

Welcome @immanuwell! It looks like this is your first PR to falcosecurity/libs 🎉

@poiana poiana added the size/XS label May 30, 2026
@poiana poiana requested a review from hbrueckner May 30, 2026 15:40
@poiana
Copy link
Copy Markdown
Contributor

poiana commented May 30, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: immanuwell
Once this PR has been reviewed and has the lgtm label, please assign lucaguerra for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana requested a review from terror96 May 30, 2026 15:40
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

Perf diff from master - unit tests

     9.26%     +0.87%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release()
     6.27%     +0.48%  [.] std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count(std::__weak_count<(__gnu_cxx::_Lock_policy)2> const&, std::nothrow_t)
     8.81%     +0.45%  [.] std::__shared_count<(__gnu_cxx::_Lock_policy)2>::_M_get_use_count() const
    21.82%     -0.45%  [.] std::__shared_ptr<sinsp_threadinfo, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__weak_ptr<sinsp_threadinfo, (__gnu_cxx::_Lock_policy)2> const&, std::nothrow_t)
     5.13%     -0.44%  [.] thread_group_info::get_first_thread() const
    15.65%     +0.34%  [.] sinsp_threadinfo::get_main_thread()
    12.71%     -0.27%  [.] sinsp_thread_manager::create_thread_dependencies(std::shared_ptr<sinsp_threadinfo> const&)
    10.20%     +0.16%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_lock_nothrow()
     0.04%     +0.11%  [.] filter_check_list::add_filter_check(std::unique_ptr<sinsp_filter_check, std::default_delete<sinsp_filter_check> >)
     0.18%     -0.10%  [.] void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag)

Heap diff from master - unit tests

peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Heap diff from master - scap file

peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Benchmarks diff from master

Comparing gbench_data.json to /root/actions-runner/_work/libs/libs/build/gbench_data.json
Benchmark                                                                               Time             CPU      Time Old      Time New       CPU Old       CPU New
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
BM_sinsp_split_mean                                                                  +0.0283         +0.0281           269           276           268           276
BM_sinsp_split_median                                                                +0.0269         +0.0265           269           276           269           276
BM_sinsp_split_stddev                                                                +0.3822         +0.3439             2             2             2             2
BM_sinsp_split_cv                                                                    +0.3442         +0.3072             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                                        +0.0762         +0.0762            82            89            82            89
BM_sinsp_concatenate_paths_relative_path_median                                      +0.0840         +0.0838            82            89            82            89
BM_sinsp_concatenate_paths_relative_path_stddev                                      -0.8284         -0.8257             1             0             1             0
BM_sinsp_concatenate_paths_relative_path_cv                                          -0.8405         -0.8381             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                                           +0.0483         +0.0482            46            49            46            49
BM_sinsp_concatenate_paths_empty_path_median                                         +0.0535         +0.0534            46            49            46            49
BM_sinsp_concatenate_paths_empty_path_stddev                                        +42.0456        +48.5305             0             1             0             1
BM_sinsp_concatenate_paths_empty_path_cv                                            +40.0641        +46.2539             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                                        +0.0126         +0.0126            87            88            87            88
BM_sinsp_concatenate_paths_absolute_path_median                                      +0.0307         +0.0304            86            89            86            89
BM_sinsp_concatenate_paths_absolute_path_stddev                                      +1.1714         +1.1718             1             3             1             3
BM_sinsp_concatenate_paths_absolute_path_cv                                          +1.1444         +1.1448             0             0             0             0
BM_sinsp_sanitize_string_fast_path_ascii_short_mean                                  +0.0003         +0.0003            19            19            19            19
BM_sinsp_sanitize_string_fast_path_ascii_short_median                                -0.0001         -0.0002            19            19            19            19
BM_sinsp_sanitize_string_fast_path_ascii_short_stddev                                -0.8408         -0.8405             0             0             0             0
BM_sinsp_sanitize_string_fast_path_ascii_short_cv                                    -0.8409         -0.8406             0             0             0             0
BM_sinsp_sanitize_string_fast_path_ascii_long_mean                                   -0.0003         -0.0003           165           165           165           165
BM_sinsp_sanitize_string_fast_path_ascii_long_median                                 -0.0003         -0.0003           165           165           165           165
BM_sinsp_sanitize_string_fast_path_ascii_long_stddev                                 -0.1174         -0.0514             0             0             0             0
BM_sinsp_sanitize_string_fast_path_ascii_long_cv                                     -0.1171         -0.0511             0             0             0             0
BM_sinsp_sanitize_string_fast_path_multibyte_short_mean                              -0.0240         -0.0240            15            14            15            14
BM_sinsp_sanitize_string_fast_path_multibyte_short_median                            -0.0401         -0.0400            15            14            15            14
BM_sinsp_sanitize_string_fast_path_multibyte_short_stddev                            +0.2658         +0.2626             0             0             0             0
BM_sinsp_sanitize_string_fast_path_multibyte_short_cv                                +0.2968         +0.2936             0             0             0             0
BM_sinsp_sanitize_string_fast_path_multibyte_long_mean                               -0.0326         -0.0327          5473          5294          5471          5292
BM_sinsp_sanitize_string_fast_path_multibyte_long_median                             -0.0006         -0.0006          5472          5469          5470          5467
BM_sinsp_sanitize_string_fast_path_multibyte_long_stddev                           +142.3025       +148.6133             2           250             2           250
BM_sinsp_sanitize_string_fast_path_multibyte_long_cv                               +147.1371       +153.6686             0             0             0             0
BM_sinsp_sanitize_string_fast_path_mixed_long_mean                                   +0.0057         +0.0057          2292          2305          2291          2304
BM_sinsp_sanitize_string_fast_path_mixed_long_median                                 +0.0014         +0.0013          2308          2311          2307          2310
BM_sinsp_sanitize_string_fast_path_mixed_long_stddev                                 -0.5003         -0.5065            25            12            25            12
BM_sinsp_sanitize_string_fast_path_mixed_long_cv                                     -0.5031         -0.5092             0             0             0             0
BM_sinsp_sanitize_string_slow_path_c1_controls_long_alloc_mean                       +0.0177         +0.0177          6142          6251          6140          6249
BM_sinsp_sanitize_string_slow_path_c1_controls_long_alloc_median                     +0.0177         +0.0177          6141          6250          6139          6248
BM_sinsp_sanitize_string_slow_path_c1_controls_long_alloc_stddev                     +0.0625         +0.1951             2             3             2             3
BM_sinsp_sanitize_string_slow_path_c1_controls_long_alloc_cv                         +0.0441         +0.1744             0             0             0             0
BM_sinsp_sanitize_string_slow_path_c1_controls_long_noalloc_mean                     +0.0034         +0.0033          6020          6041          6018          6038
BM_sinsp_sanitize_string_slow_path_c1_controls_long_noalloc_median                   +0.0000         +0.0000          6020          6021          6018          6018
BM_sinsp_sanitize_string_slow_path_c1_controls_long_noalloc_stddev                  +25.2997        +26.0509             2            42             2            42
BM_sinsp_sanitize_string_slow_path_c1_controls_long_noalloc_cv                      +25.2116        +25.9614             0             0             0             0
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_alloc_mean                    +0.0032         +0.0032           325           326           325           326
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_alloc_median                  +0.0024         +0.0023           325           325           325           325
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_alloc_stddev                  +0.3397         +0.3215             1             2             1             2
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_alloc_cv                      +0.3354         +0.3173             0             0             0             0
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_noalloc_mean                  +0.0093         +0.0094           219           221           219           221
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_noalloc_median                +0.0103         +0.0105           219           221           219           221
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_noalloc_stddev                +0.2065         +0.2114             1             1             1             1
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_noalloc_cv                    +0.1953         +0.2001             0             0             0             0
BM_sinsp_sanitize_string_slow_path_all_invalid_long_alloc_mean                       -0.0004         -0.0005         12459         12455         12456         12450
BM_sinsp_sanitize_string_slow_path_all_invalid_long_alloc_median                     -0.0005         -0.0005         12459         12453         12455         12449
BM_sinsp_sanitize_string_slow_path_all_invalid_long_alloc_stddev                     -0.1896         -0.1437             6             5             6             5
BM_sinsp_sanitize_string_slow_path_all_invalid_long_alloc_cv                         -0.1893         -0.1433             0             0             0             0
BM_sinsp_sanitize_string_slow_path_all_invalid_long_noalloc_mean                     -0.0004         -0.0004         12249         12244         12245         12240
BM_sinsp_sanitize_string_slow_path_all_invalid_long_noalloc_median                   -0.0004         -0.0004         12249         12244         12245         12240
BM_sinsp_sanitize_string_slow_path_all_invalid_long_noalloc_stddev                   -0.0989         -0.1598             5             4             5             4
BM_sinsp_sanitize_string_slow_path_all_invalid_long_noalloc_cv                       -0.0985         -0.1594             0             0             0             0

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.65%. Comparing base (af6e6f2) to head (e9eee31).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3011   +/-   ##
=======================================
  Coverage   75.65%   75.65%           
=======================================
  Files         299      299           
  Lines       32936    32936           
  Branches     5118     5118           
=======================================
  Hits        24919    24919           
  Misses       8017     8017           
Flag Coverage Δ
libsinsp 75.65% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@terror96
Copy link
Copy Markdown
Contributor

terror96 commented Jun 1, 2026

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants