1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-07 16:59:22 +00:00

nfs-utils: Fix host path contamination building locktest

(From OE-Core rev: c4a50b0738235ce6fdff078d513827ba00b8affc)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj
2023-07-26 00:08:30 -07:00
committed by Richard Purdie
parent 9205ac1d53
commit 5d66e8166f
3 changed files with 91 additions and 0 deletions
@@ -0,0 +1,36 @@
From 9efa7a0d37665d9bb0f46d2407883a5ab42c2b84 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 24 Jul 2023 20:39:16 -0700
Subject: [PATCH] locktest: Makefile.am: Do not use build flags
Using CFLAGS_FOR_BUILD etc. here means it is using wrong flags
when thse flags are speficied different than target flags which
is common when cross-building. It can pass wrong paths to linker
and it would find incompatible libraries during link since they
are from host system and target maybe not same as build host.
Fixes subtle errors like
| aarch64-yoe-linux-ld.lld: error: /mnt/b/yoe/master/build/tmp/work/cortexa72-cortexa53-crypto-yoe-linux/nfs-utils/2.6.3-r0/recipe-sysroot-native/usr/lib/libsqlite3.so is incompatible with elf64-littleaarch64
Upstream-Status: Submitted [https://marc.info/?l=linux-nfs&m=169025681008001&w=2]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
tools/locktest/Makefile.am | 3 ---
1 file changed, 3 deletions(-)
diff --git a/tools/locktest/Makefile.am b/tools/locktest/Makefile.am
index e8914655..2fd36971 100644
--- a/tools/locktest/Makefile.am
+++ b/tools/locktest/Makefile.am
@@ -2,8 +2,5 @@
noinst_PROGRAMS = testlk
testlk_SOURCES = testlk.c
-testlk_CFLAGS=$(CFLAGS_FOR_BUILD)
-testlk_CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
-testlk_LDFLAGS=$(LDFLAGS_FOR_BUILD)
MAINTAINERCLEANFILES = Makefile.in
--
2.41.0
@@ -0,0 +1,53 @@
From e2e9251dbeb452f5382179023d8ae18b511167a1 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 25 Jul 2023 23:47:08 -0700
Subject: [PATCH] tools/locktest: Use intmax_t to print off_t
off_t could be 64bit on 32bit architectures which means using %z printf
modifier is not enough to print it and compiler will complain about
format mismatch
Fixes
| testlk.c:84:66: error: format '%zd' expects argument of type 'signed size_t', but argument 4 has type '__off64_t' {aka 'long long int'} [-Werror=format=]
| 84 | printf("%s: conflicting lock by %d on (%zd;%zd)\n",
| | ~~^
| | |
| | int
| | %lld
| 85 | fname, fl.l_pid, fl.l_start, fl.l_len);
| | ~~~~~~~~~~
| | |
| | __off64_t {aka long long int}
Upstream-Status: Submitted [https://marc.info/?l=linux-nfs&m=169035457128067&w=2]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
tools/locktest/testlk.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/locktest/testlk.c b/tools/locktest/testlk.c
index ea51f788..9d4c88c4 100644
--- a/tools/locktest/testlk.c
+++ b/tools/locktest/testlk.c
@@ -2,6 +2,7 @@
#include <config.h>
#endif
+#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@@ -81,8 +82,8 @@ main(int argc, char **argv)
if (fl.l_type == F_UNLCK) {
printf("%s: no conflicting lock\n", fname);
} else {
- printf("%s: conflicting lock by %d on (%zd;%zd)\n",
- fname, fl.l_pid, fl.l_start, fl.l_len);
+ printf("%s: conflicting lock by %d on (%jd;%jd)\n",
+ fname, fl.l_pid, (intmax_t)fl.l_start, (intmax_t)fl.l_len);
}
return 0;
}
--
2.41.0
@@ -31,6 +31,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x
file://0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch \
file://clang-warnings.patch \
file://0001-configure.ac-libevent-and-libsqlite3-checked-when-nf.patch \
file://0001-locktest-Makefile.am-Do-not-use-build-flags.patch \
file://0001-tools-locktest-Use-intmax_t-to-print-off_t.patch \
"
SRC_URI[sha256sum] = "38d89e853a71d3c560ff026af3d969d75e24f782ff68324e76261fe0344459e1"