[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

building Zmailer-2.99.50s11 on Solaris 2.6, gcc 2.8.1



A code problem?

I've been experiencing some difficulties trying to get a new install of
Zmailer working on one of my machines.

Hardware: Sun Ultra 5
O/S: Solaris 2.6
Compiler: gcc 2.8.1
Configure: ./configure  --with-bundled-libresolv --prefix=/Zmailer
--with-logdir=/Zmailer/logs --with-gcc

Minor Problem:
In libresolv/portability.h, gethostname() is defined with conflicting
types, so the 'make' bombs until I comment out the redeclaration. This is
ok, as the types amount to the same thing.

After that, everything compiles and installs a-ok.  I have enabled all of
the default proto/* config files and customized the policy database.

The smtpserver accepts messages, and the router routes them, however, when
a message makes it to the smtp transport agent, the message will only
deliver if the addressed domain has a DNS A record.  MX records are not
processed.

Major headache:
After much frustration, and lots of debug statements, I narrowed the
problem down to the 'noMX' variable.  The noMX variable was being set to 1
by a side effect, not by direct assignment.  (The only direct assignments
to this variable are the initialization 'int noMX = 0', and when the '-e'
command line parameter is given).  Anyway, placing assert(noMX==0)
statements in the code narrowed the change in value down to the following
line in smtp.c:

zmailer-2-cvs/transports/smtp/smtp.c : line 631
 & oldsig; /* volatile-like trick.. */ & channel; & host; & smtpstatus; &
need_host; & idle; &noMX; & dp; & checkmx; & smtphost; & punthost;

placing an 'assert(noMX==0)' before and after this line illustrated that
the value of 'noMX' was being changed by line 631 (it was actually being
set to '1', which explains why no MX processing was happening).  I'm not
familar with the purpose of this "volatile-like trick", but gcc doesn't
seem to do what is intended.  Is this trying to trick the optimizer?

The workaround is to comment out line 631, seeing as how the address
operator is just being used by it's self--no explicit assignments or
changes...
then everything works fine.  MX hosts are processed and all is well.

I did another experiment suspecting the compiler's optimization, leaving
line 631 in the code, and compiling 'smtp' without any optimization, but
that just caused a different failure.

Everything is working now, but I am wondering if anyone else has
experienced this kind of thing?  I suspect it is a 'gcc' problem, but does
line 631 add any value to the performance?

(btw, I originally thought that it might be a problem with the newer code
(s11), so I tried running 2.99.50s8 and 2.99.50s10 and had the exact same
problem.)

Anyway, I might save someone from the frustrations I had ;)


Shawn Robinson