Skip to content

corepkgs/fetchurl: Enable making the downloaded file executable - #87

Closed
shlevy wants to merge 1 commit into
NixOS:masterfrom
shlevy:corepkgs-fetchurl
Closed

shlevy wants to merge 1 commit into
NixOS:masterfrom
shlevy:corepkgs-fetchurl

Conversation

@shlevy

@shlevy shlevy commented Jan 19, 2013

Copy link
Copy Markdown
Member

No description provided.

@shlevy

shlevy commented Jan 20, 2013

Copy link
Copy Markdown
Member Author

@edolstra Thoughts? With this we can finally remove binaries from the nixpkgs tree.

@edolstra

Copy link
Copy Markdown
Member

Applied, thanks!

@edolstra edolstra closed this Jan 21, 2013
zolodev pushed a commit to zolodev/nix that referenced this pull request Jan 1, 2024
Mention `nixpkgs-review` for reverse dependencies
ConnorBaker pushed a commit to ConnorBaker/nix that referenced this pull request Jul 25, 2025
…message-only-on-buildable-platform

fixup: only show "you can rerun" message if the derivation's platform is supported on this machine
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 25, 2026
…impls

The C-binding accessors come in eager/lazy pairs differing only in
whether the returned value is forced before being wrapped:

  nix_get_list_byidx        / nix_get_list_byidx_lazy
  nix_get_attr_byname       / nix_get_attr_byname_lazy
  nix_get_attr_byidx        / nix_get_attr_byidx_lazy

Each pair carried a near-identical body — the type assertion, the
bounds-check or symbol-lookup, the new_nix_value wrapper, the
NIXC_CATCH_ERRS_NULL trailer — duplicated verbatim. The eager half
called forceValue() before wrapping; the lazy half didn't. Three
file-static private impls now carry the shared body with a `bool
force` parameter; the six public symbols become one-line wrappers
that select force=true or force=false.

Public API unchanged: the six symbol names, signatures, and ABI are
preserved exactly. Error wording is preserved exactly:
nix_get_attr_byidx_lazy's "(Nix C API contract violation)" suffix
on the bounds-check error message — divergent from
nix_get_attr_byidx's plain "attribute index out of bounds" — is
threaded through the impl helper as a parameter rather than
collapsed, so neither error string changes.

Refs candidate NixOS#87.

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]>
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 29, 2026
The NixOS#87 dedup (374e9db) folded nix_get_list_byidx and
nix_get_list_byidx_lazy onto a shared get_list_byidx_impl, but the
comment claimed "the rest of the behaviour ... is identical across both
public symbols." That is not quite true: the eager path's
`if (p == nullptr) return nullptr;` guard for an in-bounds NULL list
element was extended to the lazy symbol, which on master lacked it
(master's lazy accessor wrapped the null pointer and returned a non-null
nix_value over it with NIX_OK). The unified behaviour is more defensive
and preferable, but it is an observable public-C-API change for that
edge case, so the comment is corrected to state it explicitly.

