[PATCH] nmb/smb.service.in: Silence empty N/SMBDOPTIONS warnings

Joakim Roubert joakim.roubert at gmail.com
Tue Dec 12 21:23:16 UTC 2023


Unset/empty NMBDOPTIONS and SMBDOPTIONS triggers the syslog warnings

nmbd.service: Referenced but unset environment variable evaluates to
an empty string: NMBDOPTIONS
smbd.service: Referenced but unset environment variable evaluates to
an empty string: SMBDOPTIONS

Setting the replace-with-nothing-if-not-set substitutions
${NMBDOPTIONS:-} and ${SMBDOPTIONS:-} in the service files rather than
using $NMBDOPTIONS and $SMBDOPTIONS mitigates this and shows this is
what we want and not something that was missed (which the warning is
all about).

Signed-off-by: Joakim Roubert <joakim.roubert at gmail.com>
---
  packaging/systemd/nmb.service.in | 2 +-
  packaging/systemd/smb.service.in | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/packaging/systemd/nmb.service.in 
b/packaging/systemd/nmb.service.in
index ceeeea408ec..2c53558d98c 100644
--- a/packaging/systemd/nmb.service.in
+++ b/packaging/systemd/nmb.service.in
@@ -8,7 +8,7 @@ After=network.target network-online.target
  Type=notify
  PIDFile=@PIDDIR@/nmbd.pid
  EnvironmentFile=- at SYSCONFDIR@/sysconfig/samba
-ExecStart=@SBINDIR@/nmbd --foreground --no-process-group $NMBDOPTIONS
+ExecStart=@SBINDIR@/nmbd --foreground --no-process-group ${NMBDOPTIONS:-}
  ExecReload=/bin/kill -HUP $MAINPID
  LimitCORE=infinity
  @systemd_nmb_extra@
diff --git a/packaging/systemd/smb.service.in 
b/packaging/systemd/smb.service.in
index 64c77c01502..3526339f24d 100644
--- a/packaging/systemd/smb.service.in
+++ b/packaging/systemd/smb.service.in
@@ -9,7 +9,7 @@ Type=notify
  PIDFile=@PIDDIR@/smbd.pid
  LimitNOFILE=16384
  EnvironmentFile=- at SYSCONFDIR@/sysconfig/samba
-ExecStart=@SBINDIR@/smbd --foreground --no-process-group $SMBDOPTIONS
+ExecStart=@SBINDIR@/smbd --foreground --no-process-group ${SMBDOPTIONS:-}
  ExecReload=/bin/kill -HUP $MAINPID
  LimitCORE=infinity
  @systemd_smb_extra@
-- 
2.43.0




More information about the samba-technical mailing list