lkml.org 
[lkml]   [2011]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3] quilt mail: Add way to sign mail with GPG
From
Date
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



\
 
 \ /
  Last update: 2011-10-12 11:59    [W:0.047 / U:11.976 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site