public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jim Meyering <jim@meyering•net>
To: git@vger•kernel.org
Subject: [PATCH] Don't use $author_name undefined when $from contains no /\s</.
Date: Thu, 19 Oct 2006 10:33:01 +0200	[thread overview]
Message-ID: <87vemgn1s2.fsf@rho.meyering.net> (raw)

I noticed a case not handled in a recent patch.
Demonstrate it like this:

  $ touch new-file
  $ git-send-email --dry-run --from j --to k new-file 2>err
  new-file
  OK. Log says:
  Date: Thu, 19 Oct 2006 10:26:24 +0200
  Sendmail: /usr/sbin/sendmail
  From: j
  Subject:
  Cc:
  To: k

  Result: OK
  $ cat err
  Use of uninitialized value in pattern match (m//) at /p/bin/git-send-email line 416.
  Use of uninitialized value in concatenation (.) or string at /p/bin/git-send-email line 420.
  Use of uninitialized value in concatenation (.) or string at /p/bin/git-send-email line 468.

There's a patch for the $author_name part below.

The example above shows that $subject may also be used uninitialized.
That should be easy to fix, too.

Signed-off-by: Jim Meyering <jim@meyering•net>
---
 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 b17d261..1c6d2cc 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -412,7 +412,7 @@ sub send_message
 	}

 	my ($author_name) = ($from =~ /^(.*?)\s+</);
-	if ($author_name =~ /\./ && $author_name !~ /^".*"$/) {
+	if ($author_name && $author_name =~ /\./ && $author_name !~ /^".*"$/) {
 		my ($name, $addr) = ($from =~ /^(.*?)(\s+<.*)/);
 		$from = "\"$name\"$addr";
 	}
--
1.4.3.g72bb

             reply	other threads:[~2006-10-19  8:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-19  8:33 Jim Meyering [this message]
2006-10-19 16:19 ` [PATCH] Don't use $author_name undefined when $from contains no /\s</ Junio C Hamano
2006-10-19 18:16   ` Jim Meyering
2006-10-19 19:03     ` Junio C Hamano
2006-10-19 21:28       ` Paul Eggert
2006-10-19 21:34         ` Junio C Hamano
2006-10-19 23:48           ` Paul Eggert
2006-10-20  7:52             ` Junio C Hamano
2006-10-20 16:21               ` Linus Torvalds
2006-10-20 15:48             ` Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vemgn1s2.fsf@rho.meyering.net \
    --to=jim@meyering$(echo .)net \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox