Git-commit-id-maven-plugin: PatternSyntaxException

Created on 10 Nov 2015  Â·  11Comments  Â·  Source: git-commit-id/git-commit-id-maven-plugin

Tested on:
git-commit-id-plugin: 2.2.0
JVM: HotSpot 1.8 64bit (Windows)
maven project with 3 submodules, one of submodules uses git-commit-id-plugin

git-commit-id-plugin 2.1.13 works OK
git-commit-id-plugin 2.2.0 with "useNativeGit =true" works OK

log:

[INFO] --- git-commit-id-plugin:2.2.0:revision (default) @ application ---
java.util.regex.PatternSyntaxException: Unclosed group near index 611
☻♂☻☻↓ :‼  D↓  t♥  ►   ►    @ ☺    ►   ☻  ♦       ♣ ☻       ↔  ♦  DP↓ ♥  ?         ►        ►      ►          ►            ?∟ ?▲    ↔ ?♦   ►↑ T?                    ↑ ∟                                           ??∟ 8                          \.text   (8‼  ►   :‼  ♦              ` P`\.data   ?q   P‼  r   >‼             @ p?\.rdata   .*♦  ?‼  ,♦  ?‼             @ p@\.buildid5     ↑  ☻   ?↨             @ 0@\.pdata  T?   ►↑  ?  ?↨             @ 0@\.xdata  x?   ?↑  ?   v↑             @ 0@\.bss    Ps♥  `↓                     ? p?\.idata  ?▲   ?∟       ↓             @ 0?\.rsrc   ?♦    ↔  ♠   @↓             @ 0?




                                           ^
        at java.util.regex.Pattern.error(Pattern.java:1955)
        at java.util.regex.Pattern.accept(Pattern.java:1813)
        at java.util.regex.Pattern.group0(Pattern.java:2908)
        at java.util.regex.Pattern.sequence(Pattern.java:2051)
        at java.util.regex.Pattern.expr(Pattern.java:1996)
        at java.util.regex.Pattern.compile(Pattern.java:1696)
        at java.util.regex.Pattern.<init>(Pattern.java:1351)
        at java.util.regex.Pattern.compile(Pattern.java:1028)
        at org.eclipse.jgit.ignore.internal.Strings.convertGlob(Strings.java:352)
        at org.eclipse.jgit.ignore.internal.WildCardMatcher.<init>(WildCardMatcher.java:66)
        at org.eclipse.jgit.ignore.internal.PathMatcher.createNameMatcher0(PathMatcher.java:145)
        at org.eclipse.jgit.ignore.internal.PathMatcher.createMatchers(PathMatcher.java:97)
        at org.eclipse.jgit.ignore.internal.PathMatcher.<init>(PathMatcher.java:83)
        at org.eclipse.jgit.ignore.internal.PathMatcher.createPathMatcher(PathMatcher.java:126)
        at org.eclipse.jgit.ignore.FastIgnoreRule.<init>(FastIgnoreRule.java:112)
        at org.eclipse.jgit.ignore.IgnoreNode.parse(IgnoreNode.java:114)
        at org.eclipse.jgit.treewalk.WorkingTreeIterator$RootIgnoreNode.loadRulesFromFile(WorkingTreeIterator.java:1267)
        at org.eclipse.jgit.treewalk.WorkingTreeIterator$RootIgnoreNode.load(WorkingTreeIterator.java:1252)
        at org.eclipse.jgit.treewalk.WorkingTreeIterator.getIgnoreNode(WorkingTreeIterator.java:648)
        at org.eclipse.jgit.treewalk.WorkingTreeIterator.isEntryIgnored(WorkingTreeIterator.java:616)
        at org.eclipse.jgit.treewalk.WorkingTreeIterator.isEntryIgnored(WorkingTreeIterator.java:599)
        at org.eclipse.jgit.treewalk.WorkingTreeIterator.isEntryIgnored(WorkingTreeIterator.java:586)
        at org.eclipse.jgit.treewalk.filter.IndexDiffFilter.include(IndexDiffFilter.java:157)
        at org.eclipse.jgit.treewalk.filter.AndTreeFilter$Binary.include(AndTreeFilter.java:131)
        at org.eclipse.jgit.treewalk.TreeWalk.next(TreeWalk.java:572)
        at org.eclipse.jgit.lib.IndexDiff.diff(IndexDiff.java:434)
        at org.eclipse.jgit.lib.IndexDiff.diff(IndexDiff.java:376)
        at org.eclipse.jgit.api.StatusCommand.call(StatusCommand.java:148)
        at pl.project13.jgit.DescribeCommand.findDirtyState(DescribeCommand.java:352)
        at pl.project13.jgit.DescribeCommand.call(DescribeCommand.java:288)
        at pl.project13.maven.git.JGitProvider.getGitDescribe(JGitProvider.java:234)
        at pl.project13.maven.git.JGitProvider.getGitDescribe(JGitProvider.java:125)
        at pl.project13.maven.git.GitDataProvider.maybePutGitDescribe(GitDataProvider.java:148)
        at pl.project13.maven.git.GitDataProvider.loadGitData(GitDataProvider.java:113)
        at pl.project13.maven.git.GitCommitIdMojo.loadGitDataWithJGit(GitCommitIdMojo.java:637)
        at pl.project13.maven.git.GitCommitIdMojo.loadGitData(GitCommitIdMojo.java:608)
        at pl.project13.maven.git.GitCommitIdMojo.execute(GitCommitIdMojo.java:423)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

...

[ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:2.2.0:revision (default) on project application: Could not complete Mojo execution... Unclosed group near index 611
[ERROR] :‼  D↓  t♥  ►   ►    @ ☺    ►   ☻  ♦       ♣ ☻       ↔  ♦  DP↓ ♥  ?         ►        ►      ►          ►            ?∟ ?▲    ↔ ?♦   ►↑
 T?                    ↑ ∟                                           ??∟ 8                          \.text   (8‼  ►   :‼  ♦              ` P`\.data   ?q   P‼  r   >‼             @ p?\.rdata   .*♦  ?‼  ,♦  ?‼             @ p@\.buildid5     ↑  ☻   ?↨             @ 0@\.pdata  T?   ►↑  ?
   ?↨             @ 0@\.xdata  x?   ?↑  ?   v↑             @ 0@\.bss    Ps♥  `↓                     ? p?\.idata  ?▲   ?∟       ↓             @ 0?\.rsrc   ?♦    ↔  ♠   @↓             @ 0?
[ERROR] ^
bug CanNotReproduce

All 11 comments

Thanks for reporting
If you could prepare a reproducer that would help a lot!

-- 
Konrad 'ktoso’ Malawski

I added the Label "Still open" since we need a reproducer to dig deeper what's going wrong...are there some fancy UTF-8 commit messages? Could you elaborate further about the repository and what it contains?

Sorry guys, here the testCase.

See updated test case: https://github.com/ktoso/maven-git-commit-id-plugin/issues/222#issuecomment-158043472

my env:

$ uname -a
CYGWIN_NT-6.1 <MACHINEID> 2.2.1(0.289/5/3) 2015-08-20 11:42 x86_64 Cygwin
$ java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
$ mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00)
Maven home: C:\Users\<username>\apache-maven-3.3.3
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_65\jre
Default locale: en_US, platform encoding: Cp1250
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"