Follow-up to candidate NixOS#87 (2026-05 audit finding F044). Comment only;
no code change.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
Step 1a of per-arg CDI centralization (task NixOS#86). Adds the schema
for a structured access path: a sequence of PathStep selectors
(GetAttr by name, GetListElem by index) rooted in a cb_arg.

The type is dormant in this commit — no Query carries one yet —
but adding it now lets subsequent commits plumb the field through
the trace layer + emitters + writer + walker without re-shuffling
the JSON encoding.

PathStep deliberately reserves room for an apply variant (=
function characterization, task NixOS#87) but doesn't add it now. The
serialization is a plain array of {kind, name|index} objects, so
extending the variant later is a forward-compatible addition.

Assisted-by: Claude Code (Claude Opus 4.7)
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
Step 1c of per-arg CDI centralization (task NixOS#86). Walks a
Subject's parent chain to build a `trace::PathExpr` from the root
out: PositionalSeed / OpaqueContentSubject contribute no steps
(= they're roots), DerivedSubject contributes one step per node,
ApplyResultSubject throws for now (= deferred to task NixOS#87's
function characterization).

The helper isn't called yet — that's the next step, where emitters
and the writer's flush start populating `query.path` and the
substitution semantics flip from per-Subject `from` to per-root
`fromCIDs[0]` with the path identifying which derived value the
observation is on. Until that wiring lands, query.path stays empty
and the serialized payloads are byte-identical to before, keeping
the suite at 152 + 1 red.

Assisted-by: Claude Code (Claude Opus 4.7)
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
…ltSubject

Throw was wrong for the intended use: callers walking the chain
from an arbitrary Subject can't know in advance whether it'll
encounter an ApplyResultSubject. Returning empty path (= "I can't
represent this yet") lets callers fall back to the legacy
single-`from` identity until task NixOS#87 introduces an apply form
in PathStep.

Assisted-by: Claude Code (Claude Opus 4.7)
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
resolveProducerChild and dispatchAmbientQuery now read query.path
and walk it from the resolved cb_arg root before applying the leaf
operation. With this, the recorder's per-arg `from = root_cdi`
substitution and the walker's lookup are end-to-end symmetric for
getAttr / getListElem / getString / etc.

Suite: 152 OK + 1 known red (= the cb-sibling-discrimination test
that still depends on task NixOS#87's apply-result feedback).

Assisted-by: Claude Code (Claude Opus 4.7)
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
- pathAndRootsFromSubject builds (PathExpr, fromCIDs[]) via a single
  depth-first traversal; sub-paths' Apply steps reference absolute
  indices in the combined roots list. Same-leaf occurrences (= shared
  cb_args) dedup by Subject equality so single-root applies still
  emit one fromCIDs entry.
- contentIdAt's DerivedSubject formula now hashes the multi-root
  encoding (fromCIDs[] in the JSON), so producer-child cdis are
  symmetric with the writer's flushed payloads.
- Writer flush emits fromCIDs[] conditionally (= only when >1
  root); ReplayLocalObject / AmbientObject probes go through
  stampPerArgFields(Ambient) helpers that mirror the same encoding.
- Walker's navigatePath takes a roots vector and uses Apply's
  fnRootIndex / argRootIndex to reach the right cb_arg per side.
  resolveProducerChild / dispatchAmbientQuery resolve fromCIDs[]
  (or fall back to single from) before navigating.

8 cb-* tests still fail at warm — sibling-discrimination test still
red because warm cache misses + falls back to parse. Needs more
investigation: the encoding round-trips but somehow the trie key
diverges between cold and warm.

Assisted-by: Claude Code (Claude Opus 4.7)
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
… encoding

Hit count went from 6 to 8 after multi-root apply-path landed.
Observations on apply-result descendants now produce depth-1 facts
with path = [Apply{fnPath, argPath}, GetAttr "..."] which the warm
walk dispatches and counts. Two extra hits = the apply-result's
getType + getInt traversal. Behavior change is intentional.

Assisted-by: Claude Code (Claude Opus 4.7)
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
…tion

Step 2/3 of the principle-3/5/7 work: the writer's d1 flush now
advances `d1CidasksWalk` by one edge per flush and substitutes each
fact's `from` at `edgeIndex = walk.size()` (= principles 3/5/7 —
per-edge cdi evolution across the whole session). At every logResult
we pre-insert one trie `Asks` edge per accumulated flush in the
current Q's namespace, so the trie's recorded chain has one Asks
edge per writer flush. When per-flush edges are present we skip the
whole-remaining shortcut so the walker is forced to walk per-flush
edges in sequence; each commit advances `ctx.edgeIndex` once,
matching the writer's evolution.

Side fix: pass `allRequestHashes` (= query hashes) to record()'s
slow path, not `seenRequests` (= fact hashes for XOR dedup). Without
the whole-remaining shortcut, record()'s slow path iterates that set
to build a remaining requestSet; an Asks edge's requestSet contains
*query* hashes, not fact hashes. Pre-existing name mismatch papered
over by the fast path.

cb-stats-higher-order-baseline hit count: 8 → 12 (= per-flush
dispatches sum higher per Q lookup).

Suite still 152/1. The cb-sibling-discrimination test now fails
differently: it falls back on a `getType from=a6fa3421...` whose
producer chain the walker can't fully resolve under the new edge
structure. The full discrimination needs walker-side cross-Q state
sharing (= persistent runningWalk as a fast-path on top of the
record-coherent edges, the user-asked-for "both" — extra path
quicker than from-scratch, but not the only way). Documented in
task NixOS#87.

Assisted-by: Claude Code (Claude Opus 4.7)
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
The per-flush mechanism caused a new failure mode in cb-sibling:
walker now reaches a Q whose terminal isn't in the trie because
env/file facts get interleaved between ambient flushes — record()
lumps the leftover (= env/file + later flush) requests into one
trailing Asks edge after the per-flush edges run out, breaking the
edge-by-edge cdi evolution alignment between writer and walker.

Reverting both the writer-side d1CidasksWalk evolution and the
trie-side per-flush Asks edge pre-insertion. The walker-side
edge-boundary callback infrastructure (`onEdgeAttempt` in
TracingDecisionGraph::walk, pendingEdgeFacts buffer in v13Walk)
stays — it's a clean addition that the future per-flush work needs.

Suite back to 152/1; only cb-sibling-discrimination red, with the
original "Got 200" failure mode (= sibling B reads sibling A's
cached LocalResponseMap entry).

Path forward (= when revisiting): bundle env/file facts into the
current flush's Asks edge so record() doesn't need a trailing
catchall edge, OR maintain a separate flush boundary per env/file
observation. Documented in task NixOS#87.

Assisted-by: Claude Code (Claude Opus 4.7)
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
Implements the per-Q boundary plan: AmbientQueries are depth-1
observations on outer state just like file reads (per user feedback),
so each logResult should emit ONE Asks edge in the trie containing
all facts (ambient + env/file) added to v13FactSet since the prior
logResult. Walker advances ctx.edgeIndex once per Asks edge, matching
writer's d1CidasksWalk 1:1.

- New `pendingNewRequests` accumulates every new query hash added to
  v13FactSet (via logResponse, noteEnvObservation, or flush).
- New `prevQFactSetHash` + `perQAsksEdges` retain finalized per-Q
  boundaries; logResult pre-inserts all in the current Q's namespace.
- Writer's `d1CidasksWalk` evolves per logResult: each ambient
  flush appends one edge whose fact `from`s substitute against
  contentIdAt(... edgeIndex = walk.size()).
- record() takes the slow path when perQAsksEdges has entries
  (= bypasses the whole-remaining shortcut so walker walks per-Q
  edges); passes `allRequestHashes` (query hashes), not
  `seenRequests` (fact hashes), to record()'s slow loop.
- cb-stats-higher-order-baseline hits 8 → 12 (= one Asks edge per
  Q's logResult, walker visits each).

cb-385 deep-indep test 4 regressed (= 151/2 now). Hypothesis: some
logResult has zero new facts (= duplicate queryHash with different
respHash dedupes by allRequestHashes), leaving a gap in the per-Q
chain that walker can't traverse. Documented in task NixOS#87 for the
next iteration.

Assisted-by: Claude Code (Claude Opus 4.7)
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
Task numbers (NixOS#86, NixOS#87, NixOS#91) were session-local tracker IDs, not
checked-in identifiers — the references dangled to nothing readable
from the tree.

"Deferred" framing across the design docs signals inertia and
demotivates future sessions picking up follow-up work. Replaced with
"next", "open", "follow-up", or a concrete future condition. Runtime
"defers to" usages (= TracingReplayObject.method dispatch) are
unchanged since they describe present behavior, not planned work.

Assisted-by: Claude Code (Claude Opus 4.7)
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
Assisted-by: Claude Code (Claude Opus 4.6-4.7)
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