From: Jeff King <peff@peff.net>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: Nicolas Pitre <nico@cam.org>, git@vger.kernel.org
Subject: Re: [PATCH, resent] fix openssl headers conflicting with custom SHA1 implementations
Date: Tue, 30 Sep 2008 23:47:12 -0400 [thread overview]
Message-ID: <20081001034712.GE24513@coredump.intra.peff.net> (raw)
In-Reply-To: <20080930205122.GO21310@spearce.org>
On Tue, Sep 30, 2008 at 01:51:22PM -0700, Shawn O. Pearce wrote:
> Yea, its a bit ugly due to the rats nest of system includes.
> Right now I don't see how we can include your patch, it breaks a
> major platform for us. But obviously my "fix" is also bogus and
> won't get ARM working again.
>
> Any other ideas we can try? 'cause I don't have any right now. :-|
I think you have an inherent conflict. Using openssl is going to end up
including their SHA definition, and we clearly can't include both..
Right now, you are trying to find a way to squeak by because imap-send
is the only thing that uses openssl, and it doesn't actually need our
SHA definition. But any solution that exploits that characteristic is
prone to failing later, when something _does_ need both of them.
You _could_ do something hack-ish like defining HEADER_SHA_H to avoid
theirs being loaded, but:
1. You are relying on their header guard never changing.
2. This actually leaves room for subtle problems, since some code
thinks a SHA_CTX is defined one way, and other code thinks it is
defined another way. If one piece of code passes a SHA_CTX to the
other (say another part of openssl), you risk invoking nasal
demons.
So I think the right way is probably to use a level of indirection. Turn
the ARM implementation into
void ARM_SHA1_Init()
and
#define SHA1_Init ARM_SHA1_Init
making sure not to allow such a macro to be in effect when including
openssl. This is similar to the way we override compat functions.
You can make it even simpler by just having all code call git_SHA1_Init,
and that will expand to whichever implementation has been chosen.
-Peff
next prev parent reply other threads:[~2008-10-01 3:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-30 20:22 [PATCH, resent] fix openssl headers conflicting with custom SHA1 implementations Nicolas Pitre
2008-09-30 20:39 ` Shawn O. Pearce
2008-09-30 20:46 ` Nicolas Pitre
2008-09-30 20:51 ` Shawn O. Pearce
2008-10-01 3:47 ` Jeff King [this message]
2008-10-01 15:54 ` Shawn O. Pearce
2008-10-01 16:04 ` Jeff King
2008-10-01 16:10 ` Shawn O. Pearce
2008-10-01 16:35 ` Nicolas Pitre
2008-10-01 16:39 ` Shawn O. Pearce
2008-10-01 18:05 ` [PATCH v2] " Nicolas Pitre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081001034712.GE24513@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=nico@cam.org \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).