public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <andreas.gruenbacher@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	quilt-dev <quilt-dev@nongnu.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: Re: [PATCH v3] quilt mail: Add way to sign mail with GPG
Date: Wed, 12 Oct 2011 11:56:05 +0200	[thread overview]
Message-ID: <1318413367.24907.15.camel@schurl.linbit> (raw)
In-Reply-To: <1318381107.7904.191.camel@gandalf.stny.rr.com>

On Tue, 2011-10-11 at 20:58 -0400, Steven Rostedt wrote:
> On Wed, 2011-10-12 at 02:32 +0200, Andreas Gruenbacher wrote:
> > Steve,
> > 
> > On Mon, 2011-10-10 at 12:08 -0400, Steven Rostedt wrote:
> > > +my $tmpfile = "/tmp/gpgmail.$$";
> > > +
> > > +open(TMP, ">", $tmpfile) or die "Can't create a temporary file";
> > 
> > That's not an appropriate way to create a temp file ... do we need a
> > temp file in the first place though?
> 
> OK, what's the "appropriate" way?

One that doesn't introduce a temp file vulnerability, for example using
File::Temp.

But ...

> As for removing the temp file, I just found it was the easiest way to
> pipe into gpg. If there's a better way to do that, I'm all ears.

... how about this approach?

    my @lines = <>;
    map { print } @lines;
    print "\n";

    #-----------------------------------------------

    sub crlf($) {
        my $_ = shift;
        #s/\n$/\r\n/;
        s/^/> /;
        return $_;
    }

    my $command = 'tr a-z A-Z';
    open(PIPE, "| $command")
        or die "$command: $!\n";
    foreach my $line (@lines) {
        print PIPE crlf($line);
    }
    close PIPE
        or die "$command: $!\n";

> > What's going on with "\r\n" line endings all over the script?  Can't the
> > "\n" line endings be converted to "\r\n" in a single place instead?
> > 
> > 	foreach my $line (@lines) {
> > 	    $_ = $line; s/\n$/\r\n/; print;
> > 	}
> 
> gpg email sigs requires that the lines it process end with a \r\n even
> when the lines do not. But I also find that this makes the patch ugly.
> We could try to keep it, but the biggest stumbling block I had in
> getting the signatures to work was the stupid \r\n manipulations :-p

I can see why this is needed, I just don't like to have it spread out
over the entire code and converting @lines forth and back :)

Thanks,
Andreas


  reply	other threads:[~2011-10-12  9:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-10 16:08 [PATCH v3] quilt mail: Add way to sign mail with GPG Steven Rostedt
2011-10-12  0:32 ` Andreas Gruenbacher
2011-10-12  0:58   ` Steven Rostedt
2011-10-12  9:56     ` Andreas Gruenbacher [this message]
2011-10-12 18:57       ` H. Peter Anvin

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=1318413367.24907.15.camel@schurl.linbit \
    --to=andreas.gruenbacher@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@suse.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=quilt-dev@nongnu.org \
    --cc=rostedt@goodmis.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