Repository navigation
Conversation
We're all pretty helpless seeing messages like: value is an attribute set while a list was expected This patch add the flag --xml-debug-coercion-failure making nix output the xml representation of the attribute set. Please not that this may fail if the thing to be coerced cannot be turned into xml, eg because its evaluation does not end, eg due to infinite recursion. TODO: document this flag Signed-off-by: Marc Weber <[email protected]>
Contributor
Author
|
Please have a look and tell me whether you're interested in this patch. Then I'm writing the documentation for it. |
This was referenced Dec 10, 2014
ConnorBaker
pushed a commit
to ConnorBaker/nix
that referenced
this pull request
Jul 25, 2025
Fixup the complainy docs line
ConnorBaker
added a commit
to ConnorBaker/nix
that referenced
this pull request
May 25, 2026
…caffold prim_match and prim_split both fetched a compiled regex from the EvalState regex cache and translated std::regex_error into a uniform EvalError keyed on the regex source string. Two structurally distinct post-match assemblies (regex_match vs cregex_iterator) sat between the open-scaffold and the catch arm, but the scaffold itself was duplicated verbatim — including the error_space special case for libstdc++'s regex-state-limit memory exhaustion. Extract a private withRegex<Body> template helper covering the regex-fetch + try/catch only; pass the compiled `const std::regex &` into the body callback. The two consumers' post-match assemblies stay inline. The helper takes the RegexCache by reference rather than reaching through state.regexCache directly: regexCache is a private member of EvalState, and the existing friend declarations on prim_match / prim_split (in eval.hh) are unchanged. The friended primops fetch *state.regexCache and pass it through. A future cleanup that lands a public EvalState::compileRegex accessor — alongside NixOS#169's broader EvalState friend-cluster reduction — would let the explicit cache parameter collapse and the two friend declarations go away. No behaviour change: error wording, error positions, regex caching semantics, and the libstdc++-state-limit error_space arm all preserved exactly. Refs candidate NixOS#111. See also: NixOS#169 (the friend-cluster cleanup that will make the explicit cache parameter unnecessary). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ConnorBaker
added a commit
to ConnorBaker/nix
that referenced
this pull request
May 25, 2026
…S#111 NixOS#76 + NixOS#229 doc-fix + NixOS#156 declined) Sprint 1 targeted single-shard candidates that don't create cross-shard dependencies. Five candidates evaluated; three shipped, one already-shipped doc-fix, one declined-with-reason. Shipped (three): NixOS#87 (libexpr) — eager/lazy C-binding accessor pair dedup. The six public symbols (nix_get_list_byidx{,_lazy}, nix_get_attr_byname{,_lazy}, nix_get_attr_byidx{,_lazy}) become one-line wrappers around three file-static private impl helpers selecting force=true or force=false. ABI unchanged. nix_get_attr_byidx_lazy's "(Nix C API contract violation)" error-message suffix is threaded through the impl as a parameter rather than collapsed, preserving both error strings exactly. libexpr commit 374e9db. NixOS#111 (libexpr) — withRegex<Body> template helper extracting the prim_match/prim_split regex-fetch + try/catch scaffold. The two post-match assemblies (regex_match vs cregex_iterator) stay inline. Helper takes a RegexCache& by reference rather than reaching through state.regexCache directly, because that member is private and the existing prim_match/prim_split friend declarations cover only those two functions; the friended primops fetch *state.regexCache and pass it through. A future public EvalState::compileRegex accessor (alongside NixOS#169's EvalState friend-cluster reduction) would let the explicit cache parameter collapse and the two friend declarations go away. Error wording, positions, and the libstdc++-state-limit error_space arm preserved exactly. libexpr commit 4182720. NixOS#76 (nix-cli) — walkClosure template helper deduplicating the dotgraph/graphml BFS scaffold. New file-local nix-store/closure-walk.hh; both consumers call walkClosure with their own per-path and per-edge callbacks. Helper kept in nix-store/ rather than promoted to libstore's store-api.hh per the candidate's original sketch — that promotion would be a cross-shard libstore change. Header-only template means no meson.build edit. Output is byte-for-byte identical pre/post for both formats. nix-cli commit 705114e. Already shipped, doc-fix only: NixOS#229 — parameterised SeenSet<T> on libexpr. Already shipped in Batch E as commit 76b6808 ("libexpr/print: parameterise SeenSet by element pointer type (NixOS#229)"). Branch line was missing from the candidate body — same gap as Pass-1's six missed Branch lines. Added. Declined-with-reason: NixOS#156 (libstore fan-out idiom dedup) — re-read in Sprint 1 showed the "shared" block is ~6 lines before two structurally different doneFailure overload shapes diverge: gaveUpOnSubstitution passes BuildError(Failure::DependencyFailed, msg); resolveDerivation passes (ecFailed, BuildResult::Failure struct). Extraction would be cosmetic — saves ~10 lines net but doesn't unlock anything else. Skip-with-reason recorded; re- evaluate when doneFailure's overloads unify or a third caller adopts the same shape. STATUS.md cleanup-branches table: - libexpr tip moves to 4182720 (was 76b6808) - nix-cli tip moves to 705114e (was 24ebbcc) - Sprint-1 candidates appended to both row narratives Current tip SHAs block also updated. New "Sprint 1" recently-completed entry. Five other branches unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We're all pretty helpless seeing messages like:
value is an attribute set while a list was expected
This patch add the flag --xml-debug-coercion-failure
making nix output the xml representation of the attribute set.
Please not that this may fail if the thing to be coerced
cannot be turned into xml, eg because its evaluation does not end, eg due to
infinite recursion.
TODO: document this flag
Signed-off-by: Marc Weber [email protected]