From: Robin Rosenberg <hidden> Date: 2016-06-15 22:45:47
The few plugin unit tests we have is a sad story. Cheer up a bit.
Robin Rosenberg (2):
Revert "Fix commit id in egit test
T0001_ConnectProviderOperationTest"
Fixed an old failed EGit unit test.
.../egit/core/internal/mapping/T0002_history.java | 5 ++---
.../op/T0001_ConnectProviderOperationTest.java | 3 ++-
2 files changed, 4 insertions(+), 4 deletions(-)
From: Robin Rosenberg <hidden> Date: 2016-06-15 22:45:47
This reverts commit 61133091d5f22398828b350ff772165e9945db8a.
Bisect says this is the commit that failed, which is odd. Bad QA.
Signed-off-by: Robin Rosenberg <redacted>
---
.../op/T0001_ConnectProviderOperationTest.java | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
From: Robin Rosenberg <hidden> Date: 2016-06-15 22:45:47
The index was dropped from the history with Shawns revision walker.
Signed-off-by: Robin Rosenberg <redacted>
---
.../egit/core/internal/mapping/T0002_history.java | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
@@ -99,8 +99,9 @@ assertTrue("tree missing", new File(gitDir,"objects/08/ccc3d91a14d337a45f355d3d63bd97fd5e4db9").exists());assertTrue("tree missing",newFile(gitDir,"objects/9d/aeec817090098f05eeca858e3a552d78b0a346").exists());+assertTrue("commit missing",newFile(gitDir,-"objects/09/6f1a84091b90b6d9fb12f95848da69496305c1").exists());+"objects/45/df73fd9abbc2c61620c036948b1157e4d21253").exists());
Debugging this test shows that the commit we created in the test
is actually:
--
$ git cat-file commit 4c1bc1435f93c9409c93db5239e111271a8ccf55
tree 9daeec817090098f05eeca858e3a552d78b0a346
author J. Git [off-list ref] 60876086400 +0100
committer J. Git [off-list ref] 60876086400 +0100
testNewUnsharedFile
Junit tests
--
Which has me starting to wonder, what the heck is different
between systems that is being reflected in this commit object?
The only thing I can think of is the timestamp we are creating by
the deprecated Date constructor call back on line 82. Perhaps
on different JVMs it is using different values for the hh:mm:ss
parts of the timestamp value?
--
Shawn.
From: Robin Rosenberg <hidden> Date: 2016-06-15 22:45:47
onsdag 17 december 2008 17:09:33 skrev Shawn O. Pearce:
The only thing I can think of is the timestamp we are creating by
the deprecated Date constructor call back on line 82. Perhaps
on different JVMs it is using different values for the hh:mm:ss
parts of the timestamp value?
Indeed it is. Date is dependent on local time zone.
From e4d10dea5d62210868d71384e559a0d3ef1ca55d Mon Sep 17 00:00:00 2001
From: Robin Rosenberg <redacted>
Date: Wed, 17 Dec 2008 22:46:48 +0100
Subject: [EGIT PATCH 1/2 v2] Fix testcase that was sensitive to the local time zone.
Signed-off-by: Robin Rosenberg <redacted>
---
.../op/T0001_ConnectProviderOperationTest.java | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Shawn O. Pearce <hidden> Date: 2016-06-15 22:45:47
Robin Rosenberg [off-list ref] wrote:
onsdag 17 december 2008 17:09:33 skrev Shawn O. Pearce:
quoted
The only thing I can think of is the timestamp we are creating by
the deprecated Date constructor call back on line 82. Perhaps
on different JVMs it is using different values for the hh:mm:ss
parts of the timestamp value?
Indeed it is. Date is dependent on local time zone.
From: Robin Rosenberg <hidden> Date: 2016-06-15 22:45:47
If not dates past 2038 will be parsed the wrong way when
parsed into a RevCommit or RevTag object.
Signed-off-by: Robin Rosenberg <redacted>
---
.../src/org/spearce/jgit/util/RawParseUtils.java | 58 +++++++++++++++++++-
1 files changed, 56 insertions(+), 2 deletions(-)
@@ -135,7 +135,7 @@ public static int formatBase10(final byte[] b, int o, int value) {}/**-*Parseabase10numericfromasequenceofASCIIdigits.+*Parseabase10numericfromasequenceofASCIIdigitsintoanint.*<p>*Digitsequencescanbeginwithanoptionalrunofspacesbeforethe*sequence,andmaystartwitha'+'ora'-'toindicatesignposition.
@@ -189,6 +189,60 @@ public static final int parseBase10(final byte[] b, int ptr,}/**+*Parseabase10numericfromasequenceofASCIIdigitsintoalong.+*<p>+*Digitsequencescanbeginwithanoptionalrunofspacesbeforethe+*sequence,andmaystartwitha'+'ora'-'toindicatesignposition.+*Anyothercharacterswillcausethemethodtostopandreturnthecurrent+*resulttothecaller.+*+*@paramb+*buffertoscan.+*@paramptr+*positionwithinbuffertostartparsingdigitsat.+*@paramptrResult+*optionallocationtoreturnthenewptrvaluethrough.Ifnull+*theptrvaluewillbediscarded.+*@returnthevalueatthislocation;0ifthelocationisnotavalid+*numeric.+*/+publicstaticfinallongparseLongBase10(finalbyte[]b,intptr,+finalMutableIntegerptrResult){+longr=0;+intsign=0;+try{+finalintsz=b.length;+while(ptr<sz&&b[ptr]==' ')+ptr++;+if(ptr>=sz)+return0;++switch(b[ptr]){+case'-':+sign=-1;+ptr++;+break;+case'+':+ptr++;+break;+}++while(ptr<sz){+finalbytev=digits[b[ptr]];+if(v<0)+break;+r=(r*10)+v;+ptr++;+}+}catch(ArrayIndexOutOfBoundsExceptione){+// Not a valid digit.+}+if(ptrResult!=null)+ptrResult.value=ptr;+returnsign<0?-r:r;+}++/***ParseaGitstyletimezonestring.*<p>*Thesequence"-0315"willbeparsedasthenumericvalue-195,asthe
@@ -414,7 +468,7 @@ public static PersonIdent parsePersonIdent(final byte[] raw, final int nameB) {finalStringemail=decode(cs,raw,emailB,emailE-1);finalMutableIntegerptrout=newMutableInteger();-finalintwhen=parseBase10(raw,emailE+1,ptrout);+finallongwhen=parseLongBase10(raw,emailE+1,ptrout);finalinttz=parseTimeZoneOffset(raw,ptrout.value);returnnewPersonIdent(name,email,when*1000L,tz);
From: Shawn O. Pearce <hidden> Date: 2016-06-15 22:45:47
Robin Rosenberg [off-list ref] wrote:
If not dates past 2038 will be parsed the wrong way when
parsed into a RevCommit or RevTag object.
Uhm, sure.
But there's also the commitTime field in RevCommit, its used to
sort commits during walking. In 2038 that will also overflow.
Also, if you search the code for '2038' you'll find a remark
about the year 2038 in DirCacheEntry.smudgeRacilyClean. Last
I looked at the git sources I think this field in the index is
treated as a signed time_t so we can't set the high bits and
extend it out another 60+ years.
Honestly, I'm not sure this patch is worth the code duplication
without fixing our other two known 2038 problem spots... and
I really don't want to make RevCommit.commitTime into a long,
as that will bloat out the object allocations and slow down the
comparsion on 32 bit JVMs. Right now at the end of 2008 the memory
isn't as readily available and there's still a lot of 32 bit JVMs.
Another 10 years we'll probably be looking at 256 bit wide registers
being very common, and 1 PB of core memory, and extending these
fields out to a long will be trivial. And we'll still have 20
years to make the transition.
I'd rather just tag the fields with "2038" so we can search for
them in the future. Like say this:
--8<--
Mark the other two locations that break in the year 2038
When the 32 bit timestamp rolls over in 2038 these spots in JGit
will break, unless we upgrade them to use a 64 bit long before then.
For now its too time and memory intensive to use a full long here,
but in another 10 years we should have enough computing power that
this is a moot point and we can upgrade the code paths marked with
by 'git grep 2038'.
Signed-off-by: Shawn O. Pearce <redacted>
---
.../src/org/spearce/jgit/revwalk/RevCommit.java | 2 ++
.../src/org/spearce/jgit/util/RawParseUtils.java | 2 ++
2 files changed, 4 insertions(+), 0 deletions(-)
@@ -129,6 +129,8 @@ else if (nParents == 1) {ptr=RawParseUtils.committer(raw,ptr);if(ptr>0){ptr=RawParseUtils.nextLF(raw,ptr,'>');++// In 2038 commitTime will overflow unless it is changed to long.commitTime=RawParseUtils.parseBase10(raw,ptr,null);}
@@ -414,6 +414,8 @@ public static PersonIdent parsePersonIdent(final byte[] raw, final int nameB) {finalStringemail=decode(cs,raw,emailB,emailE-1);finalMutableIntegerptrout=newMutableInteger();++// In 2038 "when" will overflow. Switch to a long before then.finalintwhen=parseBase10(raw,emailE+1,ptrout);finalinttz=parseTimeZoneOffset(raw,ptrout.value);
From: Robin Rosenberg <hidden> Date: 2016-06-15 22:45:47
onsdag 17 december 2008 23:48:44 skrev Shawn O. Pearce:
Robin Rosenberg [off-list ref] wrote:
quoted
If not dates past 2038 will be parsed the wrong way when
parsed into a RevCommit or RevTag object.
Uhm, sure.
But there's also the commitTime field in RevCommit, its used to
sort commits during walking. In 2038 that will also overflow.
Ok, but that's not used for display purposes, which what I saw. How
huge is the cost of a long here. Most processor handle longs
well today, though many megs of them will hurt the cache.
Also, if you search the code for '2038' you'll find a remark
about the year 2038 in DirCacheEntry.smudgeRacilyClean. Last
I looked at the git sources I think this field in the index is
treated as a signed time_t so we can't set the high bits and
extend it out another 60+ years.
That is another time stamp. It is a file time stamp, which we
never store in the Git object database. The index can be revised over time since
it is purely local structure. If it weren't for the need to operate
with C Git in the same repo we could have used a different format,
and nobody would notice. (The first jgit versions used a different
index structure).
time_t is signed, but it is also 64 bit on 64-bit linux so it doesn't overflow in 2038.
$ cev 'printf("sizeof time =%d\n",sizeof(time_t));'
sizeof time =8
I'd rather just tag the fields with "2038" so we can search for
them in the future. Like say this:
There should be a comment on the commitTime field too if we choose
that option.
-- robin