Package: yp-tools
Version: 3.3-4
Severity: importatnt
Tags: sid, patch
Justification: FTBFS
User: debian-m...@lists.debian.org
Usertags: mips-patch
Package yp-tools FTBFS on mips*, arm and other architectures that requires
aligned memory access.
Error message:
> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I. -I/usr/include/tirpc
> -DLOCALEDIR=\"/usr/share/locale\" -Wdate-time -D_FORTIFY_SOURCE=2 -W -Wall
> -Wbad-function-cast -Wcast-align -Winline -Wnested-externs -Wshadow
> -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef
> -Werror -D_REENTRANT=1 -g -O2 -fdebug-prefix-map=/«PKGBUILDDIR»=.
> -fstack-protector-strong -Wformat -Werror=format-security -c do_ypcall.c
> -fPIC -DPIC -o .libs/do_ypcall.o
> do_ypcall.c: In function 'do_ypcall_tr':
> do_ypcall.c:460:27: error: cast increases required alignment of target type
> [-Werror=cast-align]
> status = ypprot_err (((struct ypresp_val *) resp)->status);
> ^
> cc1: all warnings being treated as errors
> Makefile:541: recipe for target 'do_ypcall.lo' failed
> make[3]: *** [do_ypcall.lo] Error 1
https://buildd.debian.org/status/fetch.php?pkg=yp-tools&arch=mipsel&ver=3.3-4&stamp=1470779696
This issue appears due to cast "caddr_t" (char * ) to "struct ypresp_val *".
I believe that this will not cause unaligned access as resp is previously
defined as some of the ypresp structures and aligned properly,
but compiler with enabled -Wcast-align and -Werror flags will terminate the
build on mips, arm and few more architectures.
Adding cast to "void *" will solve this issue.
Patch that contains this solution is attached, I had tests it on mipsel and
mips64el,
could you please include it?
I do not have access on other arches but hopefully this will this issue on
arm*, alpha, sh4 and sparc64 as well.
Another solution could be to use "void *" instead of "caddr_t".
Regards,
Dejan
--- yp-tools-3.3.orig/lib/do_ypcall.c
+++ yp-tools-3.3/lib/do_ypcall.c
@@ -457,7 +457,7 @@ do_ypcall_tr (const char *domain, u_long
type ypresp_key_val or ypresp_master or ypresp_order or
ypresp_maplist. But the stat element is in a common prefix so
this does not matter. */
- status = ypprot_err (((struct ypresp_val *) resp)->status);
+ status = ypprot_err (((struct ypresp_val *) (void *) resp)->status);
return status;
}