Re: [PATCHv4] Add contrib/credentials/netrc with GPG support

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

 



Ted Zlatanov <tzz@xxxxxxxxxxxx> writes:

> On Tue, 05 Feb 2013 11:53:20 -0800 Junio C Hamano <gitster@xxxxxxxxx> wrote: 
>
> I think it's more readable with large loops, and it actually makes sense
> when you read the code.  Not a big deal to me either, I just felt for
> this particular script it was OK.
>
>>> +	if ($file =~ m/\.gpg$/) {
>>> +		log_verbose("Using GPG to open $file");
>>> +		# GPG doesn't work well with 2- or 3-argument open
>
> JCH> If that is the case, please quote $file properly against shell
> JCH> munging it.
>
> Ahhh that gets ugly.  OK, quoted.
>
> JCH> The only thing you do on $io is to read from it via "while (<$io>)",
> JCH> so I would personally have written this part like this without
> JCH> having to use IO::File(), though:
>
> JCH> 	$io = open("-|", qw(gpg --decrypt), $file);
>
> That doesn't work for me, unfortunately.  I'm trying to avoid the IPC::*
> modules and such.  Please test it yourself with GPG.  I'm on Perl
> 5.14.2.

This works for me as expected (sorry for that open $io syntax
gotcha).

-- cut here -- >8 -- cut here --

#!/usr/bin/perl
my $io;
open $io, "-|", qw(gpg --decrypt), $ARGV[0]
        or die "$!: gpg open";
while (<$io>) {
        print;
}
close $io
        or die "$!: gpg close";

-- cut here -- 8< -- cut here --

$ perl --version
This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]