* Re: [PATCH 1/3] gitweb: whitespace cleanup [not found] ` <11508760842024-git-send-email-jnareb@gmail.com> @ 2006-06-21 8:05 ` Jakub Narebski 0 siblings, 0 replies; 8+ messages in thread From: Jakub Narebski @ 2006-06-21 8:05 UTC (permalink / raw) To: git; +Cc: Junio C Hamano Jakub Narebski <jnareb@gmail.com> wrote: > > Signed-off-by: Jakub Narebski <jnareb.com> It should be of course Signed-off-by: Jakub Narebski <jnareb@gmail.com> Somehow cover letter got lost, and patches did not appear on mailing list archives. If the mail will not appear in few hours, I'll resend it to mailing list only. Probably because git-send-email should ensure LC_ALL=C for Date: header generation... -- Jakub Narebski ShadeHawk on #git ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] Minor gitweb modifications and cleanups [not found] <11508760843417-git-send-email-jnareb@gmail.com> [not found] ` <11508760842024-git-send-email-jnareb@gmail.com> @ 2006-06-21 9:04 ` Junio C Hamano 2006-06-21 9:12 ` [PATCH] send-email: Use setlocale in addition to $ENV{LC_ALL} to set locale Jakub Narebski 1 sibling, 1 reply; 8+ messages in thread From: Junio C Hamano @ 2006-06-21 9:04 UTC (permalink / raw) To: Jakub Narebski; +Cc: git Jakub Narebski <jnareb@gmail.com> writes: > This series of patches is based on git.git 'next' branch > 69d830d1a3a1236036bd0f84dd9794d7c8d34b3f > > My future gitweb-related batches will be based on this series. > > --- > > gitweb/gitweb.cgi | 53 +++++++++++++++++++++++++++++++---------------------- > gitweb/gitweb.css | 4 ++-- > 2 files changed, 33 insertions(+), 24 deletions(-) > > -- > Jakub Narebski > Poland All three applied cleanly (finally!), but with hand munging of Date: field. I think git-send-email should internally do LC_ALL=C or stop using strftime() or both. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] send-email: Use setlocale in addition to $ENV{LC_ALL} to set locale 2006-06-21 9:04 ` [PATCH 0/3] Minor gitweb modifications and cleanups Junio C Hamano @ 2006-06-21 9:12 ` Jakub Narebski 2006-06-21 10:33 ` Jakub Narebski 0 siblings, 1 reply; 8+ messages in thread From: Jakub Narebski @ 2006-06-21 9:12 UTC (permalink / raw) To: git; +Cc: Jakub Narebski $ENV{LC_ALL} = 'C'; does not change locale used by strftime. Use setlocale( LC_ALL, 'C' ); instead. Signed-off-by: Jakub Narebski <jnareb@gmail.com> --- git-send-email.perl | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) 7c796152570e28d3f95c17e93864c6abc8edef24 diff --git a/git-send-email.perl b/git-send-email.perl index 7b1cca7..56949dd 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -24,7 +24,8 @@ use Data::Dumper; # most mail servers generate the Date: header, but not all... $ENV{LC_ALL} = 'C'; -use POSIX qw/strftime/; +use POSIX qw/strftime setlocale LC_ALL/; +setlocale( &LC_ALL, 'C' ); my $have_email_valid = eval { require Email::Valid; 1 }; my $smtp; -- 1.3.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] send-email: Use setlocale in addition to $ENV{LC_ALL} to set locale 2006-06-21 9:12 ` [PATCH] send-email: Use setlocale in addition to $ENV{LC_ALL} to set locale Jakub Narebski @ 2006-06-21 10:33 ` Jakub Narebski 2006-06-21 10:49 ` Eric Wong 0 siblings, 1 reply; 8+ messages in thread From: Jakub Narebski @ 2006-06-21 10:33 UTC (permalink / raw) To: git Jakub Narebski wrote: > $ENV{LC_ALL} = 'C'; does not change locale used by strftime. > Use setlocale( LC_ALL, 'C' ); instead. > # most mail servers generate the Date: header, but not all... > $ENV{LC_ALL} = 'C'; > -use POSIX qw/strftime/; > +use POSIX qw/strftime setlocale LC_ALL/; > +setlocale( &LC_ALL, 'C' ); Perhaps instead of setlocale( &LC_ALL, 'C' ); we should use setlocale( &LC_ALL, '' ); (i.e. set the LC_ALL behaviour according to the locale environment variables). I'm not that versed in locale, POSIX and Perl. -- Jakub Narebski Warsaw, Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] send-email: Use setlocale in addition to $ENV{LC_ALL} to set locale 2006-06-21 10:33 ` Jakub Narebski @ 2006-06-21 10:49 ` Eric Wong 2006-06-21 11:18 ` Jakub Narebski 2006-07-03 2:49 ` Junio C Hamano 0 siblings, 2 replies; 8+ messages in thread From: Eric Wong @ 2006-06-21 10:49 UTC (permalink / raw) To: Jakub Narebski; +Cc: git Jakub Narebski <jnareb@gmail.com> wrote: > Jakub Narebski wrote: > > > $ENV{LC_ALL} = 'C'; does not change locale used by strftime. > > Use setlocale( LC_ALL, 'C' ); instead. > > > # most mail servers generate the Date: header, but not all... > > $ENV{LC_ALL} = 'C'; > > -use POSIX qw/strftime/; > > +use POSIX qw/strftime setlocale LC_ALL/; > > +setlocale( &LC_ALL, 'C' ); > > Perhaps instead of > setlocale( &LC_ALL, 'C' ); > we should use > setlocale( &LC_ALL, '' ); > (i.e. set the LC_ALL behaviour according to the locale environment > variables). I'm not that versed in locale, POSIX and Perl. I'm responsible for the $ENV{LC_ALL} = 'C' setting but I never actually tested how things would work with a non-English locale (not being well-versed in these things myself, either). I've always wondered about why /usr/bin/822-date existed without strftime on my Debian systems but never bothered asking, I guess this could be a good reason why... For reference, here's the /usr/bin/822-date script (trailing whitespace fixed): ------- 8< ------- #!/usr/bin/perl -- # I hereby place this in the public domain - Ian Jackson, 1995. # Changes by Klee Dienes also placed in public domain (1997). # time structure: # [ sec min hour mday mon year wday yday isdst ] @ARGV && die "usage: 822-date\n"; $curtime = time; @localtm = localtime ($curtime); $localtms = localtime ($curtime); @gmttm = gmtime ($curtime); $gmttms = gmtime ($curtime); if ($localtm[0] != $gmttm[0]) { die (sprintf ("local timezone differs from GMT by a non-minute interval\n" . "local time: %s\n" . "GMT time: %s\n", $localtms, $gmttms)); } $localmin = $localtm[1] + $localtm[2] * 60; $gmtmin = $gmttm[1] + $gmttm[2] * 60; if ((($gmttm[6] + 1) % 7) == $localtm[6]) { $localmin += 1440; } elsif ((($gmttm[6] - 1) % 7) == $localtm[6]) { $localmin -= 1440; } elsif ($gmttm[6] == $localtm[6]) { 1; } else { die ("822-date: local time offset greater than or equal to 24 hours\n"); } $offset = $localmin - $gmtmin; $offhour = $offset / 60; $offmin = abs ($offset % 60); if (abs ($offhour) >= 24) { die ("822-date: local time offset greater than or equal to 24 hours\n"); } printf ( "%s, %2d %s %d %02d:%02d:%02d %s%02d%02d\n", (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$localtm[6]], # day of week $localtm[3], # day of month (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$localtm[4]], # month $localtm[5]+1900, # year $localtm[2], # hour $localtm[1], # minute $localtm[0], # sec ($offset >= 0) ? '+' : '-',# TZ offset direction abs ($offhour), # TZ offset hour $offmin, # TZ offset minute ) || die "822-date: output error: $!\n"; ------- 8< ------- -- Eric Wong ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] send-email: Use setlocale in addition to $ENV{LC_ALL} to set locale 2006-06-21 10:49 ` Eric Wong @ 2006-06-21 11:18 ` Jakub Narebski 2006-07-03 2:49 ` Junio C Hamano 1 sibling, 0 replies; 8+ messages in thread From: Jakub Narebski @ 2006-06-21 11:18 UTC (permalink / raw) To: git Eric Wong wrote: > Jakub Narebski <jnareb@gmail.com> wrote: >> >>> $ENV{LC_ALL} = 'C'; does not change locale used by strftime. >>> Use setlocale( &LC_ALL, 'C' ); instead. > I'm responsible for the $ENV{LC_ALL} = 'C' setting but I never actually > tested how things would work with a non-English locale (not being > well-versed in these things myself, either). It looks like I have broken locale badly somewhat, as I yesterday sent patches successfully without the patch. I suspect that sendmail removes incorrect Date: header and adds it's own... unless Date: header contains characters outside US-ASCII. It means that sendmail can deal with Date: wto, 20 cze 2006 13:14:11 +0200 instead of correct Date: Tue, 20 Jun 2006 13:14:11 +0200 but cannot deal with (iso-8859-2 encoded I think) Date: ¶ro, 21 cze 2006 09:48:02 +0200 from git-send-email.perl without patch, instead of correct Date: Wed, 21 Jun 2006 11:25:52 +0200 with the patch. -- Jakub Narebski Warsaw, Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] send-email: Use setlocale in addition to $ENV{LC_ALL} to set locale 2006-06-21 10:49 ` Eric Wong 2006-06-21 11:18 ` Jakub Narebski @ 2006-07-03 2:49 ` Junio C Hamano 1 sibling, 0 replies; 8+ messages in thread From: Junio C Hamano @ 2006-07-03 2:49 UTC (permalink / raw) To: Jakub Narebski; +Cc: git, Eric Wong I was reviewing old log and noticed this topic has never been resolved. Your proposal was to use POSIX::setlocale(), and Eric's counter-proposal was to mimic what 822-date script does, doing it by hand without mucking with locales, and the discussion seemed to have died there. Does this still need to be addressed? My gut feeling is that it would probably be less problematic if we do not muck with locales at all (so drop POSIX::strftime as well). So maybe something like this (totally untested)? -- >8 -- [PATCH] do not use locale specific strftime when preparing 2822 date Signed-off-by: Junio C Hamano <junkio@cox.net> --- diff --git a/git-send-email.perl b/git-send-email.perl index c5d9e73..bc42761 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -23,8 +23,43 @@ use Getopt::Long; use Data::Dumper; # most mail servers generate the Date: header, but not all... -$ENV{LC_ALL} = 'C'; -use POSIX qw/strftime/; +sub format_2822_time { + my ($time) = @_; + my @localtm = localtime($time); + my @gmttm = gmtime($time); + my $localmin = $localtm[1] + $localtm[2] * 60; + my $gmtmin = $gmttm[1] + $gmttm[2] * 60; + if ($localtm[0] != $gmttm[0]) { + die "local zone differs from GMT by a non-minute interval\n"; + } + if ((($gmttm[6] + 1) % 7) == $localtm[6]) { + $localmin += 1440; + } elsif ((($gmttm[6] - 1) % 7) == $localtm[6]) { + $localmin -= 1440; + } elsif ($gmttm[6] != $localtm[6]) { + die "local time offset greater than or equal to 24 hours\n"; + } + my $offset = $localmin - $gmtmin; + my $offhour = $offset / 60; + my $offmin = abs($offset % 60); + if (abs($offhour) >= 24) { + die ("local time offset greater than or equal to 24 hours\n"); + } + + return sprintf("%s, %2d %s %d %02d:%02d:%02d %s%02d%02d", + qw(Sun Mon Tue Wed Thu Fri Sat)[$localtm[6]], + $localtm[3], + qw(Jan Feb Mar Apr May Jun + Jul Aug Sep Oct Nov Dec)[$localtm[4]], + $localtm[5]+1900, + $localtm[2], + $localtm[1], + $localtm[0], + ($offset >= 0) ? '+' : '-', + abs($offhour), + $offmin, + ); +} my $have_email_valid = eval { require Email::Valid; 1 }; my $smtp; @@ -371,7 +405,7 @@ sub send_message my @recipients = unique_email_list(@to); my $to = join (",\n\t", @recipients); @recipients = unique_email_list(@recipients,@cc,@bcclist); - my $date = strftime('%a, %d %b %Y %H:%M:%S %z', localtime($time++)); + my $date = format_2822_time($time++); my $gitversion = '@@GIT_VERSION@@'; if ($gitversion =~ m/..GIT_VERSION../) { $gitversion = `git --version`; ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 0/3] Minor gitweb modifications and cleanups @ 2006-06-21 9:25 Jakub Narebski 2006-06-21 9:25 ` [PATCH 1/3] gitweb: whitespace cleanup Jakub Narebski 0 siblings, 1 reply; 8+ messages in thread From: Jakub Narebski @ 2006-06-21 9:25 UTC (permalink / raw) To: git This series of patches is based on git.git 'next' branch 69d830d1a3a1236036bd0f84dd9794d7c8d34b3f My future gitweb-related batches will be based on this series. --- gitweb/gitweb.cgi | 53 +++++++++++++++++++++++++++++++---------------------- gitweb/gitweb.css | 4 ++-- 2 files changed, 33 insertions(+), 24 deletions(-) -- Jakub Narebski ShadeHawk on #git (git-send-email 1.4.0 with setlocale patch) ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] gitweb: whitespace cleanup 2006-06-21 9:25 [PATCH 0/3] Minor gitweb modifications and cleanups Jakub Narebski @ 2006-06-21 9:25 ` Jakub Narebski 0 siblings, 0 replies; 8+ messages in thread From: Jakub Narebski @ 2006-06-21 9:25 UTC (permalink / raw) To: git; +Cc: Jakub Narebski Do not use tabs to align variable initialization (actually use tabs only at the beginning of line, for code indent). Remove trailing whitespace. Make whitespace usage more consistent. Signed-off-by: Jakub Narebski <jnareb@gmail.com> --- gitweb/gitweb.cgi | 38 +++++++++++++++++++------------------- gitweb/gitweb.css | 4 ++-- 2 files changed, 21 insertions(+), 21 deletions(-) 691405ab79e0dacbe3b96a404740faf3f10bffd7 diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi index 44896bb..89224e6 100755 --- a/gitweb/gitweb.cgi +++ b/gitweb/gitweb.cgi @@ -17,33 +17,33 @@ use Fcntl ':mode'; binmode STDOUT, ':utf8'; my $cgi = new CGI; -my $version = "267"; -my $my_url = $cgi->url(); -my $my_uri = $cgi->url(-absolute => 1); -my $rss_link = ""; +my $version = "267"; +my $my_url = $cgi->url(); +my $my_uri = $cgi->url(-absolute => 1); +my $rss_link = ""; # absolute fs-path which will be prepended to the project path -#my $projectroot = "/pub/scm"; -my $projectroot = "/home/kay/public_html/pub/scm"; +#my $projectroot = "/pub/scm"; +my $projectroot = "/home/kay/public_html/pub/scm"; # location of the git-core binaries -my $gitbin = "/usr/bin"; +my $gitbin = "/usr/bin"; # location for temporary files needed for diffs -my $git_temp = "/tmp/gitweb"; +my $git_temp = "/tmp/gitweb"; # target of the home link on top of all pages -my $home_link = $my_uri; +my $home_link = $my_uri; # html text to include at home page -my $home_text = "indextext.html"; +my $home_text = "indextext.html"; # URI of default stylesheet -my $stylesheet = "gitweb.css"; +my $stylesheet = "gitweb.css"; # source of projects list -#my $projects_list = $projectroot; -my $projects_list = "index/index.aux"; +#my $projects_list = $projectroot; +my $projects_list = "index/index.aux"; # default blob_plain mimetype and default charset for text/plain blob my $default_blob_plain_mimetype = 'text/plain'; @@ -51,7 +51,7 @@ my $default_text_plain_charset = undef; # file to use for guessing MIME types before trying /etc/mime.types # (relative to the current git repository) -my $mimetypes_file = undef; +my $mimetypes_file = undef; # input validation and dispatch @@ -349,7 +349,7 @@ sub git_footer_html { sub die_error { my $status = shift || "403 Forbidden"; - my $error = shift || "Malformed query, file missing or permission denied"; + my $error = shift || "Malformed query, file missing or permission denied"; git_header_html($status); print "<div class=\"page_body\">\n" . @@ -1066,7 +1066,7 @@ sub git_summary { "<td>"; if (length($co{'title_short'}) < length($co{'title'})) { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"}, - "<b>" . esc_html($co{'title_short'}) . "$ref</b>"); + "<b>" . esc_html($co{'title_short'}) . "$ref</b>"); } else { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list"}, "<b>" . esc_html($co{'title'}) . "$ref</b>"); @@ -1124,7 +1124,7 @@ sub git_summary { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'}); if ($tag{'reftype'} eq "commit") { print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log"); + " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log"); } print "</td>\n" . "</tr>"; @@ -1362,7 +1362,7 @@ sub git_tags { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'}); if ($tag{'reftype'} eq "commit") { print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log"); + " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log"); } print "</td>\n" . "</tr>"; @@ -1942,7 +1942,7 @@ sub git_commit { "</td>" . "</tr>\n"; } - print "</table>". + print "</table>". "</div>\n"; print "<div class=\"page_body\">\n"; my $comment = $co{'comment'}; diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css index ac6a3c7..98410f5 100644 --- a/gitweb/gitweb.css +++ b/gitweb/gitweb.css @@ -1,7 +1,7 @@ body { font-family: sans-serif; font-size: 12px; - border:solid #d9d8d1; + border: solid #d9d8d1; border-width: 1px; margin: 10px; background-color: #ffffff; @@ -33,7 +33,7 @@ div.page_header a:hover { } div.page_nav { - padding:8px; + padding: 8px; } div.page_nav a:visited { -- 1.3.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-07-03 2:49 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <11508760843417-git-send-email-jnareb@gmail.com> [not found] ` <11508760842024-git-send-email-jnareb@gmail.com> 2006-06-21 8:05 ` [PATCH 1/3] gitweb: whitespace cleanup Jakub Narebski 2006-06-21 9:04 ` [PATCH 0/3] Minor gitweb modifications and cleanups Junio C Hamano 2006-06-21 9:12 ` [PATCH] send-email: Use setlocale in addition to $ENV{LC_ALL} to set locale Jakub Narebski 2006-06-21 10:33 ` Jakub Narebski 2006-06-21 10:49 ` Eric Wong 2006-06-21 11:18 ` Jakub Narebski 2006-07-03 2:49 ` Junio C Hamano 2006-06-21 9:25 [PATCH 0/3] Minor gitweb modifications and cleanups Jakub Narebski 2006-06-21 9:25 ` [PATCH 1/3] gitweb: whitespace cleanup Jakub Narebski
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).