Place the view's command as one file in /usr/local/bin, not the directory mesh-cli declares (issue 1134)
mesh/merge-gate head 8a8cafd3db98 merged into trunk 0177ea7a7914 — pass: builds new: modules/mesh-delivery-view, sent nowhere; no bus step; every machine c…
mesh/repo-check head 8a8cafd3db98 merged into trunk 0177ea7a7914 — pass: its merge-check.sh passed
mesh/delivery delivered

This commit is contained in:
2026-10-19 00:09:54 +02:00
parent 0177ea7a79
commit 8a8cafd3db
3 changed files with 40 additions and 4 deletions
@@ -0,0 +1,4 @@
#!/bin/sh
# The operator's command (module mesh-delivery-view, novox/hq ADR 0429 §3), written by the mesh. It is a file of its own in
# /usr/local/bin, which mesh-cli declares whole; the program lives in the view's own directory.
exec /usr/local/lib/mesh-delivery-view/mesh-delivery-cli "$@"
+27 -2
View File
@@ -163,8 +163,8 @@ func TestManifestResources(t *testing.T) { // 1134/AC7
t.Errorf("state directory 0700 owned by the user: %v; run directory for the socket 0755: %v", state, run)
}
a := byType["archive"][0]
if a["artifact"] != "cli" || a["path"] != "/usr/local/bin" {
t.Errorf("archive = %v, want the cli unpacked into /usr/local/bin", a)
if a["artifact"] != "cli" || a["path"] != "/usr/local/lib/mesh-delivery-view" {
t.Errorf("archive = %v, want the cli unpacked into its own directory", a)
}
}
@@ -195,3 +195,28 @@ func TestAliasItem(t *testing.T) { // 1137/AC1
t.Fatalf("files/zsh-normal = %q, want the one line", raw)
}
}
// The controller refuses two modules declaring one path (internal/catalogue/resolve.go:1160-1168). mesh-cli (mesh-catalog
// modules/mesh-cli/module.json) declares /usr/local/bin whole, so this module may place only a file below a shared
// directory, never the directory itself.
func TestNoSharedDirectoryIsClaimed(t *testing.T) { // 1134/AC7
m, _ := load(t)
shared := map[string]bool{"/usr/local/bin": true, "/usr/local/lib": true, "/usr/bin": true, "/usr/local": true, "/usr/lib": true, "/etc": true, "/opt": true}
var binary bool
for _, r := range m.Resources {
p, _ := r["path"].(string)
if shared[strings.TrimRight(p, "/")] {
t.Errorf("resource %v declares the shared directory %s, which mesh-cli and others declare too", r["id"], p)
}
if p == "/usr/local/bin/mesh-delivery-cli" && r["type"] == "file" && r["template"] == "files/mesh-delivery-cli" {
binary = true
}
}
if !binary {
t.Error("the command is placed as the file /usr/local/bin/mesh-delivery-cli")
}
raw, err := os.ReadFile("files/mesh-delivery-cli")
if err != nil || !strings.Contains(string(raw), "exec /usr/local/lib/mesh-delivery-view/mesh-delivery-cli") {
t.Errorf("files/mesh-delivery-cli = %q, %v", raw, err)
}
}
+9 -2
View File
@@ -53,11 +53,18 @@
}
},
{
"id": "command",
"id": "command-program",
"type": "archive",
"artifact": "cli",
"path": "/usr/local/bin",
"path": "/usr/local/lib/mesh-delivery-view",
"unknown": "program"
},
{
"id": "command",
"type": "file",
"path": "/usr/local/bin/mesh-delivery-cli",
"mode": "0755",
"template": "files/mesh-delivery-cli"
}
],
"items": [