Sort the list of possible plugins before printing it.

This gives more reproducible error messages for the tests.
This commit is contained in:
Todd C. Miller
2020-04-07 14:03:58 -06:00
parent 02a117f336
commit 8a2c0d784f
2 changed files with 4 additions and 1 deletions

View File

@@ -453,6 +453,9 @@ _python_plugin_get_class(const char *plugin_path, PyObject *py_module, const cha
py_sudo_log(SUDO_CONV_ERROR_MSG, "No plugin class is specified for python module '%s'. " py_sudo_log(SUDO_CONV_ERROR_MSG, "No plugin class is specified for python module '%s'. "
"Use 'ClassName' configuration option in 'sudo.conf'\n", plugin_path); "Use 'ClassName' configuration option in 'sudo.conf'\n", plugin_path);
if (py_plugin_list != NULL) { if (py_plugin_list != NULL) {
/* Sorting the plugin list makes regress test output consistent. */
PyObject *py_obj = PyObject_CallMethod(py_plugin_list, "sort", "");
Py_CLEAR(py_obj);
char *possible_plugins = py_join_str_list(py_plugin_list, ", "); char *possible_plugins = py_join_str_list(py_plugin_list, ", ");
if (possible_plugins != NULL) { if (possible_plugins != NULL) {
py_sudo_log(SUDO_CONV_ERROR_MSG, "Possible plugins: %s\n", possible_plugins); py_sudo_log(SUDO_CONV_ERROR_MSG, "Possible plugins: %s\n", possible_plugins);

View File

@@ -1,3 +1,3 @@
No plugin class is specified for python module 'SRC_DIR/regress/plugin_errorstr.py'. Use 'ClassName' configuration option in 'sudo.conf' No plugin class is specified for python module 'SRC_DIR/regress/plugin_errorstr.py'. Use 'ClassName' configuration option in 'sudo.conf'
Possible plugins: ErrorMsgPlugin, ConstructErrorPlugin Possible plugins: ConstructErrorPlugin, ErrorMsgPlugin
Failed during loading plugin class Failed during loading plugin class