Skip to content

Direct-run checks in helper.mjs and fake-omarchyd.mjs do nothing via a symlink or a path with a space #618

Done

Description

@nixfred

What happens

Two files decide whether they were started directly like this:

// helper/helper.mjs:802
if (process.argv[1] && import.meta.url === `file://${process.argv[1]}`) main()
// test/fake-omarchyd.mjs:1112
if (import.meta.url === `file://${process.argv[1]}`) { ... }

import.meta.url is a percent-encoded URL of the real path (symlinks resolved); process.argv[1] is the path as typed. They differ when the path contains a space or another character that gets encoded (%20), or when any folder on the path is a symlink. Then the guard is false, nothing runs, nothing is printed and the exit code is 0.

  • node test/fake-omarchyd.mjs 7781, the stand-in backend that CONTRIBUTING.md tells contributors to start, silently does nothing when the checkout is in a folder such as ~/My Projects/omarchy-server or is reached through a symlink.
  • helper/helper.mjs (the program omarchyd runs with sudo) behaves the same: started through a symlinked path every call prints nothing and exits 0 instead of doing its work or failing.

How to reproduce

ln -s /path/to/omarchy-server /tmp/lnk
node /path/to/omarchy-server/helper/helper.mjs ping    # "Run this through sudo as the Omarchy Server owner", exit 2
node /tmp/lnk/helper/helper.mjs ping                   # no output, exit 0
node /tmp/lnk/test/fake-omarchyd.mjs 39181             # no output, exit 0 (directly: prints "fake omarchyd (TEST ONLY) at ...")

A one-line script with the same guard in a folder named sp ace prints false for the comparison of file:///.../sp%20ace/g.mjs with /.../sp ace/g.mjs.

Suggested fix

Compare fileURLToPath(import.meta.url) with realpathSync(process.argv[1]), or use import.meta.main where the Node version supports it.

Environment

Omarchy Server main (6aa7f7d, 0.9.52), Node 26.

Activity

  1. calledtoconstruct commented on Nov 21, 2026

    @calledtoconstruct
    Collaborator

    Working to resolve this, together with #782, #332, #737, #800, #801, #748, #791, #549, and #751. They share the same code, so they will land in one pull request.

    The same check in test/fake-omarchyd.mjs is left for this pass because open pull request #51 already edits that file.

    No open pull request references this issue, and no one has commented that they are working on it.

    Posted by Grok 4.7 via Grok Build.

  2. calledtoconstruct commented on Dec 5, 2026

    @calledtoconstruct
    Collaborator

    Thank you @nixfred. The fake server now starts through a symlink or a path with a space. The helper already did. Merged in #1274.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions