[JIRA] (JENKINS-49829) Getting string index out of range error when using git 2.16.2+

0 views
Skip to first unread message

isarkisov@gmail.com (JIRA)

unread,
Mar 1, 2018, 2:43:03 PM3/1/18
to jenkinsc...@googlegroups.com
Igor Sarkisov created an issue
 
Jenkins / Bug JENKINS-49829
Getting string index out of range error when using git 2.16.2+
Issue Type: Bug Bug
Assignee: Unassigned
Components: repo-plugin
Created: 2018-03-01 19:42
Environment: Debian with git 2.16.2
Priority: Major Major
Reporter: Igor Sarkisov

I have system running Debian with git 2.16.2.  REPO plugin fails to sync latest changes and throwing the following error:
[devtools] $ git log --raw --first-parent --format="[[<as7d9m1R_MARK_A>]]%H[[<as7d9m1R_MARK_B>]%an[[<as7d9m1R_MARK_B>]%ae[[<as7d9m1R_MARK_B>]%aD[[<as7d9m1R_MARK_B>]%cn[[<as7d9m1R_MARK_B>]%ce[[<as7d9m1R_MARK_B>]%cD[[<as7d9m1R_MARK_B>]%s
%b[[<as7d9m1R_MARK_B>]" b8630400d4ebf2406f49e11e213c9ae12cf7605b..a1e314337f062b4dd15beab1aaf1206af6183f2a
FATAL: String index out of range: 38
java.lang.StringIndexOutOfBoundsException: String index out of range: 38
at java.lang.String.substring(String.java:1963)
at hudson.plugins.repo.ChangeLog.generateChangeLog(ChangeLog.java:203)
at hudson.plugins.repo.ChangeLog.saveChangeLog(ChangeLog.java:249)
at hudson.plugins.repo.RepoScm.checkout(RepoScm.java:718)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1212)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:566)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:491)
at hudson.model.Run.execute(Run.java:1737)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:421)
 

However, on my other system (Ubuntu with git 1.9.1) it works as expected.  Upon further investigation I discovered git log output different between git versions 1.9.1 and 2.16.2:

Here is output with git 1.9.1:

/usr/local/bin/git log --raw --first-parent --format="[[<as7d9m1R_MARK_A>]]%H[[<as7d9m1R_MARK_B>]%an[[<as7d9m1R_MARK_B>]%ae[[<as7d9m1R_MARK_B>]%aD[[<as7d9m1R_MARK_B>]%cn[[<as7d9m1R_MARK_B>]%ce[[<as7d9m1R_MARK_B>]%cD[[<as7d9m1R_MARK_B>]%s%b[[<as7d9m1R_MARK_B>]" a1e314337f062b4dd15beab1aaf1206af6183f2a..e6164c7e256f19dc285377b33187b84dc7602a52 | more

