Re: Re* [PATCH] send-email: recognize absolute path on Windows

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: Re* [PATCH] send-email: recognize absolute path on Windows

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:00:42

Junio C Hamano [off-list ref] writes:
quoted hunk
Thanks, both.  I'd expect another round then?

-- >8 --
From: Erik Faye-Lund <redacted>

On Windows, absolute paths might start with a DOS drive prefix,
which these checks fail to recognize.

Use file_name_is_absolute from File::Spec::Functions for
portability.  The Perl module msysgit has been shipping needs to be
updated for this patch to work, though.

Signed-off-by: Erik Faye-Lund <redacted>
Helepd-by: Johannes Sixt [off-list ref]
---

 git-send-email.perl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index fdb0029..eda3917 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -25,7 +25,7 @@
 use Data::Dumper;
 use Term::ANSIColor;
 use File::Temp qw/ tempdir tempfile /;
-use File::Spec::Functions qw(catfile);
+use File::Spec::Functions qw(catfile file_name_is_absolute);
 use Error qw(:try);
 use Git;
 
@@ -1197,7 +1197,7 @@ sub send_message {
 
 	if ($dry_run) {
 		# We don't want to send the email.
-	} elsif ($smtp_server =~ m#^/#) {
+	} elsif (file_name_is_absolute($smtp_server)) {
 		my $pid = open my $sm, '|-';
 		defined $pid or die $!;
 		if (!$pid) {
@@ -1271,7 +1271,7 @@ sub send_message {
 		printf (($dry_run ? "Dry-" : "")."Sent %s\n", $subject);
 	} else {
 		print (($dry_run ? "Dry-" : "")."OK. Log says:\n");
-		if ($smtp_server !~ m#^/#) {
+		if (file_name_is_absolute($smtp_server)) {
Obviously this has to be "!file_name_is_absolute($smtp_server)" ;-)
 			print "Server: $smtp_server\n";
 			print "MAIL FROM:<$raw_from>\n";
 			foreach my $entry (@recipients) {

-- 
-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Re* [PATCH] send-email: recognize absolute path on Windows

From: Erik Faye-Lund <hidden>
Date: 2016-06-15 23:00:42

On Tue, Apr 15, 2014 at 10:37 PM, Junio C Hamano [off-list ref] wrote:
Junio C Hamano [off-list ref] writes:
quoted
Thanks, both.  I'd expect another round then?

-- >8 --
From: Erik Faye-Lund <redacted>

On Windows, absolute paths might start with a DOS drive prefix,
which these checks fail to recognize.

Use file_name_is_absolute from File::Spec::Functions for
portability.  The Perl module msysgit has been shipping needs to be
updated for this patch to work, though.

Signed-off-by: Erik Faye-Lund <redacted>
Helepd-by: Johannes Sixt [off-list ref]
---

 git-send-email.perl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index fdb0029..eda3917 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -25,7 +25,7 @@
 use Data::Dumper;
 use Term::ANSIColor;
 use File::Temp qw/ tempdir tempfile /;
-use File::Spec::Functions qw(catfile);
+use File::Spec::Functions qw(catfile file_name_is_absolute);
 use Error qw(:try);
 use Git;
@@ -1197,7 +1197,7 @@ sub send_message {

      if ($dry_run) {
              # We don't want to send the email.
-     } elsif ($smtp_server =~ m#^/#) {
+     } elsif (file_name_is_absolute($smtp_server)) {
              my $pid = open my $sm, '|-';
              defined $pid or die $!;
              if (!$pid) {
@@ -1271,7 +1271,7 @@ sub send_message {
              printf (($dry_run ? "Dry-" : "")."Sent %s\n", $subject);
      } else {
              print (($dry_run ? "Dry-" : "")."OK. Log says:\n");
-             if ($smtp_server !~ m#^/#) {
+             if (file_name_is_absolute($smtp_server)) {
Obviously this has to be "!file_name_is_absolute($smtp_server)" ;-)
Heh, yeah. Apart from that, your patch is identical to mine. But, ugh.
Modifying File::Spec into thinking msys is Win32 doesn't seems to
work, as I get other random path-errors in that case:

"Error in tempdir() using \tmp\XXXXXXXXXX: Parent directory (\tmp) is
not a directory at /libexec/git-core/git-send-email line 554"

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help