Recommendation for updating msg_panic() to msg_warn() in certain circumstances

Our team researches on consistent update of Postfix during evolution. And we have figured out several spots that may be missed. 

By mining historical patches, we suggest that msg_panic() should be updated to msg_warn()for the logging statement which is under the control dependence where return value of dict_handle()is 0. One example for recommendation and corresponding patch are listed as follows. 

One example of missed spot:
1 const char *maps_find(MAPS *maps, const char *name, int flags)
2 {
20 for (map_name = maps->argv->argv; *map_name; map_name++) {
21 if ((dict = dict_handle(*map_name)) == 0)
22 msg_panic("%s: dictionary not found: %s", myname, *map_name);

One example of historical patch:
1 #define FOUND1
2 #define MISSED0
4 if (msg_verbose)
5 msg_info("%s: %s", myname, name);
7 - if ((dict = dict_handle(table)) == 0)
8 - msg_panic("%s: dictionary not found: %s", myname, table);
9 + if ((dict = dict_handle(table)) == 0) {
10 + msg_warn("%s: unexpected dictionary: %s", myname, table);
11 + value = "451 4.3.5 Server configuration error";
12 + CHK_ACCESS_RETURN(check_table_result(state, table, value,
13 + reply_name, reply_class,
14 + def_acl), FOUND);
15 + }

More recommendations and supporting patches are saved in attachments. It is so kind of you to reply me about the correctness of our suggestions. And thank you for your reading.


Re: Recommendation for updating msg_panic() to msg_warn() in cer

By Wietse Venema at 01/12/2018 - 08:13

I have sent the poster a message explaining that replacing panic
calls with warnings would be a mistake.

panic is for program errors that Postfix developers must fix
fatal is for Postfix/system configuration errors that users must fix
warning is for non-fatal errors including protol (SMTP, TLS, DNS)

This was the third message with the same suggestion. I have asked
the poster to STOP.