quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Quilt-dev] [PATCH v3] quilt mail: Add way to sign mail with GPG


From: Andreas Gruenbacher
Subject: Re: [Quilt-dev] [PATCH v3] quilt mail: Add way to sign mail with GPG
Date: Wed, 12 Oct 2011 11:56:05 +0200

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 via email to

[Prev in Thread] Current Thread [Next in Thread]