[Samba] Validity of "testparm --parameter-name" output on a non-zero exit code

Slava Aseev nullptrnine at basealt.ru
Mon Jul 18 12:14:47 UTC 2022


Hello!

I have a question about testparm (maybe a stupid question).

testparm exits with 1 if any errors in smb.conf was detected.
Can this exit code be safely ignored if only the output of "testparm 
--parameter-name" is needed?

For example, in case of "testparm --suppress-prompt --parameter-name 
'usershare path'" we can check path from the output for existence, so 
checking the exit code doesn't seem so useful. However, I am not 
entirely sure about this, maybe there is something what I missed.

The whole problem is that there is a real case where I would like to 
ignore the exit code:

   $ testparm --debuglevel=0 --suppress-prompt --verbose --parameter-name 'usershare path'
   Load smb config files from /etc/samba/smb.conf
   Loaded services file OK.
   Weak crypto is allowed

   ERROR: Do not use the 'sss' backend as the default idmap backend!

   /var/lib/samba/usershares

   $ echo $?
   1

but I'm not sure if I really should.

-- 
Best regards,
Slava Aseev




More information about the samba mailing list