Skip to content

Releases: rizsotto/Bear

4.1.5

Choose a tag to compare

@rizsotto rizsotto released this 03 Jul 08:41
4.1.5
b66ddb8

What's Changed

Features

  • Vala (valac) compiler support (#709). Bear now recognizes valac invocations and emits one compilation entry per Vala (.vala) or Genie (.gs) source, so vala-language-server can consume a Bear-generated compile_commands.json on non-meson builds.
  • Inline @file response files (#701, opt-in). Response-file arguments can be expanded inline into each entry, so the recorded command is self-contained instead of pointing at a file the consumer has to resolve.
  • Configurable environment-derived flags. Flags Bear derives from the build environment are now configurable, giving finer control over what ends up in each entry.
  • --append: latest compilation wins for rebuilt files. When appending to an existing database, the newest compilation of a rebuilt file supersedes the stale one instead of leaving a duplicate.
  • Full process-tree teardown with signal fidelity. The supervisor now tears down the entire build tree and forwards the real terminating signal, reaping detached descendants via cgroup v2 so nothing is left running after an interrupted build.

Bug Fixes

  • Recognize GCC by its FSF copyright, not the (GCC) tag (#711). Fixes cc recognition on Alpine Linux, whose GCC banner omits the (GCC) marker Bear previously relied on.
  • OS-independent output path handling. The output_from_o path logic no longer assumes a specific platform's path conventions.
  • exec the driver from the install entry script. The installed bear entry script now execs bear-driver instead of spawning it as a child.

Internal Refactoring

  • Regroup the workspace crates by role into directory roots, extract the shared interception runtime into an intercept crate, split driver-side interception into intercept-supervisor, and split bear-driver / bear-wrapper into dedicated binary crates.
  • Rename the interpreter YAML directory to compilers and build CompilerInterpreter in a single pass.
  • Refresh workspace dependencies: ctor 0.6 -> 1.0 plus a sweep to the latest compatible versions.

Tests

  • New bear-test-tools cdb-compare binary for comparing compilation databases, with invariants, sampling, and a CMake-oracle comparison mode.
  • A staged dogfooding harness (containerized golden-regression, CMake-oracle, and determinism self-checks) that validates Bear against real projects at kernel and midsize scale.

Documentation

  • Reorganize the docs tree: split requirements and rationale, make requirements contract-only, and repoint the routing tables.
  • Turn the release procedure into an invocable skill and capture the shared coding-style and commit conventions.
  • Man page fixes, including escaping -- to prevent unintended smartification (#708).

Closed Issues

  • #711 - Bear-4.1.4 fails to recognize cc on Alpine Linux (fixed)
  • #701 - Allow inlining response files in command line arguments (implemented)
  • #702 - ld.so $LIB preload warning with 32-bit arm-linux-gcc (documented; not a Bear defect)

Thanks

New Contributors

Full Changelog: 4.1.4...4.1.5

4.1.4

Choose a tag to compare

@rizsotto rizsotto released this 02 Jun 18:18
4.1.4

What's Changed

Bug Fixes

  • Intercept pclose (#698). pclose is now in the exported symbol list, so the popen/pclose pair is intercepted as a unit. Fixes the hardened_popen_after_unsetenv test on FreeBSD.
  • Report nested exec* on musl / s390x (#705). Bear now intercepts musl's __execvpe, so commands launched by a nested exec are captured on musl-based systems (observed on linux/s390x).
  • Do not lose the last compile on collector shutdown (#704). The TCP collector now drains its backlog on shutdown instead of racing the final event, so the last compilation is no longer dropped (observed on linux/s390x).
  • Use sh instead of bash (#703). Build and test scripting no longer assumes bash; the project targets POSIX sh. This unblocks environments where bash is absent.

Internal Refactoring

  • Drop the bash dependency project-wide: test fixtures, the Dockerfile pipe, the coverage check, and documentation code fences all moved from bash to POSIX sh.
  • Refresh workspace dependency constraints for the release. Each declared floor stays at-or-below what Fedora rawhide ships, so packagers need no substitution patches: clap/clap_complete 4.5 -> 4.6, tempfile 3.19 -> 3.27, assert_cmd 2.0 -> 2.2 (dev-dep), and serde-saphyr 0.0.24 -> 0.0.27 (upstream patch fixes; the crate is not packaged in Fedora). insta is deliberately held at 1.46 because rawhide does not yet carry 1.47.
  • Bump the devcontainer base image to Fedora 44.
  • Add regression guards for precompiled-header source recognition (#601), --append performance on large databases (#532), and non-UTF-8 argv interception (#506).
  • Issue/PR tooling: add labels.yml as the source of truth for labels, convert the bug report to a structured issue form, disable blank issues, and link Discussions from the issue picker.

Documentation

  • Document the libsandbox env-clear preload conflict as a known limitation (#699, #675). When Bear's suite runs inside a sandbox (e.g. Gentoo's emerge), libsandbox.so strips Bear's library from LD_PRELOAD after an env -i, so the env-clear tests are not intercepted. This is not a Bear defect; the packaging-side fix is RESTRICT="test" or FEATURES="-sandbox -usersandbox".
  • New requirement proposals: @file response-file inlining (#701), an events file as an external interchange format (#644), and C++20 module recognition (#637).
  • Spell out the three-place sync required when adding a new intercept in intercept-preload.

Closed Issues

  • #705 - LD_PRELOAD does not report nested exec* on musl linux/s390x
  • #704 - source_directory_filter_config loses last compile on linux/s390x (TCP collector shutdown race)
  • #702 - ld.so: object '/usr/$LIB/bear/libexec.so' from LD_PRELOAD cannot be preloaded
  • #699 - some tests are failing (documented as a sandbox/libsandbox limitation, not a Bear defect)

Thanks

Full Changelog: 4.1.3...4.1.4

4.1.3

Choose a tag to compare

@rizsotto rizsotto released this 04 May 08:58
4.1.3
fc7eb4a

What's Changed

Bug Fixes

  • Recognition: probe cc/c++ to pick Clang vs GCC on BSD/macOS hosts (#694). When a build invokes the compiler under the ambiguous names cc or c++, Bear now runs the executable once with --version to classify it as GCC or Clang before dispatching to an interpreter. The result is cached per canonical path. This fixes empty/incorrect compile_commands.json entries on macOS, FreeBSD, OpenBSD, NetBSD, and DragonFly, where cc is Clang rather than GCC. The probe is skipped for known wrappers (ccache, distcc, sccache), strips LD_PRELOAD/DYLD_INSERT_LIBRARIES to avoid re-entry, and a user compilers: config entry continues to override classification.

Performance

  • Reduce dependency footprint and clean-build compile time of the workspace:
    • Drop regex in favor of regex-lite (no PCRE features were used).
    • Drop env_logger's humantime feature (pulled in jiff).
    • Drop tempfile from bear's runtime dependencies (only used in tests).
    • Drop directories in favor of a direct env lookup for config paths.
  • platform-checks now probes the host once per workspace build and replays results to consumers via emit_cfg() / emit_check_cfg(), instead of re-running the probe in each consuming crate's build.rs.

Internal Refactoring

  • Extract generate-completions into a dedicated bear-completions crate so the main bear binary does not need clap_complete.
  • Drop the Event wrapper in the intercept channel; send Execution directly.
  • Replace the PathFormatter trait in the Clang output path with resolver function pointers.
  • Rename CommandConverter::to_entries to convert.
  • Replace ValidationCollector in config with free helper functions.
  • Switch test-suite verbosity control from BEAR_TEST_VERBOSE to standard RUST_LOG.

Documentation

  • Per-crate CLAUDE.md files explain the build pipeline (codegen, platform-checks, preload shim) and the layering between crates.
  • New requirement spec: requirements/recognition-ambiguous-name-probe.md documents the cc/c++ probe contract.

Closed Issues

  • #694 - MacOS create a blank compile_commands.json

Thanks

Full Changelog: 4.1.2...4.1.3

4.1.2

Choose a tag to compare

@rizsotto rizsotto released this 25 Apr 06:09
4.1.2
98c8a50

What's Changed

Features

  • Wrapper mode: compiler env vars with embedded flags: accept CC="gcc -std=c11" / CXX="clang++ -stdlib=libc++" style values (GNU Make convention) - the first token resolves as the compiler, trailing tokens become flags
  • Wrapper mode: masquerade compiler resolution: bare names like cl, gcc, cc now resolve through PATH before wrapper registration, with case-insensitive matching on Windows (#686)
  • Output: drop invalid entries with a warning instead of aborting the whole pipeline (#692)
  • Install script: install binaries to /usr/libexec instead of /usr/share (FHS-compliant, fixes packaging in distros)

Bug Fixes

  • fix(msvc): handle all per-warning cl.exe options - /wd, /we, /wo with space-separated value, plus previously-unsupported /w1-/w4 and /Wv[:version] (#690)
  • fix(install): correct script for distro packaging (#685)
  • fix(output): return "." from relative_to for self-referential paths
  • fix(intercept): apply review findings for masquerade-wrapper handling

Internal

  • Refresh dependency pins and consolidate into the workspace
  • Bump rand 0.9.2 -> 0.9.4
  • Rewrite preload and wrapper interception requirement specs; document output pipeline
  • Tag existing tests with the requirements they protect
  • Substantial new test coverage: output transformation rules, atomic-write success/failure, canonical/relative path formats, duplicate-detection match fields, wrapper-mode .bear/ lifecycle, mid-compile signal interruption, MSVC glued/clang-cl inheritance

Documentation

  • INSTALL.md: document lld requirement on Linux
  • bear.1: document compiler env vars with embedded flags
  • Replace AGENTS.md with topic-scoped CLAUDE.md files
  • Add RELEASE.md capturing the release process

Closed Issues

  • #647 - hangs during dotnet restore (verified fixed with 4.1.x)
  • #685 - install.sh wrong
  • #686 - Windows wrapper mode masquerade compiler resolution
  • #690 - MSVC per-warning option handling
  • #692 - channel disconnect when using a format option

Thanks

Full Changelog: 4.1.1...4.1.2

4.1.1

Choose a tag to compare

@rizsotto rizsotto released this 04 Apr 04:23
4.1.1
9fe478d

What's Changed

Features

  • New compiler support: MSVC, clang-cl, Intel C/C++ (icx, icpx), NVIDIA HPC SDK (nvc, nvc++, nvfortran), ARM Compiler 6, and IBM Open XL
  • Windows improvements: case-insensitive executable matching and slash-prefix flag support (e.g. /Fo, /Ot)
  • Environment variable forwarding: data-driven per-compiler environment variable extraction, replacing hardcoded GCC-only handling
  • Install script: add DESTDIR support for packaging workflows

Bug Fixes

  • fix: canonical path generation on Windows stripping \\?\ prefix (#683)
  • fix: inconsistent flag inheritance - make all resolution transitive
  • fix: replace remaining panics with proper anyhow error handling

Performance

  • Eliminate temporary String allocations in flag pattern matching
  • Remove intermediate Vec<String> from FlagMatch
  • Pre-allocate Vec capacity in parse_arguments and parse_environment
  • Replace Box<dyn Arguments> with Argument enum (static dispatch)

Code Generation Overhaul

  • Extract bear-codegen crate from build.rs flag generation
  • Add flag dedup and conflict detection during inheritance
  • Add colon separator patterns and pass-through flag support
  • Add flag terminator support
  • Introduce ResolvedTable with snapshot, schema validation, and property-based tests

Internal Refactoring

  • Decouple intercept layer from semantic compiler recognition
  • Extract EntryFilter trait and FilteredOutputWriter into filtering module
  • Tighten module visibility (pub to pub(super) and private)
  • Simplify CompilerCommand to Command, remove OutputCommand wrapper

Documentation

  • Updated man page with correct schema version, complete compiler list, and cc/c++ defaults
  • Cleaned up README

Closed Issues

  • #683 - bear generates invalid canonical paths
  • #682 - install.sh should also have a DESTDIR variable

Full Changelog: 4.1.0...4.1.1

4.1.0

Choose a tag to compare

@rizsotto rizsotto released this 28 Mar 13:06
4.1.0
ca53f3b

What's Changed

Features

  • Shell completions: generate completions for bash, zsh, fish, and elvish
  • Compiler executable paths: preserve full compiler executable path in compilation database; resolve bare executable filenames to absolute paths
  • Install script: new scripts/install.sh with build-time INTERCEPT_LIBDIR validation, replacing manual setup
  • DevContainer: introduce devcontainer for streamlined development environment

Bug Fixes

  • fix: inline va_arg extraction in variadic exec shims for i686 compatibility
  • fix: preserve co-resident LD_PRELOAD libraries during env doctoring
  • fix: restore session env vars in system()/popen() for older glibc
  • fix: unify preload restoration for system()/popen() with exec-family doctoring
  • fix: recover from poisoned mutex in popen/pclose instead of panicking
  • fix: replace panic with TryFrom error for empty Execution arguments
  • fix: return fmt::Error instead of panicking in Configuration Display impl
  • fix: handle Prefix flags with = in name in build-time codegen

Robustness & Stability

  • Replace multiple panic!/unwrap paths with proper error handling (thiserror, TryFrom, fmt::Error)
  • Reimplement system()/popen() on top of posix_spawnp for safer process creation
  • Add hardened interception tests for environment sabotage scenarios
  • Replace serde_yml with serde-saphyr for YAML parsing

Compiler Recognition Overhaul

  • Move compiler flag definitions from Rust source to YAML with build-time code generation
  • Replace per-compiler interpreter structs with a generic FlagBasedInterpreter
  • Auto-generate recognition patterns and ignored-executable lists from YAML schema
  • Match ignored executables by filename instead of full path

Documentation

  • Expanded README with usage guidance, platform info, and limitations
  • Improved INSTALL with prerequisites, package manager instructions, and verification steps
  • Improved CONTRIBUTING with developer workflow and guidelines

Internal Refactoring

  • Split config.rs, infrastructure.rs into module directories
  • Split output module (formats.rs, writers.rs) into focused submodules
  • Centralize envp traversal into envp_iter iterator; consolidate session context
  • Replace empty-string sentinels with Option<String>
  • Extensive new test coverage across output, compiler interpreter, and interception modules

New Contributors

Full Changelog: 4.0.4...4.1.0

4.0.4

Choose a tag to compare

@rizsotto rizsotto released this 28 Feb 07:08
4.0.4
da19b6f

What's Changed

  • fix: add -arch flag to GCC flags to prevent argument loss on macOS ARM by @thisalihassan in #674
  • fix: Internal f951 gfortran compiler execution not-excluded #672
  • fix: flaky test in tcp module
  • fix: compiler wrapper handling bugs, improve test coverage

New Contributors

Full Changelog: 4.0.3...4.0.4

4.0.3

Choose a tag to compare

@rizsotto rizsotto released this 09 Feb 10:30
4.0.3
5601055

What's Changed

  • intercept-preload: Force use lld as the linker by @aokblast in #664 #662
  • semantic: Do not require - or _ for versioned compilers by @derekschrock in #663
  • semantic: Source files with identical names in separate directories erroneously dropped #667
  • intercept: Crash when trying to execute a build script without shebang #666
  • intercept: add IPv6 loopback address to fall back to
  • intercept: reporting in wrapper mode using the configuration file only
  • intercept: preload mode defends against environment variables reset
  • intercept: preload library errno handling clean up

New Contributors

Full Changelog: 4.0.2...4.0.3

4.0.2

Choose a tag to compare

@rizsotto rizsotto released this 18 Jan 05:54
4.0.2
42e37c8

What's Changed

  • docs: update man page by @antonkesy in #653
  • build: Add Windows notes for configurable paths by @alvrogd in #655
  • bugfix: wrapper mode does not work with configure #656
  • bugfix: preload mode does not work with vararg functions #658
  • bugfix: semantic interpreter misqualifies compilations #656

New Contributors

Full Changelog: 4.0.1...4.0.2

4.0.1

Choose a tag to compare

@rizsotto rizsotto released this 11 Jan 11:38
4.0.1
ec39e61

What's Changed

New Contributors

Full Changelog: 4.0.0...4.0.1