diff options
3 files changed, 41 insertions, 110 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Detect-warning-options-during-configure.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Detect-warning-options-during-configure.patch deleted file mode 100644 index 69236e8278..0000000000 --- a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Detect-warning-options-during-configure.patch +++ /dev/null | |||
| @@ -1,109 +0,0 @@ | |||
| 1 | From 1ab0c326405c6daa06f1a7eb4b0b60bf4e0584c2 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Tue, 31 Dec 2019 08:15:34 -0800 | ||
| 4 | Subject: [PATCH] Detect warning options during configure | ||
| 5 | |||
| 6 | Certain options maybe compiler specific therefore its better | ||
| 7 | to detect them before use. | ||
| 8 | |||
| 9 | nfs_error copies the format string and appends newline to it | ||
| 10 | but compiler can forget that it was format string since its not | ||
| 11 | same fmt string that was passed. Ignore the warning | ||
| 12 | |||
| 13 | Wdiscarded-qualifiers is gcc specific and this is no longer needed | ||
| 14 | |||
| 15 | Upstream-Status: Pending | ||
| 16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 17 | |||
| 18 | --- | ||
| 19 | support/nfs/xcommon.c | 6 ++++++ | ||
| 20 | support/nfs/xlog.c | 6 ++++++ | ||
| 21 | support/nfsidmap/libnfsidmap.c | 3 +++ | ||
| 22 | utils/exportfs/exportfs.c | 3 +++ | ||
| 23 | 4 files changed, 18 insertions(+) | ||
| 24 | |||
| 25 | diff --git a/support/nfs/xcommon.c b/support/nfs/xcommon.c | ||
| 26 | index 3989f0bc..ff438c18 100644 | ||
| 27 | --- a/support/nfs/xcommon.c | ||
| 28 | +++ b/support/nfs/xcommon.c | ||
| 29 | @@ -98,7 +98,10 @@ nfs_error (const char *fmt, ...) { | ||
| 30 | |||
| 31 | fmt2 = xstrconcat2 (fmt, "\n"); | ||
| 32 | va_start (args, fmt); | ||
| 33 | +#pragma GCC diagnostic push | ||
| 34 | +#pragma GCC diagnostic ignored "-Wformat-nonliteral" | ||
| 35 | vfprintf (stderr, fmt2, args); | ||
| 36 | +#pragma GCC diagnostic pop | ||
| 37 | va_end (args); | ||
| 38 | free (fmt2); | ||
| 39 | } | ||
| 40 | @@ -132,7 +135,10 @@ die(int err, const char *fmt, ...) { | ||
| 41 | va_list args; | ||
| 42 | |||
| 43 | va_start(args, fmt); | ||
| 44 | +#pragma GCC diagnostic push | ||
| 45 | +#pragma GCC diagnostic ignored "-Wformat-nonliteral" | ||
| 46 | vfprintf(stderr, fmt, args); | ||
| 47 | +#pragma GCC diagnostic pop | ||
| 48 | fprintf(stderr, "\n"); | ||
| 49 | va_end(args); | ||
| 50 | |||
| 51 | diff --git a/support/nfs/xlog.c b/support/nfs/xlog.c | ||
| 52 | index fa125cef..dc4c9ea1 100644 | ||
| 53 | --- a/support/nfs/xlog.c | ||
| 54 | +++ b/support/nfs/xlog.c | ||
| 55 | @@ -178,11 +178,16 @@ xlog_backend(int kind, const char *fmt, va_list args) | ||
| 56 | fprintf(stderr, "%s: ", log_name); | ||
| 57 | #endif | ||
| 58 | va_copy(args2, args); | ||
| 59 | +#pragma GCC diagnostic push | ||
| 60 | +#pragma GCC diagnostic ignored "-Wformat-nonliteral" | ||
| 61 | vfprintf(stderr, fmt, args2); | ||
| 62 | +#pragma GCC diagnostic pop | ||
| 63 | fprintf(stderr, "\n"); | ||
| 64 | va_end(args2); | ||
| 65 | } | ||
| 66 | |||
| 67 | +#pragma GCC diagnostic push | ||
| 68 | +#pragma GCC diagnostic ignored "-Wformat-nonliteral" | ||
| 69 | if (log_syslog) { | ||
| 70 | switch (kind) { | ||
| 71 | case L_FATAL: | ||
| 72 | @@ -203,6 +208,7 @@ xlog_backend(int kind, const char *fmt, va_list args) | ||
| 73 | break; | ||
| 74 | } | ||
| 75 | } | ||
| 76 | +#pragma GCC diagnostic pop | ||
| 77 | |||
| 78 | if (kind == L_FATAL) | ||
| 79 | exit(1); | ||
| 80 | diff --git a/support/nfsidmap/libnfsidmap.c b/support/nfsidmap/libnfsidmap.c | ||
| 81 | index f8c36480..1a28be0a 100644 | ||
| 82 | --- a/support/nfsidmap/libnfsidmap.c | ||
| 83 | +++ b/support/nfsidmap/libnfsidmap.c | ||
| 84 | @@ -99,7 +99,10 @@ static void default_logger(const char *fmt, ...) | ||
| 85 | va_list vp; | ||
| 86 | |||
| 87 | va_start(vp, fmt); | ||
| 88 | +#pragma GCC diagnostic push | ||
| 89 | +#pragma GCC diagnostic ignored "-Wformat-nonliteral" | ||
| 90 | vsyslog(LOG_WARNING, fmt, vp); | ||
| 91 | +#pragma GCC diagnostic pop | ||
| 92 | va_end(vp); | ||
| 93 | } | ||
| 94 | |||
| 95 | diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c | ||
| 96 | index b03a047b..eac1ff2a 100644 | ||
| 97 | --- a/utils/exportfs/exportfs.c | ||
| 98 | +++ b/utils/exportfs/exportfs.c | ||
| 99 | @@ -646,7 +646,10 @@ dumpopt(char c, char *fmt, ...) | ||
| 100 | |||
| 101 | va_start(ap, fmt); | ||
| 102 | printf("%c", c); | ||
| 103 | +#pragma GCC diagnostic push | ||
| 104 | +#pragma GCC diagnostic ignored "-Wformat-nonliteral" | ||
| 105 | vprintf(fmt, ap); | ||
| 106 | +#pragma GCC diagnostic pop | ||
| 107 | va_end(ap); | ||
| 108 | return ','; | ||
| 109 | } | ||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0003-support-nfs-xcommon.c-fix-a-formatting-error-with-cl.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0003-support-nfs-xcommon.c-fix-a-formatting-error-with-cl.patch new file mode 100644 index 0000000000..a99ba284e0 --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0003-support-nfs-xcommon.c-fix-a-formatting-error-with-cl.patch | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | From cc59a7fe15b6ca2ee43cba0dc1d699323b36ffcc Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alexander Kanavin <alex@linutronix.de> | ||
| 3 | Date: Fri, 21 Mar 2025 10:42:56 +0100 | ||
| 4 | Subject: [PATCH] support/nfs/xcommon.c: fix a formatting error with clang | ||
| 5 | |||
| 6 | Specifically, this happens: | ||
| 7 | |||
| 8 | | xcommon.c:101:24: error: format string is not a string literal [-Werror,-Wformat-nonliteral] | ||
| 9 | | 101 | vfprintf (stderr, fmt2, args); | ||
| 10 | | | ^~~~ | ||
| 11 | |||
| 12 | A similar approach (print \n seprately) is already used elsewhere in | ||
| 13 | the same file. | ||
| 14 | |||
| 15 | Upstream-Status: Submitted [via email to steved@redhat.com,linux-nfs@vger.kernel.org] | ||
| 16 | Signed-off-by: Alexander Kanavin <alex@linutronix.de> | ||
| 17 | --- | ||
| 18 | support/nfs/xcommon.c | 6 ++---- | ||
| 19 | 1 file changed, 2 insertions(+), 4 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/support/nfs/xcommon.c b/support/nfs/xcommon.c | ||
| 22 | index 3989f0b..1d04dd1 100644 | ||
| 23 | --- a/support/nfs/xcommon.c | ||
| 24 | +++ b/support/nfs/xcommon.c | ||
| 25 | @@ -94,13 +94,11 @@ xstrconcat4 (const char *s, const char *t, const char *u, const char *v) { | ||
| 26 | void | ||
| 27 | nfs_error (const char *fmt, ...) { | ||
| 28 | va_list args; | ||
| 29 | - char *fmt2; | ||
| 30 | |||
| 31 | - fmt2 = xstrconcat2 (fmt, "\n"); | ||
| 32 | va_start (args, fmt); | ||
| 33 | - vfprintf (stderr, fmt2, args); | ||
| 34 | + vfprintf (stderr, fmt, args); | ||
| 35 | + fprintf (stderr, "\n"); | ||
| 36 | va_end (args); | ||
| 37 | - free (fmt2); | ||
| 38 | } | ||
| 39 | |||
| 40 | /* Make a canonical pathname from PATH. Returns a freshly malloced string. | ||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.8.2.bb b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.8.2.bb index abbdec7808..1f3afa0560 100644 --- a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.8.2.bb +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.8.2.bb | |||
| @@ -23,9 +23,9 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x | |||
| 23 | file://nfscommon \ | 23 | file://nfscommon \ |
| 24 | file://0001-locktest-Makefile.am-Do-not-use-build-flags.patch \ | 24 | file://0001-locktest-Makefile.am-Do-not-use-build-flags.patch \ |
| 25 | file://0001-Fix-typecast-warning-with-clang.patch \ | 25 | file://0001-Fix-typecast-warning-with-clang.patch \ |
| 26 | file://0001-Detect-warning-options-during-configure.patch \ | ||
| 27 | file://0004-Use-nogroup-for-nobody-group.patch \ | 26 | file://0004-Use-nogroup-for-nobody-group.patch \ |
| 28 | file://0005-find-OE-provided-Kerberos.patch \ | 27 | file://0005-find-OE-provided-Kerberos.patch \ |
| 28 | file://0003-support-nfs-xcommon.c-fix-a-formatting-error-with-cl.patch \ | ||
| 29 | " | 29 | " |
| 30 | 30 | ||
| 31 | SRC_URI[sha256sum] = "a39bbea76ac0ab9e6e8699caf3c308b6b310c20d458e8fa8606196d358e7fb15" | 31 | SRC_URI[sha256sum] = "a39bbea76ac0ab9e6e8699caf3c308b6b310c20d458e8fa8606196d358e7fb15" |
