Bug 254254 - net/mosquitto 2.0.8 service fails to start
Summary: net/mosquitto 2.0.8 service fails to start
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Craig Leres
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-13 11:52 UTC by Jürgen Weber
Modified: 2021-08-08 16:59 UTC (History)
6 users (show)

See Also:
joe: maintainer-feedback+


Attachments
patch (1.07 KB, patch)
2021-03-14 00:28 UTC, Brad Davis
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jürgen Weber 2021-03-13 11:52:25 UTC
Recently mosquitto was updated to 2.0

mosquitto 2.0.8 service fails to start.

I got it to work with these changes:

/usr/local/etc/rc.d/mosquitto

grep pid_file

(there is an underline in the conf entry)

in the conf added a sub dir for pid:
(https://github.com/eclipse/mosquitto/issues/1950)

pid_file /var/run/mosquitto/mosquitto.pid

created it:

mkdir /var/run/mosquitto
chown nobody:wheel /var/run/mosquitto
Comment 1 Brad Davis freebsd_committer freebsd_triage 2021-03-14 00:28:48 UTC
Created attachment 223245 [details]
patch

Update the rc script.
Comment 2 Steve Wills freebsd_committer freebsd_triage 2021-03-25 14:28:48 UTC
Using grep to find the pidfile in the config file breaks if there is a comment in the config file that references the pidfile. This is why we typically lean towards not calling grep or trying to parse config files, but instead setting the pidfile to the default value in the rc script and having the user change it via rc.conf instead if it's a non-default value. I think it would be better to have:

pidfile=${mosquitto_pidfile:-"/var/run/mosquitto.pid"}
Comment 3 Jürgen Weber 2021-03-25 15:54:20 UTC
> Using grep to find the pidfile in the config file breaks ..

Or if you keep the original line commented out like I did 8-)
Comment 4 Emanuele 2021-04-26 20:41:46 UTC
Will the package receive an update in order to solve this issue?
Comment 5 Craig Leres freebsd_committer freebsd_triage 2021-07-24 20:35:28 UTC
@swills, would you be ok with something like this?

    pidfile=$(egrep ^pid_file ${mosquitto_config} | awk '{print($2)}')
    pidfile=${pidfile:=/var/run/mosquitto.pid}
Comment 6 commit-hook freebsd_committer freebsd_triage 2021-08-08 16:59:01 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=baa26eb67c4d0d6406a190dec9214520a53c02e1

commit baa26eb67c4d0d6406a190dec9214520a53c02e1
Author:     Brad Davis <brd@FreeBSD.org>
AuthorDate: 2021-08-08 16:55:44 +0000
Commit:     Brad Davis <brd@FreeBSD.org>
CommitDate: 2021-08-08 16:55:44 +0000

    net/mosquitto: Fix startup pidfile issue

    PR:             254254
    Reviewed by:    swills
    Approved by:    joe@thrallingpenguin.com (maintainer, earlier version)

 net/mosquitto/Makefile           | 1 +
 net/mosquitto/files/mosquitto.in | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)