What is the difference between "dnl" and "dnl #" in a sendmail.mc file?

Mike B asked:

What is the difference between dnl and dnl # in a /etc/mail/sendmail.mc file? If I want to enable something what needs to be in front? Likewise, if I want to “comment out” something, what prefix do I need?

For example:

dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well
dnl #
dnl FEATURE(masquerade_entire_domain)dnl
dnl #
dnl MASQUERADE_DOMAIN(localhost)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl
dnl MASQUERADE_DOMAIN(foo.com)dnl
dnl MASQUERADE_DOMAIN(foo2.lan)dnl
dnl MAILER(cyrusv2)dnl

My answer:

There’s a subtle but important difference between dnl and # here.

dnl means “delete through newline”. When you process your sendmail.mc into a sendmail.cf using m4 (or possibly some frontend), the characters dnl and everything following them, including the next newline, will be dropped. (And all of those lines end with dnl to suppress extra blank lines in the sendmail.cf output.)

Nothing beginning with dnl through end of line will make it out of sendmail.mc and into sendmail.cf.

Anything that remains in the output, of course, will either be sendmail configuration, or a comment that begins with #, which will be copied as-is into sendmail.cf, where they will be ignored.

Anything beginning with # and not deleted above will make it into sendmail.cf unmolested as a comment.

In your example, someone meant for all of the commented features to be removed from sendmail.cf, as well as the comments, since the comments would be meaningless without the features present.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.