Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] JGit removes Pack from list *even* if exists on the filesystem

Hi Gerrit and JGit users,
I have found a small but serious bug in the way that JGit manages the file-system related errors when reading pack files.

Look at this broken management of the FileNotFoundException (from https://goo.gl/oidSwf)


The FileNotFoundException is typically raised in three conditions:
- file doesn't exist
- incompatible read vs. read/write open modes
- filesystem locking
- temporary lack of resources (e.g. too many open files)

... so ... *why on earth* do we always assume that Pack doesn't exist and we remove it from the in-memory list?

The "removePack(p)" should be IMHO inside the else() block whilst if FileNotFoundException happens when the pack file exists => log the error and try next time again.
Does it make sense?

Going to post a 1-liner fix tomorrow :-)

Luca.

Back to the top