Bug 319142 - Year 2038 bugs
Summary: Year 2038 bugs
Status: ASSIGNED
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-07 11:10 EDT by Shawn Pearce CLA
Modified: 2019-08-20 19:27 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shawn Pearce CLA 2010-07-07 11:10:22 EDT
JGit contains a number of bugs that will arise in the year 2038, caused by the 32 bit second based timestamp rolling over at Jan 19, 2038, 03:14:07 AM GMT.

This bug tracks the location of these 2038 issues.  For various reasons, they aren't likely to be fixed before 2020.


DirCache/DirCacheEntry:

  The smudge racily clean algorithm sets the file's cached modification
  time forward to Jan 19, 2038, 03:14:07 AM GMT.  We depend upon this
  magical value never appearing as an actual File.lastModified() result.
  We need to use a different value or a different smudge algorithm as we
  get closer to 2038.

  The mtime field in the 'DIRC' file is only 4 bytes wide, and is used
  as a signed int.  In 2038 this field will roll over on us and start
  to report negative values.  The file format needs to change, or the
  Git community needs to declare that times prior to Jan 1 1970 aren't
  relevant in the index, permitting this field to be treated as unsigned.


RevCommit.getCommitTime():

  The commit time in a RevCommit is stored as a 32 bit signed int, as
  seconds since the UNIX epoch.  This time is used to sort commits by
  commit date in the priority queue.  Because we need to juggle many
  instances in memory at once, the smaller int storage was chosen as a
  memory and performance optimization.

  Moving from 1 second intervals to 2 second intervals would extend the
  lifespan of this field from 2038 until 2106.  Callers may be impacted
  by the loss of resolution, so the scope of that should be looked at
  before making the change.
Comment 1 Matthias Sohn CLA 2010-08-26 18:59:27 EDT
The problem with smudge racily clean algorithm was fixed in c98d97731b87417b196341fa63a50fffea4e123c.
Comment 2 Matthias Sohn CLA 2010-11-24 16:14:38 EST
LStat :

  The ctime and mtime fields in class LStat are only 4 bytes wide,
  and are used as signed int.  In 2038 these fields will roll over
  on us and start to report negative values.
Comment 3 Fábio Silva CLA 2017-07-21 07:01:32 EDT
The problem with RevCommit hasn't been fixed. The code is pretty clear about this:
...
int commitTime; // An int here for performance, overflows in 2038
Comment 4 Eclipse Genie CLA 2019-08-20 18:31:11 EDT
New Gerrit change created: https://git.eclipse.org/r/148014
Comment 5 Eclipse Genie CLA 2019-08-20 19:27:28 EDT
Gerrit change https://git.eclipse.org/r/148014 was merged to [stable-5.1].
Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=c130e5e708a34619a90474afd8f259931fc8e7c2