git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2] Make git send-email accept $EDITOR with arguments
@ 2007-12-21 21:37 Gustaf Hendeby
  0 siblings, 0 replies; 8+ messages in thread
From: Gustaf Hendeby @ 2007-12-21 21:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: luciano, git

Sorry Junio for the double, but I didn't mean to cut the CCs on this one.

On 2007-12-21 18:02, Junio C Hamano wrote:
> Gustaf Hendeby <hendeby@isy.liu.se> writes:
> 
>> Junio, even if this is technically not a bug fix, it would be nice to
>> get this fix into the 1.5.4 so that the usage of $EDITOR becomes more
>> consistent throughout git.
> 
> I can buy that, but at least a single line comment in front of that
> system() explaining why this is safe to do so would be beneficial.  I
> suspect that somebody would propose moving $compse_filename inside
> $GIT_DIR, now people realized $compose_filename is currently "./.msg.$$",
> and $GIT_DIR could be anything.  Quotemeta would probably be better as the
> code you are touching won't be affected by a future change to the value of
> that constant defined far away in the source.

Moving that file makes sense, I'll have a look at that, and do that as
well when I fix this patch.  After a first look at it though, I was
surprised to learn that git send-email actually wont work outside a
repository.  Ok, I can't really see any workflow where git send-email is
called from outside a git repository, but at the same time I don't see
why is should not be possible.  Are there any special reason for this?

Thanks,
	Gustaf

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: [PATCH] Make git send-email accept $EDITOR with arguments
@ 2007-12-20 20:32 Luciano Rocha
  2007-12-21 11:36 ` [PATCH v2] " Gustaf Hendeby
  0 siblings, 1 reply; 8+ messages in thread
From: Luciano Rocha @ 2007-12-20 20:32 UTC (permalink / raw)
  To: Gustaf Hendeby; +Cc: git, gitster

[-- Attachment #1: Type: text/plain, Size: 1349 bytes --]

On Thu, Dec 20, 2007 at 09:14:06PM +0100, Gustaf Hendeby wrote:
<snip>
> I'm not completely satisfied with the problem with embedded spaces,
> but my Perl skills aren't good enough to do anything about it.  If
> anyone have any suggestions on how to do it, it would be greatly
> appreciated.  None-the-less, even with this shortcoming, I think this
> is a step in the right direction.
> 
>  git-send-email.perl |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/git-send-email.perl b/git-send-email.perl
> index 248d035..47ae77c 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -400,7 +400,7 @@ EOT
>  	close(C);
>  
>  	my $editor = $ENV{GIT_EDITOR} || $repo->config("core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
> -	system($editor, $compose_filename);
> +	system((split ' ', $editor), $compose_filename);

That should be enough. Use system("$editor $compose_filename") to use
perl's implicit split or, in case of meta-characters in the string,
external sh -c.

Or always use the shell:
$shell = $ENV{SHELL} || "/bin/sh";
system($shell, "-c", "$editor $compose_filename");

BTW, maybe add a check for the return code?
system(...) == 0 or die "editor failed\n";

-- 
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-12-21 21:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-21 21:37 [PATCH v2] Make git send-email accept $EDITOR with arguments Gustaf Hendeby
  -- strict thread matches above, loose matches on Subject: below --
2007-12-20 20:32 [PATCH] " Luciano Rocha
2007-12-21 11:36 ` [PATCH v2] " Gustaf Hendeby
2007-12-21 13:34   ` Jeff King
2007-12-21 15:23     ` Gustaf Hendeby
2007-12-21 19:23       ` Jeff King
2007-12-21 21:07         ` Gustaf Hendeby
2007-12-21 21:17           ` Junio C Hamano
2007-12-21 17:02   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).