On Sat, 16 Aug 2008, Hermann Gausterer wrote:Git uses a fairly odd date parsing library, and it turns out that 917476713 +0200 is actually a perfectly valid date in the git format, because one thing git allows is the "seconds since epoch" one. So doing [torvalds@nehalem git]$ ./test-date "917476713 +0200" 917476713 +0200 -> 917476713 +0200 -> Wed Jan 27 14:38:33 1999 917476713 +0200 -> Wed Jan 27 14:38:33 1999 and it turns out that git will totally ignore any other format date when i sees this standard format (yes, that is literally the format that git uses internally). So because git date parsing doesn't even really understand fractional seconds, and thus doesn't parse it, it will take the fraction, and if it was larger than 100000000, it will assume it's a seconds-since-epoch date. Unlucky. Anyway, something like this should fix it. Junio: we might also make the code that actually parses the seconds-per-epoch thing only trigger if we haven't already seen a date (ie it might check for "tm->tm_year < 0" etc before accepting that seconds format). Linus --- Subject: Ignore fractional seconds in date parsing From: Linus Torvalds <torvads@linux-foundation.org> .. otherwise a nanosecond resolution fractional second might be interpreted as a seconds-since-epoch date format string and overwrite the date we so carefully just parsed. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Noticed-by: Hermann Gausterer <git-mailinglist@mrq1.org> --- date.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/date.c b/date.c index 35a5257..5e502da 100644 --- a/date.c +++ b/date.c @@ -363,6 +363,11 @@ static int match_multi_number(unsigned long num, char c, const char *date, char tm->tm_hour = num; tm->tm_min = num2; tm->tm_sec = num3; + + /* Ignore any possible fractional seconds */ + if (*end == '.') + (void) strtol(end+1, &end, 10); + break; } return 0; -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| Amit K. Arora | [RFC] Heads up on sys_fallocate() |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
git: | |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
| Matheos Worku | 2.6.24 BUG: soft lockup - CPU#X |
