git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Avoid warning when From: is encoded

From
PMPeter Valdemar Mørch <4ux6as402@sneakemail.com>
Date
Jul 25, 2008, 13:06 UTC
Message-ID
<1216991208-18782-1-git-send-email-4ux6as402@sneakemail.com>
From: Peter Valdemar Mørch <peter@morch.com>

In commit 0706bd19ef9b41e7519df2c73796ef93484272fd $1 is used from a regexp without using () to set up $1. Later, when that value was used, it caused a warning about a variable being undefined.

Signed-off-by: Peter Valdemar Mørch <peter@morch.com>
---
The commit introduces $body_encoding and: $body_encoding = $1; which is undef.
That commit then later uses $body_encoding only here:
+ if ($has_content_type) {
+         if ($body_encoding eq $author_encoding) {
+                 # ok, we already have the right encoding
+         }
+         else {
+                 # uh oh, we should re-encode
+         }
+ }
(I removed some whitespace for readability)

.. and it was the eq that gave the warning, because $body_encoding was undefined. Perhaps a better fix is to remove $body_encoding and regexp altogether since it isn't really used. Let me know if you think so.

This is where my non-commit message goes, yeah? I'm hand editing the output of 'git format-patch'...

Junio C. Hamano commented on a previous post that I shouldn't send patches as attachments so now I'm trying git-send-email. Are there any form problems with this patch?

 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 2e4a44a..d2fd899 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -882,7 +882,7 @@ foreach my $t (@files) {
 				}
 				elsif (/^Content-type:/i) {
 					$has_content_type = 1;
-					if (/charset="?[^ "]+/) {
+					if (/charset="?([^ "]+)/) {
 						$body_encoding = $1;
 					}
 					push @xh, $_;
-- 
1.6.0.rc0.46.g07955.dirty
Next: Abhijit Menon-Sen
Message 1 of 7 in “Avoid warning when From: is encoded”
  1. Avoid warning when From: is encodedPeter Valdemar Mørch, Jul 25, 2008
  2. Abhijit Menon-SenJul 25, 2008
  3. Sverre RabbelierJul 25, 2008
  4. Jon LoeligerJul 25, 2008
  5. Johannes SchindelinJul 26, 2008
  6. Junio C HamanoJul 25, 2008
  7. Jeff KingJul 25, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.