Re: [PATCH v2 1/3] git-svn: Support retrieving passwords with GIT_ASKPASS

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

 



2010/2/26 Junio C Hamano <gitster@xxxxxxxxx>:
> Frank Li <lznuaa@xxxxxxxxx> writes:
>
>> +if (! exists $ENV{GIT_ASKPASS}) {
>> +     if (exists $ENV{SSH_ASKPASS}) {
>> +             $ENV{GIT_ASKPASS} = $ENV{SSH_ASKPASS};
>> +             if ($^O eq 'msys') {
>> +                        $ENV{GIT_ASKPASS} =~ s/\\/\\\\/g;
>> +                        $ENV{GIT_ASKPASS} =~ s/(.*)/"$1"/;
>> +                }
>> +     }
>> +}
>
> I've seen this code before, and you may not be the best person to answer
> this question, but this worries me and puzzles me a bit.

Yes, I copy it from fall back SVN_SSH from GIT_SSH at git-svn.perl.

I guess it seems related with windows path using space, such as
c:\program files\bin\xxx.
perl Open ('$ENV{GIT_ASKPASS} |") will be changed to open("c:\program
files\bin\xxx |").
Perl will think c:\program as application, files\bin\xxx as first parameter.

So add ".  it equal to open ( "\"c:\program files\bin\xxx\" |"). perl
can run correct application.

>
> On msys (and nowhere else), SSH_ASKPASS can be used as given by the user
> to launch the prompter, but GIT_ASKPASS must be quoted in some funny way.
>
> Why is that?  Does this mean they must be given differently by the end
> user?  In other words, if the end user wants to set GIT_ASKPASS himself,
> s/he needs to do this funny quoting, that is different from SSH_ASKPASS.

I should add code to check if there are a space at GIT_ASKPASS,
if there are space in prompter path, add quote.
So end user set GIT_ASKPASS and SSH_ASKPASS at the same ways,  NO quoting.

>
> I also notice that git-gui has support for SSH_ASKPASS (and its own
> implementation).  Does it have the same quoting issues on msys?

I think no because msys add prompter to PATH environment and needn't
set full path.

>
> The reason I am asking is because:
>
>  (1) if SSH_ASKPASS and GIT_ASKPASS cannot be specified exactly the same
>     way, then [PATCH 3/3] would probably need a similar quoting magic?

SSH_ASKPASS and GIT_ASKPASS is the same.  C code needn't quoting
because start_command think $GIT_ASKPASS is full path and don't split
$GIT_ASKPASS to
application and parameter by space.

>
>  (2) With [PATCH 3/3], with quoting magic if necessary, we wouldn't need
>     the above hunk, as it has already be done by the "git" potty.
>

quoting magic is not necessary at PATCH 3/3.
--
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]