Bug 222122 - mail/opendkim rc script needs default for $milteropendkim_socket
Summary: mail/opendkim rc script needs default for $milteropendkim_socket
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Chris Rees
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-07 11:34 UTC by Thomas Steen Rasmussen / Tykling
Modified: 2022-01-08 13:13 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (freebsd-ports)


Attachments
quote possible empty strings (1.26 KB, patch)
2017-12-20 09:14 UTC, Matthias Pfaller
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Steen Rasmussen / Tykling 2017-09-07 11:34:56 UTC
Since ports r448274 the rc.d script for milter-opendkim outputs an error when I do not have $milteropendkim_socket set in rc.conf but have it set in the config file. The latest change to the rc.d script appears to assume that $milteropendkim_socket is always set.

I think a default is needed or the test in line 77 needs to check if anything is in the $milteropendkim_socket variable. test(1) returns true (exit code 0) when given no args.

Below is the output from starting milter-opendkim without setting $milteropendkim_socket in rc.conf with rc_debug enabled:

[tsr@smtp2 ~]$ sudo service milter-opendkim start
/usr/local/etc/rc.d/milter-opendkim: DEBUG: pid file (/var/run/milteropendkim/pid): not readable.
/usr/local/etc/rc.d/milter-opendkim: DEBUG: checkyesno: milteropendkim_enable is set to yes.
/usr/local/etc/rc.d/milter-opendkim: DEBUG: run_rc_command: start_precmd: dkim_prepcmd 
Starting milteropendkim.
/usr/local/etc/rc.d/milter-opendkim: DEBUG: run_rc_command: doit:  limits -C daemon /usr/local/sbin/opendkim  -l   -u postfix:mailnull -P /var/run/milteropendkim/pid -x /usr/local/etc/opendkim.conf    
/usr/local/etc/rc.d/milter-opendkim: DEBUG: run_rc_command: start_postcmd: dkim_start_postcmd 
usage: chmod [-fhv] [-R [-H | -L | -P]] mode file ...
[tsr@smtp2 ~]$ 

Below is the output from starting milter-opendkim with $milteropendkim_socket set in rc.conf with rc_debug enabled:

[tsr@smtp2 ~]$ sudo service milter-opendkim start
/usr/local/etc/rc.d/milter-opendkim: DEBUG: pid file (/var/run/milteropendkim/pid): not readable.
/usr/local/etc/rc.d/milter-opendkim: DEBUG: checkyesno: milteropendkim_enable is set to yes.
/usr/local/etc/rc.d/milter-opendkim: DEBUG: run_rc_command: start_precmd: dkim_prepcmd 
Starting milteropendkim.
/usr/local/etc/rc.d/milter-opendkim: DEBUG: run_rc_command: doit:  limits -C daemon /usr/local/sbin/opendkim  -l -p local:/var/spool/postfix/opendkim/opendkim.sock -u postfix:mailnull -P /var/run/milteropendkim/pid -x /usr/local/etc/opendkim.conf    
/usr/local/etc/rc.d/milter-opendkim: DEBUG: run_rc_command: start_postcmd: dkim_start_postcmd 
[tsr@smtp2 ~]$
Comment 1 Matthias Pfaller 2017-12-20 09:14:05 UTC
Created attachment 188987 [details]
quote possible empty strings
Comment 2 Chris Rees freebsd_committer freebsd_triage 2022-01-08 13:12:50 UTC
Committed patch, thanks!
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-01-08 13:13:21 UTC
A commit in branch main references this bug:

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

commit d5d57b5a024f884392cf7358279dfd2f623abbe2
Author:     Chris Rees <crees@FreeBSD.org>
AuthorDate: 2022-01-08 13:07:55 +0000
Commit:     Chris Rees <crees@FreeBSD.org>
CommitDate: 2022-01-08 13:07:55 +0000

    mail/opendkim: Fix errors when no value is set for socket in RC script

    Fix errors

    PR:             ports/222122
    Submitted by:   Matthias Pfaller <matthias.pfaller@familie-pfaller.de>
                            (Fix)

    While here, various style fixes; no need for the "x$var" != "x" idiom
    as that is confusing to follow.

    Approved by:    maintainer timeout (3 years)

 mail/opendkim/Makefile                 |  2 +-
 mail/opendkim/files/milter-opendkim.in | 60 +++++++++++++++++-----------------
 2 files changed, 31 insertions(+), 31 deletions(-)