Hello everyone (but especially Zimbra developers),

While undertaking the FreeBSD Patchset project I discovered a large number of deficiencies in the public Subversion repository for Zimbra that added unnecessary pain and suffering to the port. With the first attempt complete I can more completely catalog the issues I found and hope that you can remedy these problems.

In an attempt to ease the port I based my patches off the EDISON branch, hoping I could start from the 4.0.3GA source so that I could install a FreeBSD-ified 4.0.3GA and work from known functional source. There were a number of problems with that branch, which I detail below.

1) The source tree is incomplete and does not build.

There are missing pieces in the EDISON branch, so much so that it won't compile, even on a supported platform. I had to reconsititue large portions of ThirdParty (writing new Makefiles and guessing at configure options) plus copy files out of the binary distribution to bootstrap the build. There was no tag indicating the real 4.0.3GA sources either, which would be very handy for basing work off a known good starting point.

Here are the files and directories I had to either create by hand or copy from a binary distribution:

ThirdParty/rrdtool/Makefile
ThirdParty/mrtg/Makefile
ThirdParty/snmp/Makefile
ThirdParty/amavisd/Makefile
ThirdParty/PostFix/PostFix-2.2.9/qshape.pl
ZimbraServer/conf/my.cnf
ZimbraServer/conf/ldap/zimbra.schema
ZimbraServer/src/windows/ZCSImportWiz-4.0.3_GA_405.exe
ZimbraServer/src/windows/ZCSMigWiz-4.0.3_GA_405.exe

It would be a great boon to people tracking Subversion if the tree built on a supported platform out-of-box or if the build instructions indicated where things needed to be manually populated.

2) Shell scripts assume /bin/sh == /bin/bash.

This is a classic Linuxism. Please use /bin/bash when writing BASH shell scripts. A large number of the scripts in the bin directory have #!/bin/sh but the first thing they do is 'source file ..' which is a BASH-specific command. I patched everything to use /bin/bash it the patch -- please commit these changes. This will greatly ease ports to other non-Linux platforms (think Solaris).

3) C code includes deprecated malloc.h.

malloc.h is a deprecated header; stdlib.h is sufficient to get the malloc() family of functions. I had to patch all of the Zimbra .c files to remove that reference since FreeBSD has an #error clause in its malloc.h to ferret out abusers of the old API. The MacOS X man pages clearly say that only stdlib.h is required as well.

Please remove all references to malloc.h from your code. It is no longer necessary.

4) ThirdParty and main build configurations are decoupled.

The main problem this caused is the multiple definitions of MYSQL_VERSION that are sprayed around the tree because ThirdParty does not pull configuration data from ZimbraBuild/defs. More annoyingly there are things even inside the main build path that redefine MYSQL_VERSION on their own. And to top it off ...

5) Not all plat_common.def defintions are overridable from the platform-specific configuration.

Everything possible in plat_common.def should be defined with ?= so that the platform config can override it. MYSQL_VERSION was the major offender but there were other problems.


I invite Zimbra developers to study my patches and reconsititued files and use that information to make the Subversion repository complete and useful to everyone.

Thank you for your time.