Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Supply GNU ln to macOS Linux installer fixtures

rcourtman1591af6c1e54
diff --git a/.github/workflows/unified-agent-native.yml b/.github/workflows/unified-agent-native.yml
index ee3ce15c3e..3b7cf0d281 100644
--- a/.github/workflows/unified-agent-native.yml
+++ b/.github/workflows/unified-agent-native.yml
@@ -213,7 +213,8 @@ jobs:
run: go build -o pulse-agent-helper-native ./cmd/pulse-agent-helper
# Server/LXC fixtures execute Linux-only scripts, not a macOS installer.
- # Keep their Bash/GNU metadata, archive and rename semantics local to that step;
+ # Keep their Bash/GNU metadata, archive, rename and no-replacement link
+ # (DSM Upstart `ln -T`) semantics local to that step;
# native macOS agent/runtime tests still use the runner's own utilities.
- name: Supply Linux server installer fixture tools on macOS
if: runner.os == 'macOS'
@@ -227,7 +228,7 @@ jobs:
coreutils_bin="$(brew --prefix coreutils)/bin"
fixture_bin="$(mktemp -d "$RUNNER_TEMP/pulse-installer-fixture-tools.XXXXXX")"
ln -s "$linux_bash" "$fixture_bin/bash"
- for tool in stat chmod chown mv; do
+ for tool in stat chmod chown mv ln; do
executable="$coreutils_bin/g$tool"
test -x "$executable"
"$executable" --version | grep -q 'GNU coreutils'
diff --git a/scripts/installtests/native_installer_fixture_tools_test.go b/scripts/installtests/native_installer_fixture_tools_test.go
index 5f93de2e71..0161a758e1 100644
--- a/scripts/installtests/native_installer_fixture_tools_test.go
+++ b/scripts/installtests/native_installer_fixture_tools_test.go
@@ -52,7 +52,7 @@ func nativeInstallerFixtureSteps(t *testing.T) (nativeGuidanceStep, nativeGuidan
func TestNativeInstallerFixtureToolsAreRealAndStepLocal(t *testing.T) {
supply, installer := nativeInstallerFixtureSteps(t)
- for _, scenario := range []string{"real tools", "install failure", "missing bash", "legacy bash", "missing stat", "non-GNU chmod", "missing mv", "non-GNU mv", "missing tar", "non-GNU tar"} {
+ for _, scenario := range []string{"real tools", "install failure", "missing bash", "legacy bash", "missing stat", "non-GNU chmod", "missing mv", "non-GNU mv", "missing ln", "non-GNU ln", "missing tar", "non-GNU tar"} {
t.Run(scenario, func(t *testing.T) {
root := t.TempDir()
bin, prefix, tarPrefix, runnerTemp := filepath.Join(root, "bin"), filepath.Join(root, "brew with spaces"), filepath.Join(root, "gnu tar with spaces"), filepath.Join(root, "runner temp")
@@ -73,7 +73,7 @@ esac
if err := os.WriteFile(filepath.Join(bin, "brew"), []byte(brew), 0700); err != nil {
t.Fatal(err)
}
- tools := []string{"bash", "stat", "chmod", "chown", "mv", "tar"}
+ tools := []string{"bash", "stat", "chmod", "chown", "mv", "ln", "tar"}
installed := make(map[string]string)
for _, name := range tools {
leaf, toolPrefix := name, prefix
@@ -156,7 +156,7 @@ esac
}
entries, err := os.ReadDir(fixtureBin)
if err != nil || len(entries) != len(tools) {
- t.Fatal("fixture supply must select only Bash/stat/chmod/chown/mv/tar")
+ t.Fatal("fixture supply must select only Bash/stat/chmod/chown/mv/ln/tar")
}
for _, name := range tools {
if target, err := os.Readlink(filepath.Join(fixtureBin, name)); err != nil || target != installed[name] {
@@ -172,7 +172,7 @@ esac
set -eu
test "$*" = 'scripts/installtests/run_unix_contracts.py' || exit 91
test "$(command -v bash)" = "$PULSE_INSTALLER_FIXTURE_BIN/bash" || exit 92
-for tool in stat chmod chown mv tar; do
+for tool in stat chmod chown mv ln tar; do
test "$(command -v "$tool")" = "$PULSE_INSTALLER_FIXTURE_BIN/$tool" || exit 93
done
# Exercise the actual Linux-only flags with real executables and file bytes.
@@ -186,11 +186,28 @@ cp "$PROBE_ROOT/extracted/source" "$PROBE_ROOT/staged"
mv -T "$PROBE_ROOT/staged" "$PROBE_ROOT/published"
cmp "$PROBE_ROOT/source" "$PROBE_ROOT/published"
test ! -e "$PROBE_ROOT/staged"
+# DSM Upstart removal links its manual override and restores retired config
+# with GNU ln -T: a hard link that never replaces or descends into a target.
+links="$PROBE_ROOT/links"
+rm -rf "$links"
+mkdir "$links" "$links/occupied-directory"
+ln -T -- "$PROBE_ROOT/published" "$links/linked"
+cmp "$PROBE_ROOT/source" "$links/linked"
+printf 'concurrent\n' > "$links/occupied"
+if ln -T -- "$PROBE_ROOT/published" "$links/occupied" 2>/dev/null; then exit 94; fi
+test "$(cat "$links/occupied")" = concurrent
+if ln -T -- "$PROBE_ROOT/published" "$links/occupied-directory" 2>/dev/null; then exit 95; fi
+test ! -e "$links/occupied-directory/published"
exit "${SUITE_EXIT:-0}"
`
if err := os.WriteFile(filepath.Join(bin, "python3"), []byte(probe), 0700); err != nil {
t.Fatal(err)
}
+ // The supply step itself links with the native ln; only the installer
+ // step must resolve the supplied GNU ln ahead of a native one.
+ if err := os.WriteFile(filepath.Join(bin, "ln"), []byte("#!/bin/sh\nprintf 'native BSD utility reached\\n' >&2\nexit 64\n"), 0700); err != nil {
+ t.Fatal(err)
+ }
for _, code := range []string{"0", "23"} {
cmd := exec.CommandContext(ctx, "bash", "-c", installer.Run)
cmd.Env = append(env, "PULSE_INSTALLER_FIXTURE_BIN="+fixtureBin, "PROBE_ROOT="+root, "SUITE_EXIT="+code)