From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.204.20.129 with SMTP id f1cs13928bkb; Tue, 5 Oct 2010 04:27:00 -0700 (PDT) Received: by 10.231.146.134 with SMTP id h6mr11914764ibv.170.1286278019288; Tue, 05 Oct 2010 04:26:59 -0700 (PDT) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id gz42si15290873ibb.57.2010.10.05.04.26.58; Tue, 05 Oct 2010 04:26:59 -0700 (PDT) Received-SPF: pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-devel-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 6C0651858370; Tue, 5 Oct 2010 07:26:58 -0400 (EDT) Received: from smtp.chost.de (setoy.chost.de [217.160.209.225]) by rubyforge.org (Postfix) with ESMTP id 207DB1858373 for ; Tue, 5 Oct 2010 07:26:14 -0400 (EDT) Received: (qmail 16549 invoked by uid 5015); 5 Oct 2010 11:26:17 -0000 Received: (nullmailer pid 20558 invoked by uid 123); Tue, 05 Oct 2010 11:26:12 -0000 Received: from twin.sascha.silbe.org (twin.sascha.silbe.org [192.168.1.2]) by flatty.sascha.silbe.org ([192.168.1.252]) with SMTP via TCP; 05 Oct 2010 11:26:11 -0000 Received: (nullmailer pid 4718 invoked by uid 8193); Tue, 05 Oct 2010 11:26:11 -0000 From: Sascha Silbe To: sup-devel Date: Tue, 5 Oct 2010 13:25:33 +0200 Message-Id: <1286277933-4686-1-git-send-email-sascha-pgp@silbe.org> X-Mailer: git-send-email 1.7.1 Mail-Followup-To: Subject: [sup-devel] [PATCH] fix GPG "hang" on malformed PGP message (detached signature) X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Sascha Silbe , Sup developer discussion List-Id: Sup developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org A PGP message chunk (bounded by "-----BEGIN PGP MESSAGE-----" and "-----END PGP MESSAGE-----") can contain a detached signature. By default GPG will wait for the payload to be supplied on stdin if it gets passed a lone detached signature. To the user it will appear as GPG (or sup, since they don't see any output from GPG) hanging. The best way to solve this would be enabling batch mode, but then passphrase querying without gpg-agent wouldn't work anymore. So we resort to passing --multifile which has the side effect of not allowing detached signatures. Encountered and tested with message [1] on the git mailing list. [1] http://marc.info/?l=git&m=128623349711269&q=raw Signed-off-by: Sascha Silbe --- lib/sup/crypto.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb index 289fb0e..68a57c8 100644 --- a/lib/sup/crypto.rb +++ b/lib/sup/crypto.rb @@ -144,7 +144,7 @@ def decrypt payload, armor=false # a RubyMail::Message object output_fn = Tempfile.new "redwood.output" output_fn.close - message = run_gpg "--output #{output_fn.path} --skip-verify --yes --decrypt #{payload_fn.path}", :interactive => true + message = run_gpg "--output #{output_fn.path} --multifile --skip-verify --yes --decrypt #{payload_fn.path}", :interactive => true unless $?.success? info "Error while running gpg: #{message}" -- 1.7.1 _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel