Skip to content

Fix empty input path segfault (#14816)#14846

Merged
xokdvium merged 6 commits intoNixOS:masterfrom
roberth:issue-14816
Dec 22, 2025
Merged

Fix empty input path segfault (#14816)#14846
xokdvium merged 6 commits intoNixOS:masterfrom
roberth:issue-14816

Conversation

@roberth
Copy link
Member

@roberth roberth commented Dec 21, 2025

Motivation

Context


Add 👍 to pull requests you find important.

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

An empty attribute path refers to the flake itself, contradicting
the purpose of --override-input, which is for overriding inputs.

Fixes: NixOS#14816
An empty attribute path refers to the flake itself, contradicting
the purpose of input overrides, which are for overriding inputs.

Related: NixOS#14816
Wraps InputAttrPath with compile-time guarantee of non-emptiness.
Replaces obscure .back() calls with domain-specific inputName() method.

An empty path refers to the flake itself, making it nonsensical for
input override operations. The type system now prevents this.
An empty path refers to the flake itself, not an input. Apply the same
type safety to inputUpdates as inputOverrides.

The deprecated --update-input flag (deprecated since Nix 2.4) and the
modern 'nix flake update' command now properly reject empty paths.

Includes functional tests for both commands.
Make the error message more explicit about what went wrong and why
it's invalid. The new message explains that a zero-length path was
passed and clarifies that it would refer to the flake itself.
Make the C API error message more explicit about what went wrong and
why it's invalid. The new message explains that a zero-length path was
passed and clarifies that it would refer to the flake itself.

Updates the unit test to match the new error message.
@roberth roberth requested a review from edolstra as a code owner December 21, 2025 12:11
@github-actions github-actions bot added new-cli Relating to the "nix" command with-tests Issues related to testing. PRs with tests have some priority c api Nix as a C library with a stable interface labels Dec 21, 2025
@xokdvium xokdvium added this pull request to the merge queue Dec 22, 2025
Merged via the queue into NixOS:master with commit 130a656 Dec 22, 2025
16 checks passed
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 new-cli Relating to the "nix" command with-tests Issues related to testing. PRs with tests have some priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nix flake lock --override-input "" . SIGSEGVs

2 participants