From: Jeff King <peff@peff.net>
To: Chris Rorvick <chris@rorvick.com>
Cc: Ramsay Jones <ramsay@ramsay1.demon.co.uk>, git@vger.kernel.org
Subject: Re: What's cooking in git.git (Oct 2012, #09; Mon, 29)
Date: Fri, 2 Nov 2012 05:56:32 -0400 [thread overview]
Message-ID: <20121102095632.GA30221@sigill.intra.peff.net> (raw)
In-Reply-To: <20121102094259.GA28414@sigill.intra.peff.net>
On Fri, Nov 02, 2012 at 05:43:00AM -0400, Jeff King wrote:
> Yeah, I think that is it. IIRC, Ramsay is on cygwin, and I noticed this
> in perl 5.16's POSIX.xs:
>
> [...]
> * (4) The CRT strftime() "%Z" implementation calls __tzset(). That
> * calls CRT tzset(), but only the first time it is called, and in turn
> * that uses CRT getenv("TZ") to retrieve the timezone info from the CRT
> * local copy of the environment and hence gets the original setting as
> * perl never updates the CRT copy when assigning to $ENV{TZ}.
> [...]
> I wonder if Ramsay has an older perl that does not do this special
> hackery right. I'll see if I can dig up where it first appeared.
It looks like that code went into perl 5.11.
I wonder, even with this fix, though, if we need to be calling tzset to
reliably update from the environment. It sounds like it _should_ happen
automatically, except that if the CRT is calling the internal tzset, it
would not do the perl "grab from $ENV" magic. Calling tzset would make
sure the internal TZ is up to date.
Ramsay, what happens with this patch on top?
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index ceb119d..4c44050 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -24,11 +24,12 @@ use File::Basename qw(basename dirname);
use Time::Local;
use IO::Socket;
use IO::Pipe;
-use POSIX qw(strftime dup2 ENOENT);
+use POSIX qw(strftime tzset dup2 ENOENT);
use IPC::Open2;
$SIG{'PIPE'}="IGNORE";
$ENV{'TZ'}="UTC";
+tzset();
our ($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,@opt_M,$opt_A,$opt_S,$opt_L, $opt_a, $opt_r, $opt_R);
my (%conv_author_name, %conv_author_email, %conv_author_tz);
@@ -855,8 +856,10 @@ sub commit {
}
$ENV{'TZ'}=$author_tz;
+ tzset();
my $commit_date = strftime("%s %z", localtime($date));
$ENV{'TZ'}="UTC";
+ tzset();
$ENV{GIT_AUTHOR_NAME} = $author_name;
$ENV{GIT_AUTHOR_EMAIL} = $author_email;
$ENV{GIT_AUTHOR_DATE} = $commit_date;
next prev parent reply other threads:[~2012-11-02 9:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-29 10:21 What's cooking in git.git (Oct 2012, #09; Mon, 29) Jeff King
2012-11-01 18:40 ` Ramsay Jones
2012-11-02 1:12 ` Chris Rorvick
2012-11-02 9:43 ` Jeff King
2012-11-02 9:56 ` Jeff King [this message]
2012-11-02 21:33 ` Ramsay Jones
2012-11-04 12:29 ` Jeff King
2012-11-10 18:33 ` Ramsay Jones
2012-11-11 17:41 ` Jeff King
2012-11-13 18:47 ` Ramsay Jones
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=20121102095632.GA30221@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=chris@rorvick.com \
--cc=git@vger.kernel.org \
--cc=ramsay@ramsay1.demon.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).