{"thread":{"id":"4771","subject":"Strange date format in git-send-email","startedAt":"2006-07-05T07:17:37Z","lastAt":"2006-07-07T20:01:34Z","messageCount":9,"participants":["Martijn Kuipers","Jakub Narebski","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"23266","messageId":"200607050817.37366.martijn.kuipers@lx.it.pt","threadId":"4771","inReplyTo":null,"subject":"Strange date format in git-send-email","fromName":"Martijn Kuipers","fromEmail":"martijn.kuipers@lx.it.pt","sentAt":"2006-07-05T07:17:37Z","receivedAt":"2006-07-05T07:17:37Z","isPatch":false,"sender":{"key":"martijn.kuipers@lx.it.pt","avatar":null},"body":"Dear list,\n\nMy email is sorted by date and a number of email-patches list the date format \nas unknown (in kmail, that is).\n\nWhen checking the headers of these mails I see the following pattern:\n\nDate: mer, 05 jui 2006 00:36:08 +0200\nX-Mailer: git-send-email 1.4.1\n\nDate: wto, 20 cze 2006 17:59:19 +0200\nX-Mailer: git-send-email 1.3.0\n\nDate: Tue, Mar 14 12:12:35 2006 -0500\nUser-Agent: send_patch 0.1\n\nDate: Tue Feb 7 18:21:02 2006 +0100\n\n\nSome of these are quite old, and it has been sometime since I last noticed it \n(I actually thought it was fixed). But today I received another patch-email \nfrom the list ([PATCH] Beautifulise git-show output), which showed the same \nproblem.\n\nIs this my problem (or kmail), or is there something funny with \ngit-send-email? I just don't git it.\n\nIf you need more info, just holler.\n\nKind regards,\nMartijn\n----------------------------------------------------------------------------------------------\nActually, did actually notice actually how many times non-native English \nspeaker actually use actually?\n"},{"id":"23272","messageId":"e8fv2o$khv$1@sea.gmane.org","threadId":"4771","inReplyTo":"200607050817.37366.martijn.kuipers@lx.it.pt","subject":"Re: Strange date format in git-send-email","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-07-05T09:00:13Z","receivedAt":"2006-07-05T09:00:13Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Martijn Kuipers wrote:\n\n> My email is sorted by date and a number of email-patches list the date format \n> as unknown (in kmail, that is).\n> \n> When checking the headers of these mails I see the following pattern:\n> \n> Date: mer, 05 jui 2006 00:36:08 +0200\n> X-Mailer: git-send-email 1.4.1\n> \n> Date: wto, 20 cze 2006 17:59:19 +0200\n> X-Mailer: git-send-email 1.3.0\n> \n> Date: Tue, Mar 14 12:12:35 2006 -0500\n> User-Agent: send_patch 0.1\n> \n> Date: Tue Feb 7 18:21:02 2006 +0100\n[...]\n> Is this my problem (or kmail), or is there something funny with \n> git-send-email? I just don't git it.\n\nYes, there was a problem with git-sen-email, namely it used strftime \nto print \"Date:\" header, but strftime is locale specific setting \n$ENV{LC_ALL} = 'C' is not enought.\n\nThere were two patches on the list: one hacky adding setlocale \ncall (not applied), second implementing rfc-822 date in Perl.\nShould be in current.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"23291","messageId":"7vlkr7bvc1.fsf@assigned-by-dhcp.cox.net","threadId":"4771","inReplyTo":"e8fv2o$khv$1@sea.gmane.org","subject":"Re: Strange date format in git-send-email","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-05T21:22:38Z","receivedAt":"2006-07-05T21:22:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> There were two patches on the list: one hacky adding setlocale \n> call (not applied), second implementing rfc-822 date in Perl.\n> Should be in current.\n\nWhat do you mean by \"should be in current\"?\n\nI specifically asked you about this issue a few days ago, even\nwith a patch to test out for people who are having problems, but\nhaven't heard back anything yet.  The issue is still on hold and\nnot in \"current\" as far as I am concerned.\n\n    To: Jakub Narebski <jnareb@gmail.com>\n    Cc: git@vger.kernel.org, Eric Wong <normalperson@yhbt.net>\n    From: Junio C Hamano <junkio@cox.net>\n    Subject: Re: [PATCH] send-email: Use setlocale in addition to\n        $ENV{LC_ALL} to set locale\n    Date: Sun, 02 Jul 2006 19:49:50 -0700\n    Message-ID: <7vd5cnv1v5.fsf@assigned-by-dhcp.cox.net>\n\n    I was reviewing old log and noticed this topic has never been\n    resolved.  Your proposal was to use POSIX::setlocale(), and\n    Eric's counter-proposal was to mimic what 822-date script does,\n    doing it by hand without mucking with locales, and the\n    discussion seemed to have died there.  Does this still need to\n    be addressed?\n\n    My gut feeling is that it would probably be less problematic if\n    we do not muck with locales at all (so drop POSIX::strftime as\n    well).\n\n    So maybe something like this (totally untested)?\n    ...\n"},{"id":"23384","messageId":"1152298675925-git-send-email-jnareb@gmail.com","threadId":"4771","inReplyTo":"7vlkr7bvc1.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] do not use locale specific strftime when preparing 2822 date","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-07-07T18:57:55Z","receivedAt":"2006-07-07T18:57:55Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Signed-off-by: Junio C Hamano <junkio@cox.net>\nAcked-by: Jakub Narebski <jnareb@gmail.com>\n---\nThis patch is sent from patched version of git-send-email.perl\nwith git tools 1.3.0. This patch is generated from current master\nafter Junio's patch \n  Message-ID: <7vd5cnv1v5.fsf@assigned-by-dhcp.cox.net>\napplied.\n\n git-send-email.perl |   41 ++++++++++++++++++++++++++++++++++++++---\n 1 files changed, 38 insertions(+), 3 deletions(-)\n\nf00ff14faf86c376d0ffb3cef24d2e5a5437dfcf\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex b04b8f4..c9c1975 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -34,8 +34,43 @@ sub readline {\n package main;\n \n # most mail servers generate the Date: header, but not all...\n-$ENV{LC_ALL} = 'C';\n-use POSIX qw/strftime/;\n+sub format_2822_time {\n+\tmy ($time) = @_;\n+\tmy @localtm = localtime($time);\n+\tmy @gmttm = gmtime($time);\n+\tmy $localmin = $localtm[1] + $localtm[2] * 60;\n+\tmy $gmtmin = $gmttm[1] + $gmttm[2] * 60;\n+\tif ($localtm[0] != $gmttm[0]) {\n+\t\tdie \"local zone differs from GMT by a non-minute interval\\n\";\n+\t}\n+\tif ((($gmttm[6] + 1) % 7) == $localtm[6]) {\n+\t\t$localmin += 1440;\n+\t} elsif ((($gmttm[6] - 1) % 7) == $localtm[6]) {\n+\t\t$localmin -= 1440;\n+\t} elsif ($gmttm[6] != $localtm[6]) {\n+\t\tdie \"local time offset greater than or equal to 24 hours\\n\";\n+\t}\n+\tmy $offset = $localmin - $gmtmin;\n+\tmy $offhour = $offset / 60;\n+\tmy $offmin = abs($offset % 60);\n+\tif (abs($offhour) >= 24) {\n+\t\tdie (\"local time offset greater than or equal to 24 hours\\n\");\n+\t}\n+\n+\treturn sprintf(\"%s, %2d %s %d %02d:%02d:%02d %s%02d%02d\",\n+\t\t       qw(Sun Mon Tue Wed Thu Fri Sat)[$localtm[6]],\n+\t\t       $localtm[3],\n+\t\t       qw(Jan Feb Mar Apr May Jun\n+\t\t\t  Jul Aug Sep Oct Nov Dec)[$localtm[4]],\n+\t\t       $localtm[5]+1900,\n+\t\t       $localtm[2],\n+\t\t       $localtm[1],\n+\t\t       $localtm[0],\n+\t\t       ($offset >= 0) ? '+' : '-',\n+\t\t       abs($offhour),\n+\t\t       $offmin,\n+\t\t       );\n+}\n \n my $have_email_valid = eval { require Email::Valid; 1 };\n my $smtp;\n@@ -387,7 +422,7 @@ sub send_message\n \tmy @recipients = unique_email_list(@to);\n \tmy $to = join (\",\\n\\t\", @recipients);\n \t@recipients = unique_email_list(@recipients,@cc,@bcclist);\n-\tmy $date = strftime('%a, %d %b %Y %H:%M:%S %z', localtime($time++));\n+\tmy $date = format_2822_time($time++);\n \tmy $gitversion = '@@GIT_VERSION@@';\n \tif ($gitversion =~ m/..GIT_VERSION../) {\n \t    $gitversion = `git --version`;\n-- \n1.3.0\n"},{"id":"23385","messageId":"e8mb4l$t1u$1@sea.gmane.org","threadId":"4771","inReplyTo":"1152298675925-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH] do not use locale specific strftime when preparing 2822 date","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-07-07T19:03:02Z","receivedAt":"2006-07-07T19:03:02Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"It looks like it is _almost_ correct. It should be\n  Date: Fri, 07 Jul 2006 20:57:55 +0200\ninstead of\n  Date: Fri,  7 Jul 2006 20:57:55 +0200\n\nIt is \"day = ([FWS] 1*2DIGIT) / obs-day\" in RFC2822.\n\n-- \nJakub Narebski\n"},{"id":"23386","messageId":"7vzmflw7vd.fsf@assigned-by-dhcp.cox.net","threadId":"4771","inReplyTo":"1152298675925-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH] do not use locale specific strftime when preparing 2822 date","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-07T19:08:22Z","receivedAt":"2006-07-07T19:08:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Signed-off-by: Junio C Hamano <junkio@cox.net>\n> Acked-by: Jakub Narebski <jnareb@gmail.com>\n> ---\n> This patch is sent from patched version of git-send-email.perl\n> with git tools 1.3.0. This patch is generated from current master\n> after Junio's patch \n>   Message-ID: <7vd5cnv1v5.fsf@assigned-by-dhcp.cox.net>\n> applied.\n\nGood test.  Thanks.\n"},{"id":"23390","messageId":"7vveq9w736.fsf@assigned-by-dhcp.cox.net","threadId":"4771","inReplyTo":"e8mb4l$t1u$1@sea.gmane.org","subject":"Re: [PATCH] do not use locale specific strftime when preparing 2822 date","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-07T19:25:17Z","receivedAt":"2006-07-07T19:25:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> It looks like it is _almost_ correct. It should be\n>   Date: Fri, 07 Jul 2006 20:57:55 +0200\n> instead of\n>   Date: Fri,  7 Jul 2006 20:57:55 +0200\n>\n> It is \"day = ([FWS] 1*2DIGIT) / obs-day\" in RFC2822.\n\nI think you are reading ABNF wrong. <a>*<b>element means at least\n<a> times and at most <b> times occurrences of element.  Exact\nnumber of repetition is written as <n>element (which is a\nshort-and for <n>*<n>element).\n\nSee the definition of \"hour\" and friends a few lines below what\nyou quoted.  It is defined as \"2DIGIT / obs-hour\" and that is\nwhy we say \"01:23:45\" not \"1:23:45\"\n"},{"id":"23392","messageId":"e8me2l$8ur$1@sea.gmane.org","threadId":"4771","inReplyTo":"7vveq9w736.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] do not use locale specific strftime when preparing 2822 date","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-07-07T19:53:11Z","receivedAt":"2006-07-07T19:53:11Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n>> It looks like it is _almost_ correct. It should be\n>>   Date: Fri, 07 Jul 2006 20:57:55 +0200\n>> instead of\n>>   Date: Fri,  7 Jul 2006 20:57:55 +0200\n>>\n>> It is \"day = ([FWS] 1*2DIGIT) / obs-day\" in RFC2822.\n> \n> I think you are reading ABNF wrong. [...]\n> \n> See the definition of \"hour\" and friends a few lines below what\n> you quoted.  It is defined as \"2DIGIT / obs-hour\" and that is\n> why we say \"01:23:45\" not \"1:23:45\"\n\nBut it is \"day = [...] 2DIGIT [...]\"! \n\nBesides, that what other mailers do (I checked the post I replied via\ngit-send-email to, i.e. your post). Although I don't think that it can\ncause any problems, like using locale date with non US-ASCII characters\ndid...\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"23395","messageId":"e8meic$8ur$3@sea.gmane.org","threadId":"4771","inReplyTo":"7vzmflw7vd.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] do not use locale specific strftime when preparing 2822 date","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-07-07T20:01:34Z","receivedAt":"2006-07-07T20:01:34Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n>> Signed-off-by: Junio C Hamano <junkio@cox.net>\n>> Acked-by: Jakub Narebski <jnareb@gmail.com>\n>> ---\n>> This patch is sent from patched version of git-send-email.perl\n>> with git tools 1.3.0. This patch is generated from current master\n>> after Junio's patch \n>>   Message-ID: <7vd5cnv1v5.fsf@assigned-by-dhcp.cox.net>\n>> applied.\n> \n> Good test.  Thanks.\n\nBy the way, patch didn't apply cleanly (some fuzz was used).\nThe patch I send was from _applied_ (to master) patch.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"}]}