palantir / gradle-git-version

a Gradle plugin that uses `git describe` to produce a version string.
Apache License 2.0
372 stars 76 forks source link

Access violation when run as normal user #490

Open stayleen opened 3 years ago

stayleen commented 3 years ago

What happened?

When the plugin is run without Administrator privileges, it tries to access C:\Program Files\Git\etc to create a file called

.probe-<some UUID>

This results in an access violation. The UUID is different for each run, so it does not help to create the directory by hand, which I tried as a workaround. I am running gradle within IntelliJ. When I run IntelliJ as Administrator, this exception does not occur.

Is there a way to tell the plugin where to create its probe files to get around this?

Git for Windows version: 2.31.1.windows.1 Plugin version: 0.12.3

Configure project : C:\Program Files\Git\etc.probe-8705efe9-59ab-42a8-acc2-545b02b5b940 java.nio.file.AccessDeniedException: C:\Program Files\Git\etc.probe-8705efe9-59ab-42a8-acc2-545b02b5b940 at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89) at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) at java.base/sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:235) at java.base/java.nio.file.Files.newByteChannel(Files.java:371) at java.base/java.nio.file.Files.createFile(Files.java:648) at org.eclipse.jgit.util.FS$FileStoreAttributeCache.(FS.java:234) at org.eclipse.jgit.util.FS$FileStoreAttributeCache.getFsTimestampResolution(FS.java:211) at org.eclipse.jgit.util.FS.getFsTimerResolution(FS.java:321) at org.eclipse.jgit.internal.storage.file.FileSnapshot.(FileSnapshot.java:186) at org.eclipse.jgit.internal.storage.file.FileSnapshot.save(FileSnapshot.java:122) at org.eclipse.jgit.storage.file.FileBasedConfig.load(FileBasedConfig.java:155) at org.eclipse.jgit.internal.storage.file.FileRepository.loadSystemConfig(FileRepository.java:252) at org.eclipse.jgit.internal.storage.file.FileRepository.(FileRepository.java:205) at org.eclipse.jgit.internal.storage.file.FileRepository.(FileRepository.java:153) at com.palantir.gradle.gitversion.GitVersionPlugin.gitRepo(GitVersionPlugin.java:73) at com.palantir.gradle.gitversion.GitVersionPlugin.apply(GitVersionPlugin.java:36) at com.palantir.gradle.gitversion.GitVersionPlugin.apply(GitVersionPlugin.java:29) at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:42) at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:50) at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:177) at org.gradle.api.internal.plugins.DefaultPluginManager.access$300(DefaultPluginManager.java:51) at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:267) ....

ilka-schulz commented 3 years ago

could not reproduce on GNU/Linux (Debian 10 x86_64)

suppergerrie2 commented 3 years ago

This seems to be an issue in JGit: https://bugs.eclipse.org/bugs/show_bug.cgi?id=548648, updating to > 5.4.2 should fix it. It doesn't seem to stop the plugin from working but does throw an error everytime a gradle task is executed.

wsdng commented 2 years ago

I have the same issue. What about the initial question: "Is there a way to tell the plugin where to create its probe files to get around this?"