git repo initiated with:

$ git --version
git version 2.5.3

Hi @bademux,
thanks for the feedback.
So far I was not able to reproduce the scenario..will need to setup a windows with cygwin...

Yep, it's cygwin<>java problem with path - in windows native "terminal" it works well >mvn clean install
but git-commit-id-plugin 2.1.13 doesn't suffer from the problem

Ok, here my debuging, basically it yaks up on loadRulesFromFile,

FileInputStream in = new FileInputStream(exclude);

where argument "exclude" of type File = "C:\cygwin64\bin\git.exe"
so after the parsing the InputStream we have something like "MZ�   �� � @ � � � �!�L�!This program cannot be run in DOS mode."

      at org.eclipse.jgit.ignore.internal.NameMatcher.<init>(NameMatcher.java:66)
      at org.eclipse.jgit.ignore.internal.PathMatcher.createNameMatcher0(PathMatcher.java:147)
      at org.eclipse.jgit.ignore.internal.PathMatcher.createPathMatcher(PathMatcher.java:127)
      at org.eclipse.jgit.ignore.FastIgnoreRule.<init>(FastIgnoreRule.java:112)
      at org.eclipse.jgit.ignore.IgnoreNode.parse(IgnoreNode.java:114)
      at org.eclipse.jgit.treewalk.WorkingTreeIterator$RootIgnoreNode.loadRulesFromFile(WorkingTreeIterator.java:1267)

The differences in behavior cygwin and native win. terminal:
in

org.eclipse.jgit.treewalk.WorkingTreeIterator.RootIgnoreNode#load()

the code

((CoreConfig)this.repository.getConfig().get(CoreConfig.KEY)).getExcludesFile();

somehow returns "C:\cygwin64\bin\git.exe" for Cygwin env,
for winterm it is null

Updated TestCase:

  1. Download and Rename to zip and unpack - testCase222.zip.txt
  2. run git init and commit all files
  3. in the project dir run in terminal $ mvn clean install

the absurd is here:
_C:\Users\userName.gitconfig_:

[core]
    excludesfile = C:\\cygwin64\\bin\\git.exe

looks like it was added by some software.

Summarizing:
it isn't problem of _maven-git-commit-id-plugin_ ... and isn't strictly JGit's bug, but problem with error reporting.
What do you think about it?

Can you test this with the latest git-commit-id-plugin-Version?

<dependency>
    <groupId>pl.project13.maven</groupId>
    <artifactId>git-commit-id-plugin</artifactId>
    <version>2.2.1</version>
</dependency>

Can not reproduce with the following:

<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.0</version>
$ uname -a
CYGWIN_NT-10.0 DESKTOP-RHOE5VG 2.8.2(0.313/5/3) 2017-07-12 10:58 x86_64 Cygwin
$ mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T12:39:06-07:00)
Maven home: C:\apache-maven-3.5.0
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_131\jre
Default locale: en_US, platform encoding: UFT8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Picked up JAVA_TOOL_OPTIONS:  -Dfile.encoding=UFT8
$ git --version
git version 2.13.2
$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Picked up JAVA_TOOL_OPTIONS:  -Dfile.encoding=UFT8

Suspect that there was an issue with the provided cygwin git binary (see error: This program cannot be run in DOS mode.)

~ Closing as can not reproduce / might be fixed / updated jgit implementation several times now ~

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jinyanroot picture jinyanroot  Â·  8Comments

ghost picture ghost  Â·  6Comments

Randgalt picture Randgalt  Â·  5Comments

sgrmgj-quotient picture sgrmgj-quotient  Â·  4Comments

TheSnoozer picture TheSnoozer  Â·  7Comments