Bug Description
Binary package hint: mtd-utils
We didn't find the mtd-utils package in Ubuntu intrepid.
We found this page (https://edge.launchpad.net/ubuntu/intrepid/+source/mtd-utils/20080508-1) that points a build fail.
In the following page we found the error: http://launchpadlibrarian.net/17423696/buildlog_ubuntu-intrepid-i386.mtd-utils_20080508-1_FAILEDTOBUILD.txt.gz
==============
recv_image.c: In function 'main':
recv_image.c:129: error: storage size of 'rq' isn't known
recv_image.c:129: warning: unused variable 'rq'
recv_image.c:311: warning: format '%08lx' expects type 'long unsigned int', but argument 2 has type 'uint32_t'
recv_image.c:311: warning: format '%08lx' expects type 'long unsigned int', but argument 3 has type 'uint32_t'
recv_image.c:311: warning: format '%08lx' expects type 'long unsigned int', but argument 4 has type 'uint32_t'
make[1]: *** [recv_image.o] Error 1
==============
We start to investigate and we found that the struct "struct ip_mreq" is defined in "#include <netinet/in.h>" only if "__USE_MISC or __USE_GNU" are defined.
But we cannot define one of them directly in recv_image.c as the header feature.h undefine them and it just redefine __USE_GNU if _GNU_SOURCE is defined. So we just need to define _GNU_SOURCE symbol.
We found the wrong define" #define _USE_MISC" (note the suffix _ instead of __) that is not being used for anything. So our patch switch the define from _USE_MISC to _GNU_SOURCE
There is a patch in upstream (http://git.infradead.org/mtd-utils.git?a=commitdiff;h=b995f89a81589be8d8a41c374a6df109d0ee12b3) to fix the same error BUT we think it's wrong to define "__USE_*" symbols, as <features.h> would undefine them. It is working just because the define is just before the <netinet/in.h> include.
Both patches have also a change in a printf line, just to remove some copiler warnings.
IS VERY important that mtd-utils package being included in universe repository again, we think many people use these tools. It includes, for instance, the binary mkfs.jffs2, very important to research in embedded systems.
Lauro Venancio <email address hidden> and Aloisio Almeida Jr <email address hidden> are the authors of this research and patch