← Back to Pull requests

Let the guest make hard links in a volume #3

Closed
unknown closed this pull request without merging on Nov 27, 2026 18:50 UTC
View on GitHub
unknown unknown commented on Nov 27, 2026 05:19 UTC
Author

A guest could not make a hard link in a volume. ln failed with EPERM, and so did every package manager that puts a file in place with a link. With UV_CACHE_DIR on a volume, uv sync stops with:

error: Could not acquire lock
  cause: Could not persist temporary file `/cache/.tmpXXXX`
  cause: Operation not permitted (os error 1)

Change

  • rootfs.DirTree gets Hardlink(target, path), served as the POST operation hardlink (p the new name, t the existing file).

  • os.Root.Link keeps both names inside the volume. I checked that it refuses .. and a symlinked parent on either side. A symlink as the last component is linked as itself, not followed (linkat with flags 0).

  • A read-only volume answers EROFS, as for every other change.

  • volumeFs passes the SDK's link(target, path) on to the new operation.

  • failWith now names EXDEV and EMLINK. A tool that copies when it cannot link needs to tell those apart from EIO.
  • This needs pithings/unkernel#46, which makes the SDK's 9p server call Fs.link for Tlink (it answered EPERM always). Until the pinned unkernel in nix/unkernel.nix has that change, this PR changes nothing the guest can see.

    Tests

  • internal/rootfs, TestHardlink:

  • - a second name for one file (os.SameFile, link count 2)
    - EEXIST when the name is taken
    - a directory refused
    - through the handler
    - a link to a file outside the volume refused
    - 403 on a read-only tree
  • go test ./internal/... passes.
  • End to end

    I applied unkernel#46's Tlink to the share's SDK bundle by hand and used this branch's go build:

  • ln /s/a /s/b in a volume gives one inode on the host (2 links). A second ln says "File exists". The release binary says "Operation not permitted".

  • uv sync with UV_CACHE_DIR on a volume works and fills the cache. The release binary fails as above.
  • Not run: nix flake check (no nix on this machine).

    🤖 Generated with Claude Code

    Diff: 247 lines (+185 / -62) across 3 files Reviewer: fzakaria Review duration: 811m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.39) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 247 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.330
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 38.9% (MEDIUM) · Higher = larger blast radius
    38.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.8% · Safe to merge
    16.8%
    Repository