Package: nbsmtp Version: 1.00-2 Severity: important Tags: patch Hi!
When trying to build your package on hurd-i386, this error is raised: > cc -Wall -pedantic -DPACKAGE_NAME=\"nbsmtp\" -DPACKAGE_TARNAME=\"nbsmtp\" > -DPACKAGE_VERSION=\"1.00\" -DPACKAGE_STRING=\"nbsmtp\ 1.00\" > -DPACKAGE_BUGREPORT=\"[EMAIL PROTECTED]" -DSTDC_HEADERS=1 > -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 > -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 > -DHAVE_UNISTD_H=1 -DHAVE_STDIO_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDLIB_H=1 > -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYS_PARAM_H=1 > -DHAVE_NETDB_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_FCNTL_H=1 -DHAVE_CTYPE_H=1 > -DHAVE_SYSLOG_H=1 -DHAVE_STRING_H=1 -DHAVE_PWD_H=1 -D_GNU_SOURCE=1 > -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_STDLIB_H=1 -DHAVE_REALLOC=1 > -DHAVE_STRFTIME=1 -DHAVE_VPRINTF=1 -DHAVE_GETHOSTBYNAME=1 > -DHAVE_GETHOSTNAME=1 -DHAVE_SOCKET=1 -DHAVE_STRDUP=1 -DHAVE_STRCASESTR=1 > -DHAVE_ASPRINTF=1 -DHAVE_MEMSET=1 -DHAVE_GETOPT=1 -DHAVE_STRSEP=1 > -DHAVE_INET6=1 -DHAVE_GETADDRINFO=1 -DSYSCONFDIR=\"/usr/etc\" -Wall -g -O2 > -c -o original.o original.c original.c: In function 'parse_options': > original.c:187: error: 'MAXHOSTNAMELEN' undeclared (first use in this > function) > original.c:187: error: (Each undeclared identifier is reported only once > original.c:187: error: for each function it appears in.) > make[1]: *** [original.o] Error 1 > make[1]: Leaving directory `/home/kibi/build/nbsmtp-1.00' > make: *** [build-stamp] Error 2 As briefly explained on debian-hurd port page[1], the unconditional use of MAXHOSTNAMELEN is a POSIX incompatibility. 1. http://www.debian.org/ports/hurd/hurd-devel-debian I hereby propose two patches. The first is just a workaround (ifndef/define to an arbitrary value) if you don't want to include the second, which fixes this incompatibility. Cheers, -- Cyril Brulebois
Index: build/nbsmtp-1.00/original.c =================================================================== --- build.orig/nbsmtp-1.00/original.c 1970-01-01 12:44:32.000000000 +0000 +++ build/nbsmtp-1.00/original.c 2006-07-25 14:49:48.000000000 +0000 @@ -43,6 +43,11 @@ #include "servinfo.h" #include "fileconfig.h" +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 64 +#endif + + /** * \brief Parses command line setting serverinfo members to its values. *
Index: build/nbsmtp-1.00/original.c =================================================================== --- build.orig/nbsmtp-1.00/original.c 1970-01-01 12:44:32.000000000 +0000 +++ build/nbsmtp-1.00/original.c 2006-07-25 16:24:03.000000000 +0000 @@ -184,15 +184,27 @@ /* If domain isn't specified, use machines hostname */ if (serverinfo->domain==NULL) { - if (gethostname(buffer,MAXHOSTNAMELEN)==-1) - { - perror("gethostname"); - return 1; - } - else + /* As a quick reminder: According to POSIX, MAXHOSTNAMELEN can be + * undefined, thus using a tiny loop around 'gethostname', beginning + * with a buffer size equal to a common MAXHOSTNAMELEN value + * (but it's an arbitrary value). + */ + int buffer_size = 64; + + while (gethostname(buffer, buffer_size)==-1) { - serverinfo->domain = (char *)strdup(buffer); + if (errno==ENAMETOOLONG) + { + buffer_size *= 2; + } + else + { + perror("gethostname"); + return 1; + } } + + serverinfo->domain = (char *)strdup(buffer); } /* If from address isn't specified, build up one */