Closed ericsteele closed 2 weeks ago
Please review and test https://eclipse.gerrithub.io/c/eclipse-jgit/jgit/+/1199781
See the contributor guide how to login to GerritHub.
Looks good to me. Tested on my local and it works. Thanks!
We also had https://eclipse.gerrithub.io/c/eclipse-jgit/jgit/+/197494/3/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java which somehow fell through the cracks.
Either of these is fine.
Could I get a positive vote on the change ? I need to prepare 7.0 RC1 today and would like to include this fix.
https://eclipse.gerrithub.io/c/eclipse-jgit/jgit/+/1199781 was merged to stable-6.10 branch and will be merged up to master
Thank you everyone! Really appreciate the fast turnaround on this.
Version
6.0.0+
Operating System
Linux/Unix, MacOS
Bug description
Hi folks! (esp. @msohn, @tomaswolf)
I have a bug to report, and also the solution/fix, which is only a few lines of code!
A few years back I helped author a change in the
AmazonS3
class to add support for AWS API signature version 4.579907
If289dbc6d0f57323cfeaac2624c4eb5028f78d13
That change landed in
5.13.1.202206130422-r
and I have been using that until recently when I tried upgrading to the latest version6.8.0.202311291450-r
. After upgrading I found thatfetch
andpull
commands were no longer working due to this error:I was able to replicate this issue as far back as version
6.0.0
. I debugged the code and it appears that this change is the cause:When the
AmazonS3Transport::readLooseRefs()
method executes, it callsAmazonS3:list()
method, which calls theListParser::list()
method. In JGit version5.13
, theListParser::list()
method uses anXmlReader
created by theXMLReaderFactory
. But in JGit version6.0.0+
, theListParser::list()
method uses anXmlReader
created bySAXParserFactory
.If you step through the XML parsing logic as it executes and look at the inputs provided to the
ListParser::startElement()
andListParser::endElement()
methods, you will see why it no longer works. WhenXMLReaderFactory
is used, all of the input parameters are set to valid/expected values. WhenSAXParserFactory
is used, the only input parameter that gets set is theqName
parameter. All other parameters are set tonull
.I did some googling, and found this StackOverflow thread in which another user saw the same issue when using
SAXParserFactory
:The solution for that user was to call
SaxParserFactory.setNamespaceAware(true)
before callingSaxParserFactory.newSAXParser()
. I built JGit with this change and tested it out on my local machine and it worked!@msohn Would it be possible for you to submit a fix for this? I can do so if needed, but it has been 2 years since I last contributed and am having trouble logging into things and recreating my setup from back then. It is a very small change, and is blocking something that I am working on, so I'm hoping you can help squash this bug for me. Thank you! 🙏
Actual behavior
When trying to fetch or pull changes from a repo hosted in AWS S3, I am seeing:
This affects jgit versions
6.0.0+
Expected behavior
Expected behavior is that fetch and pull operations from AWS S3 should work, as they did in version
5.13
.Relevant log output
No response
Other information
No response