[[<as7d9m1R_MARK_A>]]e6164c7e256f19dc285377b33187b84dc7602a52[[<as7d9m1R_MARK_B>]Igor Sarki

sov[[<as7d9m1R_MARK_B>]isar...@google.com[[<as7d9m1R_MARK_B>]Wed, 28 Feb 2018 18:03:08 -0

800[[<as7d9m1R_MARK_B>]Igor Sarkisov[[<as7d9m1R_MARK_B>]isar...@google.com[[<as7d9m1R_MAR

K_B>]Wed, 28 Feb 2018 18:03:08 -0800[[<as7d9m1R_MARK_B>]Adding function coverage support[[<

as7d9m1R_MARK_B>]

 

:000000 100644 0000000... 0d20b64... A  .gitignore

Here is output with git 2.16.2:

/usr/bin/git log --raw --first-parent --format="[[<as7d9m1R_MARK_A>]]%H[[<as7d9m1R_MARK_B>]%an[[<as7d9m1R_MARK_B>]%ae[[<as7d9m1R_MARK_B>]%aD[[<as7d9m1R_MARK_B>]%cn[[<as7d9m1R_MARK_B>]%ce[[<as7d9m1R_MARK_B>]%cD[[<as7d9m1R_MARK_B>]%s%b[[<as7d9m1R_MARK_B>]" a1e314337f062b4dd15beab1aaf1206af6183f2a..e6164c7e256f19dc285377b33187b84dc7602a52 | more

[[<as7d9m1R_MARK_A>]]e6164c7e256f19dc285377b33187b84dc7602a52[[<as7d9m1R_MARK_B>]Igor Sarki

sov[[<as7d9m1R_MARK_B>]isar...@google.com[[<as7d9m1R_MARK_B>]Wed, 28 Feb 2018 18:03:08 -0

800[[<as7d9m1R_MARK_B>]Igor Sarkisov[[<as7d9m1R_MARK_B>]isar...@google.com[[<as7d9m1R_MAR

K_B>]Wed, 28 Feb 2018 18:03:08 -0800[[<as7d9m1R_MARK_B>]Adding function coverage support[[<

as7d9m1R_MARK_B>]

 

:000000 100644 0000000 0d20b64 A        .gitignore

--------------------------------

As you can see outputs different between git versions, as a consequence I believe the following code is broken for git 2.16.2 (it tries to access string index at 38 and it git 2.16.2 it goes out of range):

https://github.com/jenkinsci/repo-plugin/blob/8339a33e5085a515dcdefd004cce1fe6fd682d3f/src/main/java/hudson/plugins/repo/ChangeLog.java#L203

 

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

myselfasunder@gmail.com (JIRA)

unread,
Apr 11, 2018, 1:34:02 PM4/11/18
to jenkinsc...@googlegroups.com

myselfasunder@gmail.com (JIRA)

unread,
Apr 11, 2018, 1:35:02 PM4/11/18
to jenkinsc...@googlegroups.com
Dustin Oprea edited a comment on Bug JENKINS-49829
Affects me/us, too , but only happens periodically (every day or two, but dozens of successes in between) .

 

annemoroney@alum.mit.edu (JIRA)

unread,
Jun 6, 2018, 5:25:02 PM6/6/18
to jenkinsc...@googlegroups.com

Am I missing something? The only difference is whether or not ellipses "..." appear, eg

:000000 100644 0000000... 0d20b64... A  .gitignore

Maybe since you have two git versions resident on the box you could force use the 'right' git version.

isarkisov@gmail.com (JIRA)

unread,
Jun 6, 2018, 5:38:02 PM6/6/18
to jenkinsc...@googlegroups.com
Igor Sarkisov edited a comment on Bug JENKINS-49829
Are you suggesting we install git 1.9 on all our build machines and use that instead?  The better option is to add git 2.0+ support.   I can make pull request when I get some spare cycles.

isarkisov@gmail.com (JIRA)

unread,
Jun 6, 2018, 5:38:02 PM6/6/18
to jenkinsc...@googlegroups.com
 
Re: Getting string index out of range error when using git 2.16.2+

Are you suggesting we install git 1.9 on all our build machines and use that instead?  The better option is to add git 2.0+ support.

jrnieder@gmail.com (JIRA)

unread,
Jan 23, 2019, 1:13:02 AM1/23/19
to jenkinsc...@googlegroups.com

This was triggered by the change in Git (v2.16.0-rc0~41^2~4) that Igor noticed[1].

That said, this output was not made for machine parsing in the first place. Can Jenkins pass --no-abbrev-commit, or, better, use a more targeted command to obtain the information it needs (e.g. git rev-list or git diff-tree)?

[1] commit ca69d4d5b14245c9ba4535212c4f4a0621e78ffa
Author: Ann T Ropea <bedh...@gmx.de>
Date: Wed Dec 6 01:20:42 2017 +0100

checkout: describe_detached_head: remove ellipsis after committish

We do not want an ellipsis displayed following an (abbreviated) SHA-1
value.

The days when this was necessary to indicate the truncation to
lower-level Git commands and/or the user are bygone.

However, to ease the transition, the ellipsis will still be printed if
the user sets the environment variable GIT_PRINT_SHA1_ELLIPSIS to "yes".

 

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

ilia.meerovich@gmail.com (JIRA)

unread,
Mar 21, 2019, 9:11:02 AM3/21/19
to jenkinsc...@googlegroups.com

same happens with git 2.17.1:
[Pipeline] End of Pipelinejava.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1931)
at hudson.plugins.repo.ChangeLog.generateChangeLog(ChangeLog.java:204)


at hudson.plugins.repo.ChangeLog.saveChangeLog(ChangeLog.java:249)
at hudson.plugins.repo.RepoScm.checkout(RepoScm.java:718)

at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

rmbijur@gmail.com (JIRA)

unread,
Mar 21, 2019, 7:46:03 PM3/21/19
to jenkinsc...@googlegroups.com

git --version
git version 2.19.1

[DEL_KAON_BCM_MIPS4K_LNUX_SKYNZ_01] $ git log --raw --first-parent --format="[[<as7d9m1R_MARK_A>]]%H[[<as7d9m1R_MARK_B>]%an[[<as7d9m1R_MARK_B>]%ae[[<as7d9m1R_MARK_B>]%aD[[<as7d9m1R_MARK_B>]%cn[[<as7d9m1R_MARK_B>]%ce[[<as7d9m1R_MARK_B>]%cD[[<as7d9m1R_MARK_B>]%s
%b[[<as7d9m1R_MARK_B>]" ebe30a0bfeaa53175d236c26a6e6ca6981493826..76d334d856c3ee048b1688d33c0461e762afa9cd


FATAL: String index out of range: 38
java.lang.StringIndexOutOfBoundsException: String index out of range: 38
at java.lang.String.substring(String.java:1963)
at hudson.plugins.repo.ChangeLog.generateChangeLog(ChangeLog.java:203)

at hudson.plugins.repo.ChangeLog.saveChangeLog(ChangeLog.java:249)
at hudson.plugins.repo.RepoScm.checkout(RepoScm.java:718)

at hudson.scm.SCM.checkout(SCM.java:504)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
at hudson.model.Run.execute(Run.java:1816)


at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)

at hudson.model.Executor.run(Executor.java:429)

rmbijur@gmail.com (JIRA)

unread,
Mar 21, 2019, 7:47:02 PM3/21/19
to jenkinsc...@googlegroups.com
Ramaraj Bijur edited a comment on Bug JENKINS-49829
Same thing happens every alternative build triggers

jrnieder@gmail.com (JIRA)

unread,
Mar 21, 2019, 8:03:02 PM3/21/19
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages