nfs-kernel-server: fix build

Add nls.mk and patch to avoid the build ending in an error:
In function 'write_table',
    inlined from 'write_tables' at rpc_tblout.c:73:4,
    inlined from 't_output.constprop' at rpc_main.c:841:3:
rpc_tblout.c:91:26: error: '%s' directive writing likely 1 or more bytes into a region of size between 0 and 99 [-Werror=format-overflow=]
   91 |       s_print (progvers, "%s_%s",
      |                          ^
rpc_tblout.c:91:26: note: assuming directive output of 1 byte
In function 'sprintf',
    inlined from 'write_table' at rpc_tblout.c:91:7,
    inlined from 'write_tables' at rpc_tblout.c:73:4,
    inlined from 't_output.constprop' at rpc_main.c:841:3:
/scratch/union/staging_dir/toolchain-x86_64_gcc-15.1.0_glibc/include/bits/stdio2.h:30:10: note: '__builtin___sprintf_chk' output 2 or more bytes (assuming 102) into a destination of size 100
   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^
lto1: some warnings being treated as errors
make[6]: *** [/scratch/union/tmp/ccHfYNRX.mk:2: /scratch/union/tmp/ccudJcWZ.ltrans0.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
mold: fatal: lto-wrapper failed

Build system: x86/64
Build-tested: x86/64-glibc
Run-tested: x86/64-glibc

Co-developed-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: John Audia <therealgraysky@proton.me>
This commit is contained in:
John Audia
2025-07-15 10:05:43 -04:00
committed by Tianling Shen
parent 9318a696ff
commit b606b58ac2
2 changed files with 34 additions and 1 deletions

View File

@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=nfs-kernel-server
PKG_VERSION:=2.8.3
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_HASH:=11e7c5847a8423a72931c865bd9296e7fd56ff270a795a849183900961711725
PKG_SOURCE_URL:=@KERNEL/linux/utils/nfs-utils/$(PKG_VERSION)
@@ -27,6 +27,7 @@ PKG_CONFIG_DEPENDS:= \
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
define Package/nfs-kernel-server/Default
SECTION:=net

View File

@@ -0,0 +1,32 @@
--- a/tools/rpcgen/rpc_tblout.c
+++ b/tools/rpcgen/rpc_tblout.c
@@ -82,14 +82,19 @@ write_table (const definition * def)
proc_list *proc;
int current;
int expected;
- char progvers[100];
+ char *progvers;
int warning;
+ int a;
for (vp = def->def.pr.versions; vp != NULL; vp = vp->next)
{
warning = 0;
- s_print (progvers, "%s_%s",
+ a = asprintf (&progvers, "%s_%s",
locase (def->def_name), vp->vers_num);
+ if (a == -1)
+ {
+ return;
+ }
/* print the table header */
f_print (fout, tbl_hdr, progvers);
@@ -146,6 +151,7 @@ write_table (const definition * def)
/* print the table trailer */
f_print (fout, tbl_end);
f_print (fout, tbl_nproc, progvers, progvers, progvers);
+ free (progvers);
}
}