Skip to content

Automatic hosts sync fails silently when /etc/hosts is not writable #364

Description

@Railly

The automatic hosts sync that runs on route registration ignores the result of syncHostsFile, which swallows the write error. The manual portless hosts sync command reports failure; the automatic path prints nothing.

So an unprivileged run registers a route, skips the hosts block, and stays quiet. On resolvers that do not handle multi-label .localhost (macOS, see #23), the app then fails server-side with ENOTFOUND and nothing points at the skipped sync. portless doctor catches it, but only if you think to run it.

Repro:

  1. portless proxy start --port 1355 --https (unprivileged).
  2. portless myapp <cmd>. The route registers, /etc/hosts stays unchanged, nothing is printed.
  3. portless doctor warns. Registration time is where the signal belongs.

A one-line warning when the sync cannot write would cover it: hosts sync skipped: /etc/hosts not writable. Run: sudo portless hosts sync.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions