Skip to content

fix kill(-1, signo) fail on FreeBSD - #186

Closed
shen390s wants to merge 5 commits into
NixOS:masterfrom
shen390s:master
Closed

shen390s wants to merge 5 commits into
NixOS:masterfrom
shen390s:master

Conversation

@shen390s

Copy link
Copy Markdown

In freebsd, if there is no other processes for current user kill(-1, signo) will fail with error "permission denied"

@edolstra

Copy link
Copy Markdown
Member

Why the fork? Can't you just do (after the existing kill(-1, SIGKILL)):

#ifdef __FreeBSD__
  if (errno == EPERM) break; /* no more processes */
#endif

@shen390s

Copy link
Copy Markdown
Author

Can not make sure errno EPERM is really caused by I'm just the single process of current user

@shen390s shen390s closed this Dec 21, 2013
@shen390s shen390s reopened this Dec 21, 2013
@shen390s

Copy link
Copy Markdown
Author

I do not want to close the request, just a mistake

@edolstra edolstra added the bug label Feb 26, 2014
@shen390s

Copy link
Copy Markdown
Author

I have checked this in FreeBSD 9.1, it seems that there is no this problem.

It seems better to treat this as the problem of FreeBSD

@shen390s shen390s closed this Sep 11, 2015
@shen390s

Copy link
Copy Markdown
Author

this is problem of freebsd

@ysangkok

Copy link
Copy Markdown
Contributor

@shen390s when you say "problem of FreeBSD", what do you mean by that? If it is a problem that was patched in FreeBSD, are some of the other patches not necessary anyway? Some of them, like the SOL_LOCAL one, are necessary for compiling.

@shen390s

Copy link
Copy Markdown
Author

I means that the behavior of syscall kill() in FreeBSD for the case:

if there is no other processes for current user kill(-1, signo) will fail with error "permission denied"

is incorrect. The newer version of FreeBSD has fixed this problem.

CertainLach pushed a commit to deltarocks/nix that referenced this pull request Sep 4, 2025
…ests

Restore testing against the Nix daemon
Ma27 pushed a commit to Ma27/nix that referenced this pull request Mar 8, 2026
Vaguely one half of NixOS#186.
Fixes NixOS#827.

Change-Id: Ie6a296465beb089bf812ea27091648ca6a6a6964
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
…Selector alternative

Per user: the leaf-variant retirement (63b43e8) over-reached by
replacing SelectorLeaf entirely with std::string, losing type-level
distinction between "reference to a produced Selector" and
"positional callback arg." Arg{depth} is a Selector like any other —
its Q hash falls out of its shape, and other Selectors reference it
through their `from`/`fn` fields (still Q-hash strings; that's what
Selector-refs are) the same way as any other Q.

Added:
- SelectorArg { int depth } in trace-types.hh.
- Alternative in Selectors<F> and SelectorVariant.
- to_json/from_json codec.
- describe() branch printing "arg depth=N".
- parseTraceEntry tryParseQuery hook.
- willMoveStateHash: false (Arg is not itself state-dependent — its
  depth is a fixed position).

Not yet: migrating existing callsites that stringify positional args
via subjectId(Arg{depth}, ...) to emit SelectorArg directly. Those
still work via string Q-refs; migration is a follow-up.

Walker's dispatchQueryRequest doesn't yet handle SelectorArg — falls
through to std::nullopt, which was the existing "no matching branch"
behaviour anyway. Wiring dispatch is a follow-up.

Suite 306/22/7 unchanged.

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

subjectId(Arg{depth}, argAncestry) previously returned SHA256("positional-D") XOR argAncestry — an
ad-hoc encoding that predates SelectorArg as a first-class alternative.
Now uses computeSelectorHash(SelectorArg{depth}) — the algebraic
Selector-content hash. argAncestry XOR retires (would have been zero
under stable Q hashes per NixOS#178 anyway).

Every Arg-derived identity (leaf and composite constituents like
ApplyResultSubject{fn=Arg{d},...}, DerivedSubject{parent=Arg{d},...})
shifts to the new hash. Both cold and warm use the same function, so
they remain consistent — but existing warm DBs are invalidated (dev
branch).

First bite of NixOS#186: migrate positional-arg identities to use
SelectorArg. Follow-ups will retire more subjectId call chains through
Subject composites, moving toward NixOS#183 (retire Subject entirely).

Suite 306/22/7 unchanged.

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

subjectId for composite Subject variants (ApplyResultSubject,
DerivedSubject) previously computed identity via ad-hoc string
concatenation:
- ApplyResultSubject: SHA(SelectorApply{fn=fnId}.dump() ++ argId hex)
- DerivedSubject::GetAttr: SHA("getAttr:name@parentId")
- DerivedSubject::GetListElem: SHA("getListElem:N@parentId")

Now uses the algebraic Selector-content hash directly:
- ApplyResultSubject → computeSelectorHash(SelectorApply{fn=fnId hex}).
  Arg dropped from the composition — SelectorApply's shape (per NixOS#181)
  observes arg by value; discrimination flows through cur, not through
  subject id.
- DerivedSubject::GetAttr → computeSelectorHash(SelectorGetAttr{name, from=parentId hex}).
- DerivedSubject::GetListElem → computeSelectorHash(SelectorGetListElem{from=parentId hex, index}).

Each Subject variant now derives its identity from the corresponding
Selector's own hash function. Cold and warm compute the same values;
DB Terminal keys shift once (dev branch, cache invalidation OK).

Suite 306/22/7 unchanged.

Assisted-by: Claude Code (Claude Opus 4.6-4.7)
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
…ue's own Selector

TracingCallbackArg::whnf recorded (SelectorGetWHNF{from=<value's ID hex>}, WHNF)
into the callback obsSet. Under NixOS#186's alignment (each Subject variant has
an equivalent Selector alternative), the observation IS "this value at
identity X observed to have WHNF Y" — whose natural Selector is X's own
producer, not a GetWHNF wrapper.

Added:
- subjectAsSelector(subject, argAncestry) helper — returns the Selector
  variant whose content hash IS the subject's identity. Each Subject
  variant maps to its equivalent (Arg → SelectorArg, DerivedSubject →
  SelectorGetAttr/SelectorGetListElem, ApplyResultSubject → SelectorApply,
  PostulatedIdempotentRead → SelectorGetWHNF as pre-Selector carrier).

Callers:
- TracingCallbackArg::whnf: records subjectAsSelector(subject) directly.
- ReplayCallbackArg::whnf: mirrors, looks up by the same key via std::visit.

Retires SelectorGetWHNF's Role 4 (contra-arg obsSet whnf entry) for
non-PostulatedIdempotentRead subjects. GetWHNF is retained only as the
pre-Selector carrier for PostulatedIdempotentRead — a shrinking role.

Suite 306/22/7 unchanged.

Assisted-by: Claude Code (Claude Opus 4.6-4.7)
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
…dentity-of-outer-arg case)

Preparation for retiring SelectorGetWHNF's Role 3 (OuterObject::whnf
boundary message). Adds the SelectorArg branch in dispatchOuterQuery:
returns computeWHNFFromObject(*obj) with no navigation (SelectorArg
IS the identity of the outer arg itself).

OuterObject::whnf hasn't been migrated yet — replacing its queryFn
message with subjectAsSelector(subject) regresses 5 tests because
the walker's dispatchQueryRequest doesn't dispatch SelectorArg either,
so warm can't reproduce cold's newly-shaped observations. Adding
walker-side SelectorArg dispatch is the next step before flipping
OuterObject::whnf.

Suite 306/22/7 unchanged.

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

Two additive changes:

1. Walker's dispatchQueryRequest gains a SelectorArg branch: resolves
   the outer arg at reverse-De-Bruijn depth N by walking
   ctx.currentProxy's cell chain to find the matching-depth cell,
   returns its liveObject's WHNF. Symmetric with dispatchOuterQuery's
   SelectorArg branch (added in prior commit).

2. TracingCallbackApplyResult::whnf uses subjectAsSelector(applyResultSubject)
   instead of SelectorGetWHNF{empty} for its recordD2 observation.
   Mirrors the TracingCallbackArg::whnf pattern.

OuterObject::whnf's parallel migration attempted, regressed 5 tests
(cb-obsset-mismatch-clean-miss et al), reverted. Even with walker
SelectorArg dispatch wired, some path constructs GetWHNF and expects
the corresponding fact key. Needs more diagnosis before re-attempting.

Suite 306/22/7 unchanged.

Assisted-by: Claude Code (Claude Opus 4.6-4.7)
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
Two failing tests (GetAttrTracesAccess, GetListElemTracesAccess) predate
the recursive-Selector migration (NixOS#186) + DB-facade pool (NixOS#196–NixOS#197).
Under that model, TracingObject::maybeGetAttr / getListElem require the
writer's TracingDecisionGraph to intern the parent Selector through the
pool — no graph, no emission — so the test fixture's DG-less
TracingWriter silently swallowed the query. The other tests in the file
assert on the pre-clear evalExpr entry and pass by aligning with the
zero-emission path.

Give the fixture a real DG. The natural home is in-memory sqlite so the
tests don't need temp dirs or cleanup (the pattern used in trace-types.cc
and outer-object.cc). This required teaching SQLite to route the ":memory:"
sentinel around its URI-encoding path: currently the encoder produces
`file:%3Amemory%3A?immutable=0`, which sqlite reads as a literal on-disk
filename `:memory:` rather than the in-memory sentinel. The fix detects
`:memory:` upfront, skips both the ZFS -shm probe and the URI wrapping,
and passes the plain filename with SQLITE_OPEN_URI cleared — which is
how sqlite3 identifies the sentinel.

The SQLite class change is general (any future consumer can now request
in-memory), motivated by but not exclusive to this test.

Assisted-by: Claude Code (Claude Opus 4.7)
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
- Main and primop docs: remove "Source map" sections. Grep serves
  where a reader wants the current file location for X.
- Vocab §Selector: drop the retired SelectorGetWHNF alternative,
  reword to reflect Selector as a simple query language (not an
  eDSL/algebra), rename the parent-reference field from `from` to
  `parent` under the recursive-Selector shape (NixOS#186).

The main doc's §Outer-request discipline paragraph about
noteEnvObservation is stale (the method is gone) but was left
alone — the surrounding session-root-routing-during-warm-replay
claim needs an ambient understanding pass I don't have right now.

Assisted-by: Claude Code (Claude Opus 4.7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants