@rackbops/ac-agent 2.0.0-alpha.50 → 2.0.0-alpha.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/ac-agent.mjs +14 -2
  2. package/package.json +1 -1
package/dist/ac-agent.mjs CHANGED
@@ -47,7 +47,7 @@ function _mergeNamespaces(n, m) {
47
47
  }
48
48
 
49
49
  var name = "@rackbops/ac-agent";
50
- var version = "2.0.0-alpha.50";
50
+ var version = "2.0.0-alpha.52";
51
51
  var type = "module";
52
52
  var description = "The per-machine host agent (installed with npx @rackbops/ac-agent): an HTTPS health server plus install/status/uninstall for a Windows logon task or a systemd user unit.";
53
53
  var bin = {
@@ -22412,7 +22412,8 @@ var index$3 = /*#__PURE__*/Object.freeze({
22412
22412
  * (`/run/user/<uid>/fnm_multishells/<pid>_<ts>/bin`) at the front of PATH -- `/run` is tmpfs,
22413
22413
  * torn down with the login session, so baking that verbatim produces a unit that works until the
22414
22414
  * next reboot and then can't find `node` at all. `bakePathEnv` swaps a recognized per-session
22415
- * segment for that manager's durable alias before the text is ever built.
22415
+ * segment for that manager's durable alias before the text is ever built, and drops what an npm/npx
22416
+ * run added for itself plus any relative segment (#677).
22416
22417
  *
22417
22418
  * **`ExecStart=`'s four values are quoted (#237)**: found unquoted during #47's own review --
22418
22419
  * `systemd.service(5)` "Command Lines" splits `ExecStart=` on unquoted whitespace the same way a
@@ -22428,6 +22429,12 @@ const FNM_MULTISHELL_RE = /\/run\/user\/\d+\/fnm_multishells\/[^:]*/;
22428
22429
  // A version-manager "current version" style segment (nvm-family layouts that keep a `current`
22429
22430
  // pointer rather than fnm's per-shell dir); swapped the same way, for the same reason.
22430
22431
  const NVM_CURRENT_RE = /\.nvm\/versions\/[^:]*\/current[^:]*/;
22432
+ /** What npm/npx prepend to a script's PATH (#677): every ancestor `node_modules/.bin` of the cwd
22433
+ * (`cd /tmp && npx ./ac-agent-<v>.tgz install` gives `/tmp/node_modules/.bin`, in a world-writable
22434
+ * directory), the npx cache's own `.bin`, and npm's `node-gyp-bin`. They belong to that one npm run;
22435
+ * baked into the unit they would put a stale cache -- or a binary any local user planted in `/tmp`
22436
+ * -- ahead of the real `git`/`gh`/`node` for the life of the service. */
22437
+ const NPM_RUN_SEGMENT_RE = /(?:^|\/)node_modules\/\.bin\/?$|\/_npx\/|\/node-gyp-bin\/?$/;
22431
22438
  function bakePathEnv(rawPath, options) {
22432
22439
  const fnmStable = `${options.homedir}/.local/share/fnm/aliases/default/bin`;
22433
22440
  const nvmStable = `${options.homedir}/.nvm/alias/default/bin`;
@@ -22436,6 +22443,11 @@ function bakePathEnv(rawPath, options) {
22436
22443
  for (const segment of rawPath.split(":")) {
22437
22444
  if (segment === "")
22438
22445
  continue;
22446
+ // A relative segment resolves against the service's cwd, not the installing shell's (#677).
22447
+ if (!segment.startsWith("/"))
22448
+ continue;
22449
+ if (NPM_RUN_SEGMENT_RE.test(segment))
22450
+ continue;
22439
22451
  let resolved = segment;
22440
22452
  if (FNM_MULTISHELL_RE.test(segment))
22441
22453
  resolved = fnmStable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rackbops/ac-agent",
3
- "version": "2.0.0-alpha.50",
3
+ "version": "2.0.0-alpha.52",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "The per-machine host agent (installed with npx @rackbops/ac-agent): an HTTPS health server plus install/status/uninstall for a Windows logon task or a systemd user unit.",