Patch RFC: Broken compilation with Sun CC, missing include statement

ellie timoney ellie at fastmail.com
Thu Sep 17 20:54:19 EDT 2015


This is now in git on the cyrus-imapd-2.5 and master branches. :)

On Fri, Sep 18, 2015, at 10:31 AM, ellie timoney wrote:
> Hi Jens,
> 
> > After several hours of debugging, we traced it back to a missing include
> > statement in times.c (strings.h missing). This resulted in the Sun CC
> 
> strings.h (plural), or string.h (singular)?  Your email says strings.h
> but your patch adds string.h.
> 
> On Linux (which most of us use), string.h (singular) is automatically
> included by inclusion of memory.h, which lib/times.c includes.
> 
> Also on Linux, the strcasecmp and strncasecmp functions are defined in
> both string.h (singular) and strings.h (plural) for backward
> compatibility, though I believe POSIX puts these properly in strings.h
> (plural).  Given that string.h (singular) seems to be enough to fix
> things for you, even though lib/times.c uses strcasecmp, I guess the Sun
> compiler has the same backward compatibility.
> 
> But since we're depending on strchr (and friends) and strcasecmp, it's
> proper to explicitly include these headers.  So I'll apply your patch
> and also add strings.h (plural) at the same time.
> 
> Thanks,
> 
> ellie
> 
> On Thu, Sep 17, 2015, at 06:24 PM, Jens Erat wrote:
> > Dear Cyrus maintainers,
> > 
> > 
> > building Cyrus IMAP 2.5.6 on Solaris 11 using the Sun CC, I experienced
> > issues when acting as replication target with the sync server crashing
> > for mails containing US timezones.
> > 
> > After several hours of debugging, we traced it back to a missing include
> > statement in times.c (strings.h missing). This resulted in the Sun CC
> > falling back to some included function (thus compilation works), but
> > this one again is broken and returns 32 bit pointers instead of 64 bit
> > pointers in `strchr`.
> > 
> > In the end, two problems add up here:
> > 
> > - times.c trusting in strings.h already being included (which seemingly
> > is a false assumption considering the sync server)
> > - Sun CC probably being broken (we already issued a service request with
> > Oracle)
> > 
> > I attached a proposed patch adding an include statement in times.c,
> > maybe it should be put somewhere further up in the include chain instead.
> > 
> > Kind regards from Lake Constance, Germany,
> > Jens Erat
> > 
> > 
> > -- 
> > Jens Erat
> > Universität Konstanz
> > Kommunikations-, Infomations-, Medienzentrum (KIM)
> > Abteilung Basisdienste
> > D-78457 Konstanz
> > Mail: jens.erat at uni-konstanz.de
> > Email had 2 attachments:
> > + cyrus-imapd-2.5.6-patch-times-include.patch
> >   1k (text/x-patch)
> > + smime.p7s
> >   7k (application/pkcs7-signature)


More information about the Cyrus-devel mailing list