Skip to content

fix(valgrind): honor locally-installed valgrind on non-apt systems#414

Open
not-matthias wants to merge 1 commit into
mainfrom
cod-2918-honor-locally-installed-codspeed-valgrind-on-non-apt-systems
Open

fix(valgrind): honor locally-installed valgrind on non-apt systems#414
not-matthias wants to merge 1 commit into
mainfrom
cod-2918-honor-locally-installed-codspeed-valgrind-on-non-apt-systems

Conversation

@not-matthias

Copy link
Copy Markdown
Member

No description provided.

@greptile-apps

greptile-apps Bot commented Jun 18, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a false-negative in the valgrind installation check on non-apt-based Linux systems (e.g. NixOS). Previously, is_valgrind_installed unconditionally called dpkg -s libc6-dbg, which would report the package as missing on any system without dpkg, causing the tool to attempt an apt-based installation even when a valid CodSpeed valgrind was already present.

  • apt::is_system_compatible is made pub so setup.rs can reach it directly, and is_valgrind_installed is updated to accept &SystemInfo and skip the libc6-dbg dpkg check on non-apt systems.
  • On apt-compatible systems the existing libc6-dbg gate is preserved unchanged; the installation closure still calls apt::install, so cache save/restore semantics are unaffected.

Confidence Score: 5/5

Safe to merge — the change is narrow and well-targeted, with no impact on the existing apt-based installation path.

The fix correctly short-circuits the valgrind installation check on non-apt systems without touching any of the apt-based caching, installation, or version-checking logic. The is_system_compatible guard that already surrounds restore_from_cache and save_to_cache means no cache operations are attempted on non-apt systems, and the install closure is never reached when is_valgrind_installed returns true. The refactor to pass system_info by reference is clean, and the tracing debug! call follows the project's logging convention.

No files require special attention.

Important Files Changed

Filename Overview
src/executor/helpers/apt.rs Visibility of is_system_compatible changed from private to pub to allow cross-module use; no logic changes.
src/executor/valgrind/setup.rs is_valgrind_installed now accepts &SystemInfo and skips the dpkg/libc6-dbg check on non-apt systems; call-site updated to pass system_info via closure capture.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[install_valgrind called] --> B["is_valgrind_installed(system_info)"]
    B --> C{valgrind status\nInstalled?}
    C -- No --> D[return false]
    C -- Yes --> E{apt-compatible\nsystem?}
    E -- Yes --> F["dpkg -s libc6-dbg"]
    F -- installed --> G[return true]
    F -- missing --> D
    E -- No --> H["debug: skipping libc6-dbg check"]
    H --> G
    D --> I[apt::install_cached proceeds]
    I --> J{cache_dir provided?}
    J -- Yes --> K[restore_from_cache]
    K --> L{now installed?}
    L -- Yes --> M[done ✓]
    L -- No --> N[run install closure]
    J -- No --> N
    N --> O["apt::install(valgrind + libc6-dbg)"]
    O --> P{apt-compatible?}
    P -- No --> Q[bail! unsupported system]
    P -- Yes --> R[save_to_cache → done ✓]
    G --> S[skip installation ✓]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[install_valgrind called] --> B["is_valgrind_installed(system_info)"]
    B --> C{valgrind status\nInstalled?}
    C -- No --> D[return false]
    C -- Yes --> E{apt-compatible\nsystem?}
    E -- Yes --> F["dpkg -s libc6-dbg"]
    F -- installed --> G[return true]
    F -- missing --> D
    E -- No --> H["debug: skipping libc6-dbg check"]
    H --> G
    D --> I[apt::install_cached proceeds]
    I --> J{cache_dir provided?}
    J -- Yes --> K[restore_from_cache]
    K --> L{now installed?}
    L -- Yes --> M[done ✓]
    L -- No --> N[run install closure]
    J -- No --> N
    N --> O["apt::install(valgrind + libc6-dbg)"]
    O --> P{apt-compatible?}
    P -- No --> Q[bail! unsupported system]
    P -- Yes --> R[save_to_cache → done ✓]
    G --> S[skip installation ✓]
Loading

Reviews (1): Last reviewed commit: "fix(valgrind): honor locally-installed v..." | Re-trigger Greptile

@codspeed-hq

codspeed-hq Bot commented Jun 18, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 7 untouched benchmarks


Comparing cod-2918-honor-locally-installed-codspeed-valgrind-on-non-apt-systems (bbbffe1) with main (10e74ba)

Open in CodSpeed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants