ergochat / ergo

A modern IRC server (daemon/ircd) written in Go.
https://ergo.chat/
MIT License
2.2k stars 175 forks source link

log errors from removing unix domain paths? #2141

Closed slingamn closed 1 month ago

slingamn commented 3 months ago

We got a bug report in #ergo like so:

  1. Ergo was accidentally run as root
  2. This created a root-owned unix domain socket path corresponding to one of the listeners
  3. Starting Ergo again as the unprivileged role user, os.Remove failed silently: https://github.com/ergochat/ergo/blob/1f4b5248a0bdd683ba0eb81785668088b1564352/irc/listeners.go#L50
  4. The server then failed to start with: Apr 03 13:02:20 hostname start.sh[1545]: 2024-04-03T13:02:20.983Z : error : server : Could not load server: listen unix /tmp/ergo_websocket: bind: address already in use
  5. Head scratching ensued

We don't want to log the error unconditionally since the file not existing is not an error, but we could maybe do a better job here