diff --git a/0028-libmultipath-add-section-name-to-invalid-keyword-out.patch b/0028-libmultipath-add-section-name-to-invalid-keyword-out.patch new file mode 100644 index 0000000000000000000000000000000000000000..204871f4fd14366c3dbe422ffd4cf14777e93692 --- /dev/null +++ b/0028-libmultipath-add-section-name-to-invalid-keyword-out.patch @@ -0,0 +1,73 @@ +From 65a9421ebfe541005c0359c305068f8b0c0e95b6 Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +Date: Thu, 11 Nov 2021 12:53:44 -0600 +Subject: [PATCH] libmultipath: add section name to invalid keyword output + +If users forget the closing brace for a section in multipath.conf, +multipath has no way to detect that. When it sees the keyword at the +start of the next section, it will complain that there is an invalid +keyword, because that keyword doesn't belong in previous section (which +was never ended with a closing brace). This can confuse users. To make +this easier to understand, when multipath prints an invalid keyword +message, it now also prints the current section name, which can give +users a hint that they didn't end the previous section. + +Signed-off-by: Benjamin Marzinski +Reviewed-by: Martin Wilck +--- + libmultipath/parser.c | 20 +++++++++++++------- + 1 file changed, 13 insertions(+), 7 deletions(-) + +diff --git a/libmultipath/parser.c b/libmultipath/parser.c +index 8ca91bf2..611054f7 100644 +--- a/libmultipath/parser.c ++++ b/libmultipath/parser.c +@@ -504,7 +504,7 @@ validate_config_strvec(vector strvec, const char *file) + + static int + process_stream(struct config *conf, FILE *stream, vector keywords, +- const char *file) ++ const char *section, const char *file) + { + int i; + int r = 0, t; +@@ -568,16 +568,22 @@ process_stream(struct config *conf, FILE *stream, vector keywords, + if (keyword->sub) { + kw_level++; + r += process_stream(conf, stream, +- keyword->sub, file); ++ keyword->sub, ++ keyword->string, ++ file); + kw_level--; + } + break; + } + } +- if (i >= VECTOR_SIZE(keywords)) +- condlog(1, "%s line %d, invalid keyword: %s", +- file, line_nr, str); +- ++ if (i >= VECTOR_SIZE(keywords)) { ++ if (section) ++ condlog(1, "%s line %d, invalid keyword in the %s section: %s", ++ file, line_nr, section, str); ++ else ++ condlog(1, "%s line %d, invalid keyword: %s", ++ file, line_nr, str); ++ } + free_strvec(strvec); + } + if (kw_level == 1) +@@ -608,7 +614,7 @@ process_file(struct config *conf, const char *file) + + /* Stream handling */ + line_nr = 0; +- r = process_stream(conf, stream, conf->keywords, file); ++ r = process_stream(conf, stream, conf->keywords, NULL, file); + fclose(stream); + //free_keywords(keywords); + +-- +2.23.0 + diff --git a/multipath-tools.spec b/multipath-tools.spec index a3f1352ebd9df1df749f950d71e947337d2bdd14..7bc26bc753d947ec1266bd1dc345c5941fdabaf4 100644 --- a/multipath-tools.spec +++ b/multipath-tools.spec @@ -1,7 +1,7 @@ #needsrootforbuild Name: multipath-tools Version: 0.8.7 -Release: 10 +Release: 11 Summary: Tools to manage multipath devices with the device-mapper License: GPL-2.0-or-later and LGPL-2.0-only URL: http://christophe.varoqui.free.fr/ @@ -36,6 +36,7 @@ Patch24: 0024-libmultipath-use-directio-checker-for-LIO-targets.patch Patch25: 0025-multipathd-make-pr-registration-consistent.patch Patch26: 0026-libmultipath-io_err_stat-don-t-free-aio-memory-befor.patch Patch27: 0027-libmultipath-io_err_stat-call-io_destroy-inside-free.patch +Patch28: 0028-libmultipath-add-section-name-to-invalid-keyword-out.patch BuildRequires: multipath-tools, libcmocka, libcmocka-devel BuildRequires: gcc, libaio-devel, userspace-rcu-devel, device-mapper-devel >= 1.02.89 @@ -183,6 +184,9 @@ fi %changelog +* Tue Apr 9 2024 kouwenqi - 0.8.7-11 +- libmultipath: add section name to invalid keyword output + * Tue Dec 19 2023 wangzhiqiang - 0.8.7-10 - fix coredump in io_err_stat