Bug#869086: dsniff sometimes FTBFS due to missing Makefile dependency

2017-07-20 Thread Lukas Schwaighofer
Hi Adrian,

On Thu, 20 Jul 2017 14:57:46 +0300
Adrian Bunk  wrote:

> dsniff sometimes FTBFS in parallel builds: (...)
> The problem is a race condition where decode_mountd.c includes
> mount.h before rpcgen has finished generating it.

Indeed.

> A fix is attached.

Thanks a lot for debugging this already.  I had another FTBFS with your
patch applied, because `make` was trying to build mount.o without having
generated mount.h first.  I ended up inserting another dependency

 mount.o: mount.h

so that the ".c.o" rule would not try to build mount.o before
generating mount.h.  I also found another similar dependency between
nfs_prot.h and filesnarf.o which I resolved in the same way.

Hopefully that fixes all the parallel FTBFS now…

Thanks & Regards
Lukas


pgp9YjhQHOklz.pgp
Description: OpenPGP digital signature


Bug#869086: dsniff sometimes FTBFS due to missing Makefile dependency

2017-07-20 Thread Adrian Bunk
Source: dsniff
Version: 2.4b1+debian-26
Severity: serious
Tags: patch

dsniff sometimes FTBFS in parallel builds:

https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/dsniff.html

...
rpcgen -h mount.x -o mount.h
...
./decode_mountd.c: In function 'decode_mountd':
./decode_mountd.c:35:18: error: storage size of 'fhstat' isn't known
  struct fhstatus fhstat;
  ^~
./decode_mountd.c:45:29: error: 'MOUNTPROG' undeclared (first use in this 
function)
  msg.rm_call.cb_prog == MOUNTPROG &&
 ^
./decode_mountd.c:45:29: note: each undeclared identifier is reported only once 
for each function it appears in
./decode_mountd.c:46:29: error: 'MOUNTPROC_MNT' undeclared (first use in this 
function)
  msg.rm_call.cb_proc == MOUNTPROC_MNT) {
 ^
./decode_mountd.c:50:41: error: 'MOUNTVERS' undeclared (first use in this 
function)
xid_map_enter(msg.rm_xid, MOUNTPROG, MOUNTVERS,
 ^
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:25:0,
 from ./decode_nntp.c:14:
/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE 
are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^~~
./decode_mountd.c:61:8: warning: implicit declaration of function 
'xdr_fhstatus' [-Wimplicit-function-declaration]
if (xdr_fhstatus(, )) {
^~~~
gcc -g -O2 -fstack-protector-strong -Wformat -Werror=format-security 
-D_BSD_SOURCE -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H 
-DDSNIFF_LIBDIR=\"/usr/lib/x86_64-linux-gnu/\" -Wdate-time -D_FORTIFY_SOURCE=2 
-I. -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include  
-I./missing -c ./decode_pop.c
./decode_mountd.c:68:22: error: 'FHSIZE' undeclared (first use in this function)
  for (i = 0; i < FHSIZE; i++) {
  ^~
Makefile:78: recipe for target 'decode_mountd.o' failed
make[1]: *** [decode_mountd.o] Error 1
...
rpcgen -c mount.x -o mount.c
make[1]: Leaving directory '/build/1st/dsniff-2.4b1+debian'
dh_auto_build: make -j16 returned exit code 2
debian/rules:7: recipe for target 'build' failed
make: *** [build] Error 2


The problem is a race condition where decode_mountd.c includes
mount.h before rpcgen has finished generating it.

A fix is attached.
Description: Fix a parallel FTBFS
 Fix the Makefile dependencies to ensure that mount.h creation
 is finished before decode_mountd.o gets built.
Author: Adrian Bunk 

--- dsniff-2.4b1+debian.orig/Makefile.in
+++ dsniff-2.4b1+debian/Makefile.in
@@ -79,10 +79,14 @@ CONFIGS = dsniff.magic dsniff.services d
 
 all: $(PROGS)
 
-mount.c: mount.x
+mount.h: mount.x
rpcgen -h mount.x -o mount.h
+
+mount.c: mount.x mount.h
rpcgen -c mount.x -o mount.c
 
+decode_mountd.o: mount.h
+
 nfs_prot.c: nfs_prot.x
rpcgen -h nfs_prot.x -o nfs_prot.h
rpcgen -c nfs_prot.x -o nfs_prot.c