summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorMingli Yu <Mingli.Yu@windriver.com>2018-12-17 21:21:00 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-14 11:35:55 +0000
commitd3886294db7fbf49a455db949b9a47f89800e88b (patch)
tree66ece3c90bb0a42f7fed341c9c10d4db30a22542 /meta
parent46f6f6a5f9de5e7f8f32f6ae768af61ec20ade4a (diff)
downloadpoky-d3886294db7fbf49a455db949b9a47f89800e88b.tar.gz
nfs-utils: fix build error under tests folder
* Redefine the reference path of libnfs.a to ../support/nfs/.libs/libnfs.a to fix below error when run "make -C tests statdb_dump". | make: *** No rule to make target '../support/nfs/libnfs.a', needed by 'statdb_dump'. Stop. | make: *** No rule to make target '../../support/nfs/libnfs.a', needed by 'nsm_client'. Stop. * The function generic_make_pathname is introduced in nfs-utils 2.3.1. Add the source file which defines function generic_make_pathname to libnsm_a_SOURCES of libnsm.a to fix the undefined reference when run "make -C tests statdb_dump" | ../support/nsm/libnsm.a(file.o): In function `nsm_make_pathname': | /usr/src/debug/nfs-utils/2.3.1-r0/nfs-utils-2.3.1/support/nsm/file.c:175: undefined reference to `generic_make_pathname' | /usr/src/debug/nfs-utils/2.3.1-r0/nfs-utils-2.3.1/support/nsm/file.c:175: undefined reference to `generic_make_pathname' | /usr/src/debug/nfs-utils/2.3.1-r0/nfs-utils-2.3.1/support/nsm/file.c:175: undefined reference to `generic_make_pathname' | ../support/nsm/libnsm.a(file.o): In function `nsm_setup_pathnames': | /usr/src/debug/nfs-utils/2.3.1-r0/nfs-utils-2.3.1/support/nsm/file.c:280: undefined reference to `generic_setup_basedir' | collect2: error: ld returned 1 exit status * After the logic of commit[dbb643e Removed missing-prototypes warnings.] introduced, there comes below error when run "make -C tests/nsm_client nsm_client" | nlm_sm_inter_svc.c:20:1: error: no previous prototype for 'nlm_sm_prog_3' [-Werror=missing-prototypes] It is because rpcgen doesn't generate -Wmissing-prototypes free code for nlm_sm_inter_svc.c with below logic in tests/nsm_client/Makefile.am [snip] GENFILES_SVC = nlm_sm_inter_svc.c [snip] $(GENFILES_SVC): %_svc.c: %.x $(RPCGEN) test -f $@ && rm -rf $@ || true $(RPCGEN) -m -o $@ $< So add the patch to not fatalize -Wmissing-prototypes. (From OE-Core rev: 18947cd4782934e9bc3ec5507db8db51258d9b2c) Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch295
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-update-the-path-of-libnfs.a.patch50
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure.ac-Do-not-fatalize-Wmissing-prototypes.patch43
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils_2.3.3.bb3
4 files changed, 391 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch
new file mode 100644
index 0000000000..aa551ebd19
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch
@@ -0,0 +1,295 @@
1From 690a90a5b7786e40b5447ad7c5f19a7657d27405 Mon Sep 17 00:00:00 2001
2From: Mingli Yu <Mingli.Yu@windriver.com>
3Date: Fri, 14 Dec 2018 17:44:32 +0800
4Subject: [PATCH] Makefile.am: fix undefined function for libnsm.a
5
6The source file of libnsm.a uses some function
7in ../support/misc/file.c, add ../support/misc/file.c
8to libnsm_a_SOURCES to fix build error when run
9"make -C tests statdb_dump":
10| ../support/nsm/libnsm.a(file.o): In function `nsm_make_pathname':
11| /usr/src/debug/nfs-utils/2.3.3-r0/nfs-utils-2.3.3/support/nsm/file.c:175: undefined reference to `generic_make_pathname'
12| /usr/src/debug/nfs-utils/2.3.3-r0/nfs-utils-2.3.3/support/nsm/file.c:175: undefined reference to `generic_make_pathname'
13| /usr/src/debug/nfs-utils/2.3.3-r0/nfs-utils-2.3.3/support/nsm/file.c:175: undefined reference to `generic_make_pathname'
14| ../support/nsm/libnsm.a(file.o): In function `nsm_setup_pathnames':
15| /usr/src/debug/nfs-utils/2.3.3-r0/nfs-utils-2.3.3/support/nsm/file.c:280: undefined reference to `generic_setup_basedir'
16| collect2: error: ld returned 1 exit status
17
18As there is already one source file named file.c
19as support/nsm/file.c in support/nsm/Makefile.am,
20so rename ../support/misc/file.c to ../support/misc/misc.c.
21
22Upstream-Status: Submitted[https://marc.info/?l=linux-nfs&m=154502780423058&w=2]
23
24Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
25---
26 support/misc/Makefile.am | 2 +-
27 support/misc/file.c | 111 -----------------------------------------------
28 support/misc/misc.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++
29 support/nsm/Makefile.am | 2 +-
30 4 files changed, 113 insertions(+), 113 deletions(-)
31 delete mode 100644 support/misc/file.c
32 create mode 100644 support/misc/misc.c
33
34diff --git a/support/misc/Makefile.am b/support/misc/Makefile.am
35index 8936b0d..d4c1f76 100644
36--- a/support/misc/Makefile.am
37+++ b/support/misc/Makefile.am
38@@ -1,6 +1,6 @@
39 ## Process this file with automake to produce Makefile.in
40
41 noinst_LIBRARIES = libmisc.a
42-libmisc_a_SOURCES = tcpwrapper.c from_local.c mountpoint.c file.c
43+libmisc_a_SOURCES = tcpwrapper.c from_local.c mountpoint.c misc.c
44
45 MAINTAINERCLEANFILES = Makefile.in
46diff --git a/support/misc/file.c b/support/misc/file.c
47deleted file mode 100644
48index e7c3819..0000000
49--- a/support/misc/file.c
50+++ /dev/null
51@@ -1,111 +0,0 @@
52-/*
53- * Copyright 2009 Oracle. All rights reserved.
54- * Copyright 2017 Red Hat, Inc. All rights reserved.
55- *
56- * This file is part of nfs-utils.
57- *
58- * nfs-utils is free software; you can redistribute it and/or modify
59- * it under the terms of the GNU General Public License as published by
60- * the Free Software Foundation; either version 2 of the License, or
61- * (at your option) any later version.
62- *
63- * nfs-utils is distributed in the hope that it will be useful,
64- * but WITHOUT ANY WARRANTY; without even the implied warranty of
65- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
66- * GNU General Public License for more details.
67- *
68- * You should have received a copy of the GNU General Public License
69- * along with nfs-utils. If not, see <http://www.gnu.org/licenses/>.
70- */
71-
72-#include <sys/stat.h>
73-
74-#include <string.h>
75-#include <libgen.h>
76-#include <stdio.h>
77-#include <errno.h>
78-#include <dirent.h>
79-#include <stdlib.h>
80-#include <stdbool.h>
81-#include <limits.h>
82-
83-#include "xlog.h"
84-#include "misc.h"
85-
86-/*
87- * Returns a dynamically allocated, '\0'-terminated buffer
88- * containing an appropriate pathname, or NULL if an error
89- * occurs. Caller must free the returned result with free(3).
90- */
91-__attribute__((__malloc__))
92-char *
93-generic_make_pathname(const char *base, const char *leaf)
94-{
95- size_t size;
96- char *path;
97- int len;
98-
99- size = strlen(base) + strlen(leaf) + 2;
100- if (size > PATH_MAX)
101- return NULL;
102-
103- path = malloc(size);
104- if (path == NULL)
105- return NULL;
106-
107- len = snprintf(path, size, "%s/%s", base, leaf);
108- if ((len < 0) || ((size_t)len >= size)) {
109- free(path);
110- return NULL;
111- }
112-
113- return path;
114-}
115-
116-
117-/**
118- * generic_setup_basedir - set up basedir
119- * @progname: C string containing name of program, for error messages
120- * @parentdir: C string containing pathname to on-disk state, or NULL
121- * @base: character buffer to contain the basedir that is set up
122- * @baselen: size of @base in bytes
123- *
124- * This runs before logging is set up, so error messages are directed
125- * to stderr.
126- *
127- * Returns true and sets up our basedir, if @parentdir was valid
128- * and usable; otherwise false is returned.
129- */
130-_Bool
131-generic_setup_basedir(const char *progname, const char *parentdir, char *base,
132- const size_t baselen)
133-{
134- static char buf[PATH_MAX];
135- struct stat st;
136- char *path;
137-
138- /* First: test length of name and whether it exists */
139- if ((strlen(parentdir) >= baselen) || (strlen(parentdir) >= PATH_MAX)) {
140- (void)fprintf(stderr, "%s: Directory name too long: %s",
141- progname, parentdir);
142- return false;
143- }
144- if (lstat(parentdir, &st) == -1) {
145- (void)fprintf(stderr, "%s: Failed to stat %s: %s",
146- progname, parentdir, strerror(errno));
147- return false;
148- }
149-
150- /* Ensure we have a clean directory pathname */
151- strncpy(buf, parentdir, sizeof(buf)-1);
152- path = dirname(buf);
153- if (*path == '.') {
154- (void)fprintf(stderr, "%s: Unusable directory %s",
155- progname, parentdir);
156- return false;
157- }
158-
159- xlog(D_CALL, "Using %s as the state directory", parentdir);
160- strcpy(base, parentdir);
161- return true;
162-}
163diff --git a/support/misc/misc.c b/support/misc/misc.c
164new file mode 100644
165index 0000000..e7c3819
166--- /dev/null
167+++ b/support/misc/misc.c
168@@ -0,0 +1,111 @@
169+/*
170+ * Copyright 2009 Oracle. All rights reserved.
171+ * Copyright 2017 Red Hat, Inc. All rights reserved.
172+ *
173+ * This file is part of nfs-utils.
174+ *
175+ * nfs-utils is free software; you can redistribute it and/or modify
176+ * it under the terms of the GNU General Public License as published by
177+ * the Free Software Foundation; either version 2 of the License, or
178+ * (at your option) any later version.
179+ *
180+ * nfs-utils is distributed in the hope that it will be useful,
181+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
182+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
183+ * GNU General Public License for more details.
184+ *
185+ * You should have received a copy of the GNU General Public License
186+ * along with nfs-utils. If not, see <http://www.gnu.org/licenses/>.
187+ */
188+
189+#include <sys/stat.h>
190+
191+#include <string.h>
192+#include <libgen.h>
193+#include <stdio.h>
194+#include <errno.h>
195+#include <dirent.h>
196+#include <stdlib.h>
197+#include <stdbool.h>
198+#include <limits.h>
199+
200+#include "xlog.h"
201+#include "misc.h"
202+
203+/*
204+ * Returns a dynamically allocated, '\0'-terminated buffer
205+ * containing an appropriate pathname, or NULL if an error
206+ * occurs. Caller must free the returned result with free(3).
207+ */
208+__attribute__((__malloc__))
209+char *
210+generic_make_pathname(const char *base, const char *leaf)
211+{
212+ size_t size;
213+ char *path;
214+ int len;
215+
216+ size = strlen(base) + strlen(leaf) + 2;
217+ if (size > PATH_MAX)
218+ return NULL;
219+
220+ path = malloc(size);
221+ if (path == NULL)
222+ return NULL;
223+
224+ len = snprintf(path, size, "%s/%s", base, leaf);
225+ if ((len < 0) || ((size_t)len >= size)) {
226+ free(path);
227+ return NULL;
228+ }
229+
230+ return path;
231+}
232+
233+
234+/**
235+ * generic_setup_basedir - set up basedir
236+ * @progname: C string containing name of program, for error messages
237+ * @parentdir: C string containing pathname to on-disk state, or NULL
238+ * @base: character buffer to contain the basedir that is set up
239+ * @baselen: size of @base in bytes
240+ *
241+ * This runs before logging is set up, so error messages are directed
242+ * to stderr.
243+ *
244+ * Returns true and sets up our basedir, if @parentdir was valid
245+ * and usable; otherwise false is returned.
246+ */
247+_Bool
248+generic_setup_basedir(const char *progname, const char *parentdir, char *base,
249+ const size_t baselen)
250+{
251+ static char buf[PATH_MAX];
252+ struct stat st;
253+ char *path;
254+
255+ /* First: test length of name and whether it exists */
256+ if ((strlen(parentdir) >= baselen) || (strlen(parentdir) >= PATH_MAX)) {
257+ (void)fprintf(stderr, "%s: Directory name too long: %s",
258+ progname, parentdir);
259+ return false;
260+ }
261+ if (lstat(parentdir, &st) == -1) {
262+ (void)fprintf(stderr, "%s: Failed to stat %s: %s",
263+ progname, parentdir, strerror(errno));
264+ return false;
265+ }
266+
267+ /* Ensure we have a clean directory pathname */
268+ strncpy(buf, parentdir, sizeof(buf)-1);
269+ path = dirname(buf);
270+ if (*path == '.') {
271+ (void)fprintf(stderr, "%s: Unusable directory %s",
272+ progname, parentdir);
273+ return false;
274+ }
275+
276+ xlog(D_CALL, "Using %s as the state directory", parentdir);
277+ strcpy(base, parentdir);
278+ return true;
279+}
280diff --git a/support/nsm/Makefile.am b/support/nsm/Makefile.am
281index 8f5874e..68f1a46 100644
282--- a/support/nsm/Makefile.am
283+++ b/support/nsm/Makefile.am
284@@ -10,7 +10,7 @@ GENFILES = $(GENFILES_CLNT) $(GENFILES_SVC) $(GENFILES_XDR) $(GENFILES_H)
285 EXTRA_DIST = sm_inter.x
286
287 noinst_LIBRARIES = libnsm.a
288-libnsm_a_SOURCES = $(GENFILES) file.c rpc.c
289+libnsm_a_SOURCES = $(GENFILES) ../misc/misc.c file.c rpc.c
290
291 BUILT_SOURCES = $(GENFILES)
292
293--
2942.7.4
295
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-update-the-path-of-libnfs.a.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-update-the-path-of-libnfs.a.patch
new file mode 100644
index 0000000000..906ac0f905
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-update-the-path-of-libnfs.a.patch
@@ -0,0 +1,50 @@
1From fcece65d1b713eaeef41706898440302f8ce92d9 Mon Sep 17 00:00:00 2001
2From: Mingli Yu <Mingli.Yu@windriver.com>
3Date: Thu, 12 Jul 2018 15:19:41 +0800
4Subject: [PATCH] Makefile.am: update the path of libnfs.a
5
6The libnfs.a is under ../support/nfs/.libs/ now,
7update the reference path accordingly to fix below
8build error when run "make -C tests statdb_dump":
9| make: *** No rule to make target '../support/nfs/libnfs.a', needed by 'statdb_dump'. Stop.
10
11And below error when run "make -C tests/nsm_client nsm_client"
12| make: *** No rule to make target '../../support/nfs/libnfs.a', needed by 'nsm_client'. Stop.
13
14Upstream-Status: Submitted[https://marc.info/?l=linux-nfs&m=154502636522745&w=2]
15
16Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
17---
18 tests/Makefile.am | 2 +-
19 tests/nsm_client/Makefile.am | 2 +-
20 2 files changed, 2 insertions(+), 2 deletions(-)
21
22diff --git a/tests/Makefile.am b/tests/Makefile.am
23index 1f96264..74aa629 100644
24--- a/tests/Makefile.am
25+++ b/tests/Makefile.am
26@@ -3,7 +3,7 @@
27 check_PROGRAMS = statdb_dump
28 statdb_dump_SOURCES = statdb_dump.c
29
30-statdb_dump_LDADD = ../support/nfs/libnfs.a \
31+statdb_dump_LDADD = ../support/nfs/.libs/libnfs.a \
32 ../support/nsm/libnsm.a $(LIBCAP)
33
34 SUBDIRS = nsm_client
35diff --git a/tests/nsm_client/Makefile.am b/tests/nsm_client/Makefile.am
36index a8fc131..43db9c2 100644
37--- a/tests/nsm_client/Makefile.am
38+++ b/tests/nsm_client/Makefile.am
39@@ -13,7 +13,7 @@ check_PROGRAMS = nsm_client
40 nsm_client_SOURCES = $(GENFILES) nsm_client.c
41
42 BUILT_SOURCES = $(GENFILES)
43-nsm_client_LDADD = ../../support/nfs/libnfs.a \
44+nsm_client_LDADD = ../../support/nfs/.libs/libnfs.a \
45 ../../support/nsm/libnsm.a $(LIBCAP) $(LIBTIRPC)
46
47 if CONFIG_RPCGEN
48--
492.7.4
50
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure.ac-Do-not-fatalize-Wmissing-prototypes.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure.ac-Do-not-fatalize-Wmissing-prototypes.patch
new file mode 100644
index 0000000000..17aabb9e4d
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure.ac-Do-not-fatalize-Wmissing-prototypes.patch
@@ -0,0 +1,43 @@
1From 66471fbf7106917da7a1536b18a0a77d07479779 Mon Sep 17 00:00:00 2001
2From: Mingli Yu <Mingli.Yu@windriver.com>
3Date: Mon, 17 Dec 2018 15:29:47 +0800
4Subject: [PATCH] configure.ac: Do not fatalize -Wmissing-prototypes
5
6There comes below error when run "make -C tests/nsm_client nsm_client"
7| nlm_sm_inter_svc.c:20:1: error: no previous prototype for 'nlm_sm_prog_3' [-Werror=missing-prototypes]
8
9It is because rpcgen doesn't generate -Wmissing-prototypes
10free code for nlm_sm_inter_svc.c with below logic
11in tests/nsm_client/Makefile.am
12[snip]
13GENFILES_SVC = nlm_sm_inter_svc.c
14[snip]
15$(GENFILES_SVC): %_svc.c: %.x $(RPCGEN)
16 test -f $@ && rm -rf $@ || true
17 $(RPCGEN) -m -o $@ $<
18
19So add the logic not to fatalize -Wmissing-prototypes.
20
21Upstream-Status: Submitted[https://marc.info/?l=linux-nfs&m=154503260323936&w=2]
22
23Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
24---
25 configure.ac | 2 +-
26 1 file changed, 1 insertion(+), 1 deletion(-)
27
28diff --git a/configure.ac b/configure.ac
29index e82ff14..d0cc5d5 100644
30--- a/configure.ac
31+++ b/configure.ac
32@@ -548,7 +548,7 @@ my_am_cflags="\
33 -Wall \
34 -Wextra \
35 -Werror=strict-prototypes \
36- -Werror=missing-prototypes \
37+ -Wmissing-prototypes \
38 -Werror=missing-declarations \
39 -Werror=format=2 \
40 -Werror=undef \
41--
422.7.4
43
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.3.3.bb b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.3.3.bb
index 63aa6add5a..84530f698b 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.3.3.bb
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.3.3.bb
@@ -33,7 +33,10 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x
33 file://0001-cacheio-use-intmax_t-for-formatted-IO.patch \ 33 file://0001-cacheio-use-intmax_t-for-formatted-IO.patch \
34 file://0001-Do-not-pass-null-pointer-to-freeaddrinfo.patch \ 34 file://0001-Do-not-pass-null-pointer-to-freeaddrinfo.patch \
35 file://clang-format-string.patch \ 35 file://clang-format-string.patch \
36 file://0001-Makefile.am-update-the-path-of-libnfs.a.patch \
37 file://0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch \
36" 38"
39SRC_URI_append_libc-glibc = " file://0001-configure.ac-Do-not-fatalize-Wmissing-prototypes.patch"
37SRC_URI_append_libc-musl = " file://nfs-utils-musl-res_querydomain.patch" 40SRC_URI_append_libc-musl = " file://nfs-utils-musl-res_querydomain.patch"
38 41
39SRC_URI[md5sum] = "b6c9c032995af1c08fea9fbcc1ce33e9" 42SRC_URI[md5sum] = "b6c9c032995af1c08fea9fbcc1ce33e9"