Bug 280284 - net-mgmt/net-snmp: conffile hardcoded in rc script
Summary: net-mgmt/net-snmp: conffile hardcoded in rc script
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: Ryan Steinmetz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-14 22:35 UTC by gebhart
Modified: 2024-07-19 18:06 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (zi)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gebhart 2024-07-14 22:35:39 UTC
some weeks ago a change appeared in the port, that spits out this warning at startup:
/usr/local/etc/rc.d/snmpd: WARNING: snmpd configuration file /usr/local/share/snmp/snmpd.conf not found

Of course there is no such file, because my snmpd.conf is in /usr/local/etc/ where it should be and is correctly configured in rc.conf.
However there's one hardcoded check for the file above, which triggers the warning.
I guess, that line should simply be removed in the rc script because the following
lines do the check anyway with $snmpd_conffile instead of the hardcoded path.
The line number is 80 and looks like this:

check_conffile /usr/local/share/snmp/snmpd.conf
Comment 1 Ryan Steinmetz freebsd_committer freebsd_triage 2024-07-14 23:14:19 UTC
Can you confirm that commenting that line resolves your issue?
Comment 2 gebhart 2024-07-19 13:36:27 UTC
Yes, of course I can confirm. It works without warning, when that line is removed.
There shouldn't be any hardcoded paths in there anyway.
Comment 3 Mark Johnston freebsd_committer freebsd_triage 2024-07-19 17:54:25 UTC
(In reply to gebhart from comment #2)
It's hard-coded that way because snmpd will still try to read it even if -c is specified.  Though, this is false if -C is also specified.  Are you setting that?  In any case, I agree that the script should not emit a warning if the default config file doesn't exist, as snmpd will keep going in that case.
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-07-19 18:05:30 UTC
A commit in branch main references this bug:

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

commit 9364edfdf092ee1edc0401518e89d0340ef535ca
Author:     Ryan Steinmetz <zi@FreeBSD.org>
AuthorDate: 2024-07-19 18:03:04 +0000
Commit:     Ryan Steinmetz <zi@FreeBSD.org>
CommitDate: 2024-07-19 18:04:28 +0000

    net-mgmt/net-snmp: Fix scenario where a user does not have a config in the default location

    PR:             280284
    Reported by:    gebhart@secnetix.de

 net-mgmt/net-snmp/Makefile       | 2 +-
 net-mgmt/net-snmp/files/snmpd.in | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
Comment 5 Ryan Steinmetz freebsd_committer freebsd_triage 2024-07-19 18:06:30 UTC
Fixed.