I recently ran into a problem with the postfix-2.0.9-get-FQDN.patch that is applied to the Postfix emerge. I'm including a patch to this patch that gives more meaningful error output; the error message "fatal: gethostbyname: Success" is not a very useful log message. In searching for the error, the only other users I found that experienced it were using Gentoo, so I feel this will be a worthwhile update that'll make future Gentoo users' lives easier. *** postfix-2.0.9-get-FQDN.patch.orig Mon Apr 28 13:32:07 2003 --- postfix-2.0.9-get-FQDN.patch Wed May 19 15:55:22 2004 *************** *** 22,28 **** namebuf[MAXHOSTNAMELEN] = 0; - if (valid_hostname(namebuf, DO_GRIPE) == 0) + if (!(hp = gethostbyname(namebuf))) ! + msg_fatal("gethostbyname: %m"); + if (valid_hostname(hp->h_name, DO_GRIPE) == 0) msg_fatal("unable to use my own hostname"); - my_host_name = mystrdup(namebuf); --- 22,28 ---- namebuf[MAXHOSTNAMELEN] = 0; - if (valid_hostname(namebuf, DO_GRIPE) == 0) + if (!(hp = gethostbyname(namebuf))) ! + msg_fatal("gethostbyname(\"%s\") does not resolve as a fully qualified domain name.", namebuf); + if (valid_hostname(hp->h_name, DO_GRIPE) == 0) msg_fatal("unable to use my own hostname"); - my_host_name = mystrdup(namebuf); Reproducible: Always Steps to Reproduce: 1. 2. 3. Actual Results: May 19 00:09:36 mail postfix/virtual[6922]: fatal: gethostbyname: Success May 19 00:09:37 mail postfix/qmgr[6138]: warning: premature end-of-input on private/virtual socket while read May 19 00:09:37 mail postfix/qmgr[6138]: warning: private/virtual socket: malformed response May 19 00:09:37 mail postfix/qmgr[6138]: warning: transport virtual failure -- see a previous warning/fatal/p em description May 19 00:09:37 mail postfix/master[6131]: warning: process /usr/lib/postfix/virtual pid 6922 exit status 1 Expected Results: May 19 00:09:36 mail postfix/virtual[6922]: fatal: gethostbyname("mail") does not resolve as a fully qualified domain name. May 19 00:09:37 mail postfix/qmgr[6138]: warning: premature end-of-input on private/virtual socket while read May 19 00:09:37 mail postfix/qmgr[6138]: warning: private/virtual socket: malformed response May 19 00:09:37 mail postfix/qmgr[6138]: warning: transport virtual failure -- see a previous warning/fatal/p em description May 19 00:09:37 mail postfix/master[6131]: warning: process /usr/lib/postfix/virtual pid 6922 exit status 1 Portage 2.0.50-r6 (default-amd64-2004.0, gcc-3.3.3, glibc-2.3.3_pre20040420-r0, 2.6.5-gentoo-r1) ================================================================= System uname: 2.6.5-gentoo-r1 x86_64 4 Gentoo Base System version 1.4.10 Autoconf: sys-devel/autoconf-2.58-r1 Automake: sys-devel/automake-1.8.3 ACCEPT_KEYWORDS="amd64" AUTOCLEAN="yes" CFLAGS="-march=athlon-xp -mmmx -msse2 -O3 -pipe -m64 -mfpmath=sse -fomit-frame-pointer" CHOST="x86_64-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=athlon-xp -mmmx -msse2 -O3 -pipe -m64 -mfpmath=sse -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache sandbox" GENTOO_MIRRORS="http://gentoo.oregonstate.edu http://distro.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="acl acpi amd64 apache2 apm arts avi crypt dedicated divx4linux dvb encode foomaticdb gdbm gif gpm imap imlib jpeg kde ldap libwww maildir mikmod motif mpeg mysql ncurses nls nogcj oggvorbis oss pam pdflib perl png python quicktime readline samba sasl sdl slang snmp speex spell ssl tcpd truetype vda vhosts xml2 xv zlib"
Ryan, in the future, please contribute patches as attachments. When you paste them into the bug comment, the whitespace is munged and the patch will no longer apply cleanly, which defeats the entire purpose of contributing the patch. In any case, I really like this suggestion. The "Success" error is ridiculous and confusing. The patch is our own, so it makes sense to make it a little more user-friendly. I have attached the updated postfix-2.0.9-get-FQDN.patch, because I don't like patches for patches. Also, I tested this change with complete success. Nice contribution, Ryan.
Created attachment 33292 [details, diff] files/postfix-2.0.9-get-FQDN.patch replaces existing files/postfix-2.0.9-get-FQDN.patch
Yea, I'll do that next time. This patches requires the server's hostname and DNS to be setup rigorously. Anyone that has an incorrect DNS/hostname setup will see this error.
Updated patch now in portage. Thank you for the research and the patch!