From: Jeff King Date: Thu, 24 Mar 2016 23:27:45 GMT Subject: Re: [PATCH/RFC] builtin/tag.c: move PGP verification inside builtin. Message-ID: <20160324232745.GA18499@sigill.intra.peff.net> In-Reply-To: <20160324223257.GE8830@LykOS> On Thu, Mar 24, 2016 at 06:32:58PM -0400, Santiago Torres wrote: > > But I notice that we already handle SIGPIPE explicitly in sign_buffer() > > for similar reasons. What I was wondering earlier was whether we should > > teach other functions that call gpg (like verify_signed_buffer()) to > > ignore SIGPIPE, too, so that we can return a reasonable error value > > rather than just killing the whole program. > > Now I get it I think this should be easy to achieve by moving > verify_tag() to tag.c, along with the static run_gpg_verify functions. Exactly. > I could move the SIGPIPE call inside the verify-tag command and patch up > everything accordingly. Does this sound ok? I think that works, but take note of two things: - convert it to sigchain_push(), and make sure you sigchain_pop() it when you are done, so that the caller retains their original SIGPIPE behavior after the function returns. See the example in sign_buffer(). - you should probably do it as close to the gpg call as possible, so as to affect as little code as possible. So probably in verify_signed_buffer(), not in verify_tag(). -Peff