Skip to content

libflake-tests: fix leak in nix_api_store_test.nix_api_load_flake_with_flags#14963

Merged
xokdvium merged 1 commit intoNixOS:masterfrom
corngood:test-leak
Jan 10, 2026
Merged

libflake-tests: fix leak in nix_api_store_test.nix_api_load_flake_with_flags#14963
xokdvium merged 1 commit intoNixOS:masterfrom
corngood:test-leak

Conversation

@corngood
Copy link
Contributor

@corngood corngood commented Jan 9, 2026

Motivation

This test fails on cygwin:

[ RUN      ] nix_api_store_test.nix_api_load_flake_with_flags
warning: not writing modified lock file of flake 'path:/nix/var/nix/builds/nix-42403-950678037/nix-42408-3476222066/a':
• Added input 'b':
    'path:/nix/var/nix/builds/nix-42403-950678037/nix-42408-3476222066/b?lastModified=1767989117&narHash=sha256-nmA1vVxlRS1Y1wCpntvetQpa61NB/OvvroPCiZwRc%2BM%3D' (2026-01-09)
warning: creating lock file "/nix/var/nix/builds/nix-42403-950678037/nix-42408-3476222066/a/flake.lock":
• Added input 'b':
    'path:/nix/var/nix/builds/nix-42403-950678037/nix-42408-3476222066/b?lastModified=1767989117&narHash=sha256-nmA1vVxlRS1Y1wCpntvetQpa61NB/OvvroPCiZwRc%2BM%3D' (2026-01-09)
warning: not writing modified lock file of flake 'path:/nix/var/nix/builds/nix-42403-950678037/nix-42408-3476222066/a':
• Updated input 'b':
    'path:/nix/var/nix/builds/nix-42403-950678037/nix-42408-3476222066/b?lastModified=1767989117&narHash=sha256-nmA1vVxlRS1Y1wCpntvetQpa61NB/OvvroPCiZwRc%2BM%3D' (2026-01-09)
  → 'path:/nix/var/nix/builds/nix-42403-950678037/nix-42408-3476222066/c?lastModified=1767989117&narHash=sha256-7aeUAJM1XBrPeH/XiwlMaFnz3RPCqTgvlNSGEK8cR10%3D' (2026-01-09)
terminate called after throwing an instance of 'std::filesystem::__cxx11::filesystem_error'
  what():  filesystem error: cannot remove all: Device or resource busy [/nix/var/nix/builds/nix-42403-950678037/tests_nix-store.pUTLXB] [/nix/var/nix/builds/nix-42403-950678037/tests_nix-store.pUTLXB/my_state/db/db.sqlite]
/nix/var/nix/builds/nix-42403-950678037/.attr-0l2nkwhif96f51f4amnlf414lhl4rv9vh8iffyp431v6s28gsr90: line 3: 42408 Aborted                    /nix/store/hl337315ycb68z69mrhwwr8h0w8w8q6g-exec/bin/exec /nix/store/ppa17sj1x080dans4nhrwhxd22ic1lxa-nix-flake-tests-2.34pre20251217_b6add8dc+5/bin/nix-flake-tests.exe

Context

A fix for the problem described here may also be required for this test to actually pass.


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@corngood corngood requested a review from edolstra as a code owner January 9, 2026 20:53
@github-actions github-actions bot added the c api Nix as a C library with a stable interface label Jan 9, 2026
@xokdvium xokdvium added this pull request to the merge queue Jan 9, 2026
Merged via the queue into NixOS:master with commit 3b95b7c Jan 10, 2026
14 checks passed
@Ericson2314
Copy link
Member

@xokdvium should be using std::unique_ptr and RAII in these tests too? Seems like it would be a bit more robust.

JustAGuyTryingHisBest pushed a commit to JustAGuyTryingHisBest/nix that referenced this pull request Jan 12, 2026
libflake-tests: fix leak in nix_api_store_test.nix_api_load_flake_with_flags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c api Nix as a C library with a stable interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants