From 6737c15794d08855b9e8c191fa23d4220f5e4171 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Sun, 9 Apr 2017 12:51:26 +0900 Subject: [PATCH 1/5] Upgrade JGit to 4.5.2.201704071617-r This includes more fixes for handling of invalid packfiles. See JGit bug 514170 [1] for details. [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=514170 Change-Id: I5de2fedee90c600abb1bc78fdda6e215f1ddc291 --- lib/JGIT_VERSION | 2 +- lib/jgit/org.eclipse.jgit.archive/BUCK | 2 +- lib/jgit/org.eclipse.jgit.http.server/BUCK | 2 +- lib/jgit/org.eclipse.jgit.junit/BUCK | 2 +- lib/jgit/org.eclipse.jgit/BUCK | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/JGIT_VERSION b/lib/JGIT_VERSION index 133af5b6a5..abd06f33ef 100644 --- a/lib/JGIT_VERSION +++ b/lib/JGIT_VERSION @@ -1,6 +1,6 @@ include_defs('//lib/maven.defs') REPO = MAVEN_CENTRAL # Leave here even if set to MAVEN_CENTRAL. -VERS = '4.5.1.201703201650-r' +VERS = '4.5.2.201704071617-r' DOC_VERS = VERS # Set to VERS unless using a snapshot JGIT_DOC_URL="http://download.eclipse.org/jgit/site/" + DOC_VERS + "/apidocs" diff --git a/lib/jgit/org.eclipse.jgit.archive/BUCK b/lib/jgit/org.eclipse.jgit.archive/BUCK index aa21199d3f..ab95e2a189 100644 --- a/lib/jgit/org.eclipse.jgit.archive/BUCK +++ b/lib/jgit/org.eclipse.jgit.archive/BUCK @@ -4,7 +4,7 @@ include_defs('//lib/JGIT_VERSION') maven_jar( name = 'jgit-archive', id = 'org.eclipse.jgit:org.eclipse.jgit.archive:' + VERS, - sha1 = 'a804e89f0323769d672c70cecf892bd245b8e50e', + sha1 = 'd70270a355e8582c21a74c34fae0dfec4b641632', license = 'jgit', repository = REPO, deps = ['//lib/jgit/org.eclipse.jgit:jgit'], diff --git a/lib/jgit/org.eclipse.jgit.http.server/BUCK b/lib/jgit/org.eclipse.jgit.http.server/BUCK index 63e26e94bb..c157becc13 100644 --- a/lib/jgit/org.eclipse.jgit.http.server/BUCK +++ b/lib/jgit/org.eclipse.jgit.http.server/BUCK @@ -4,7 +4,7 @@ include_defs('//lib/JGIT_VERSION') maven_jar( name = 'jgit-servlet', id = 'org.eclipse.jgit:org.eclipse.jgit.http.server:' + VERS, - sha1 = 'a3a64886a85ffe1a8d59231413dcfa35bb2fa79c', + sha1 = '04cf57795ffd2a577a20746f9c6a0b0922438dd9', license = 'jgit', repository = REPO, deps = ['//lib/jgit/org.eclipse.jgit:jgit'], diff --git a/lib/jgit/org.eclipse.jgit.junit/BUCK b/lib/jgit/org.eclipse.jgit.junit/BUCK index dda654dd65..043fe6215d 100644 --- a/lib/jgit/org.eclipse.jgit.junit/BUCK +++ b/lib/jgit/org.eclipse.jgit.junit/BUCK @@ -4,7 +4,7 @@ include_defs('//lib/JGIT_VERSION') maven_jar( name = 'junit', id = 'org.eclipse.jgit:org.eclipse.jgit.junit:' + VERS, - sha1 = '3d953a327cda2b268a560b59c224a5f4d9dbd956', + sha1 = '5eaebfd74c106ac5cbee9e4303f19165812f23c6', license = 'DO_NOT_DISTRIBUTE', repository = REPO, unsign = True, diff --git a/lib/jgit/org.eclipse.jgit/BUCK b/lib/jgit/org.eclipse.jgit/BUCK index 812091dfa3..a0c3faed90 100644 --- a/lib/jgit/org.eclipse.jgit/BUCK +++ b/lib/jgit/org.eclipse.jgit/BUCK @@ -4,8 +4,8 @@ include_defs('//lib/JGIT_VERSION') maven_jar( name = 'jgit', id = 'org.eclipse.jgit:org.eclipse.jgit:' + VERS, - bin_sha1 = '6ce6464c427ea86bff2f9787be72387eb8e33aa4', - src_sha1 = 'fa948f2fbf38e5af31acad17bedbe466a7ddb726', + bin_sha1 = '01352ebdefb10aab661b97413f651bd6ca3766ce', + src_sha1 = 'ad713d18ed0fa71279b002e2c1340a35dfbefee7', license = 'jgit', repository = REPO, unsign = True, From fe862e319fc590ff3efd7894cf49263f06bec113 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Sun, 9 Apr 2017 12:51:45 +0900 Subject: [PATCH 2/5] Set version to 2.13.8 Change-Id: If81014e469b41d7ad093c5c56645f5b08eed2d87 --- Documentation/dev-plugins.txt | 2 +- VERSION | 2 +- gerrit-acceptance-framework/pom.xml | 2 +- gerrit-extension-api/pom.xml | 2 +- gerrit-plugin-api/pom.xml | 2 +- gerrit-plugin-archetype/pom.xml | 2 +- gerrit-plugin-gwt-archetype/pom.xml | 2 +- gerrit-plugin-gwtui/pom.xml | 2 +- gerrit-plugin-js-archetype/pom.xml | 2 +- gerrit-war/pom.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt index a21886ae9d..f009e9271c 100644 --- a/Documentation/dev-plugins.txt +++ b/Documentation/dev-plugins.txt @@ -36,7 +36,7 @@ plugin project. ---- mvn archetype:generate -DarchetypeGroupId=com.google.gerrit \ -DarchetypeArtifactId=gerrit-plugin-archetype \ - -DarchetypeVersion=2.13.7 \ + -DarchetypeVersion=2.13.8 \ -DgroupId=com.googlesource.gerrit.plugins.testplugin \ -DartifactId=testplugin ---- diff --git a/VERSION b/VERSION index 169c40b064..9818915fdc 100644 --- a/VERSION +++ b/VERSION @@ -2,4 +2,4 @@ # Used by :api_install and :api_deploy targets # when talking to the destination repository. # -GERRIT_VERSION = '2.13.7' +GERRIT_VERSION = '2.13.8' diff --git a/gerrit-acceptance-framework/pom.xml b/gerrit-acceptance-framework/pom.xml index e8ba7c76db..b8b051dec3 100644 --- a/gerrit-acceptance-framework/pom.xml +++ b/gerrit-acceptance-framework/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-acceptance-framework - 2.13.7 + 2.13.8 jar Gerrit Code Review - Acceptance Test Framework Framework for Gerrit's acceptance tests diff --git a/gerrit-extension-api/pom.xml b/gerrit-extension-api/pom.xml index 4caf8751bf..9618e602bd 100644 --- a/gerrit-extension-api/pom.xml +++ b/gerrit-extension-api/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-extension-api - 2.13.7 + 2.13.8 jar Gerrit Code Review - Extension API API for Gerrit Extensions diff --git a/gerrit-plugin-api/pom.xml b/gerrit-plugin-api/pom.xml index fe6eb3790d..09ed855e98 100644 --- a/gerrit-plugin-api/pom.xml +++ b/gerrit-plugin-api/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-plugin-api - 2.13.7 + 2.13.8 jar Gerrit Code Review - Plugin API API for Gerrit Plugins diff --git a/gerrit-plugin-archetype/pom.xml b/gerrit-plugin-archetype/pom.xml index 27f662d85c..b637f4ea2c 100644 --- a/gerrit-plugin-archetype/pom.xml +++ b/gerrit-plugin-archetype/pom.xml @@ -20,7 +20,7 @@ limitations under the License. com.google.gerrit gerrit-plugin-archetype - 2.13.7 + 2.13.8 Gerrit Code Review - Plugin Archetype Maven Archetype for Gerrit Plugins https://www.gerritcodereview.com/ diff --git a/gerrit-plugin-gwt-archetype/pom.xml b/gerrit-plugin-gwt-archetype/pom.xml index c492c3cb4d..1e6c31bdfc 100644 --- a/gerrit-plugin-gwt-archetype/pom.xml +++ b/gerrit-plugin-gwt-archetype/pom.xml @@ -20,7 +20,7 @@ limitations under the License. com.google.gerrit gerrit-plugin-gwt-archetype - 2.13.7 + 2.13.8 Gerrit Code Review - Web UI GWT Plugin Archetype Maven Archetype for Gerrit Web UI GWT Plugins https://www.gerritcodereview.com/ diff --git a/gerrit-plugin-gwtui/pom.xml b/gerrit-plugin-gwtui/pom.xml index 549e3d539a..b548dc3c17 100644 --- a/gerrit-plugin-gwtui/pom.xml +++ b/gerrit-plugin-gwtui/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-plugin-gwtui - 2.13.7 + 2.13.8 jar Gerrit Code Review - Plugin GWT UI Common Classes for Gerrit GWT UI Plugins diff --git a/gerrit-plugin-js-archetype/pom.xml b/gerrit-plugin-js-archetype/pom.xml index 52c67b731e..fe559ac315 100644 --- a/gerrit-plugin-js-archetype/pom.xml +++ b/gerrit-plugin-js-archetype/pom.xml @@ -20,7 +20,7 @@ limitations under the License. com.google.gerrit gerrit-plugin-js-archetype - 2.13.7 + 2.13.8 Gerrit Code Review - Web UI JavaScript Plugin Archetype Maven Archetype for Gerrit Web UI JavaScript Plugins https://www.gerritcodereview.com/ diff --git a/gerrit-war/pom.xml b/gerrit-war/pom.xml index 0f0b875e02..ca5b9fc1fe 100644 --- a/gerrit-war/pom.xml +++ b/gerrit-war/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-war - 2.13.7 + 2.13.8 war Gerrit Code Review - WAR Gerrit WAR From 7608de0aa27c28a665faf91d9001b49f6ca3c047 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Fri, 7 Apr 2017 20:27:33 +0900 Subject: [PATCH 3/5] Update blame-cache to 0.2-1 Change-Id: If6507cea23bca1fcfa39fa941c3b8eb51e2d09da --- WORKSPACE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 573aab219b..b2caccd466 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -556,10 +556,10 @@ maven_jar( maven_jar( name = "blame_cache", - artifact = "com/google/gitiles:blame-cache:0.2", + artifact = "com/google/gitiles:blame-cache:0.2-1", attach_source = False, repository = GERRIT, - sha1 = "519fc548df920123bce986056d2f644663665ae4", + sha1 = "da7977e8b140b63f18054214c1d1b86ffa6896cb", ) # Keep this version of Soy synchronized with the version used in Gitiles. From 8a201721720debf10e31496ca45790e75be46f4c Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 11 Apr 2017 13:54:05 +0900 Subject: [PATCH 4/5] Format Java files with google-java-format Change-Id: I6fbea77754ba61cb30e53037210afa3756268ea3 --- .../main/java/com/google/gerrit/client/info/ServerInfo.java | 3 ++- .../java/com/google/gerrit/server/config/GetServerInfo.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/ServerInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/ServerInfo.java index 0a37307756..dcd1cf1e39 100644 --- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/ServerInfo.java +++ b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/ServerInfo.java @@ -70,7 +70,8 @@ public class ServerInfo extends JavaScriptObject { public final native String replyTooltip() /*-{ return this.reply_tooltip; }-*/; - public final native boolean showAssigneeInChangesTable() /*-{ return this.show_assignee_in_changes_table || false; }-*/; + public final native boolean + showAssigneeInChangesTable() /*-{ return this.show_assignee_in_changes_table || false; }-*/; public final native int updateDelay() /*-{ return this.update_delay || 0; }-*/; diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/config/GetServerInfo.java b/gerrit-server/src/main/java/com/google/gerrit/server/config/GetServerInfo.java index 3907c989b7..c0da3f3392 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/config/GetServerInfo.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/config/GetServerInfo.java @@ -207,7 +207,8 @@ public class GetServerInfo implements RestReadView { boolean hasAssigneeInIndex = indexes.getSearchIndex().getSchema().hasField(ChangeField.ASSIGNEE); info.showAssigneeInChangesTable = - toBoolean(cfg.getBoolean("change", "showAssigneeInChangesTable", false) && hasAssigneeInIndex); + toBoolean( + cfg.getBoolean("change", "showAssigneeInChangesTable", false) && hasAssigneeInIndex); info.largeChange = cfg.getInt("change", "largeChange", 500); info.replyTooltip = Optional.ofNullable(cfg.getString("change", null, "replyTooltip")).orElse("Reply and score") From 4bb459957c3d7d2b03d0fefff2ee7e8cb79b0c8c Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 11 Apr 2017 13:54:27 +0900 Subject: [PATCH 5/5] PluginLoader: Remove stale plugin files from /tmp on startup When plugins are loaded, they are copied to /tmp and run from that location. A CleanupHandler is created, which then deletes the file from /tmp on server shutdown. However, if the server is not shutdown gracefully, the cleanup does not get run and the file remains in the /tmp folder. If this happens frequently, the number of stale files in /tmp increases over time. On startup, scan the /tmp folder for plugin files and remove them. Bug: Issue 5965 Change-Id: Ic58c84cabee747981e8149180c597b7bc7440e3a --- .../gerrit/server/plugins/PluginLoader.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/plugins/PluginLoader.java b/gerrit-server/src/main/java/com/google/gerrit/server/plugins/PluginLoader.java index 957bdd7858..ac57bc9040 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/plugins/PluginLoader.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/plugins/PluginLoader.java @@ -79,6 +79,7 @@ public class PluginLoader implements LifecycleListener { private final Path pluginsDir; private final Path dataDir; + private final Path tempDir; private final PluginGuiceEnvironment env; private final ServerInformationImpl srvInfoImpl; private final PluginUser.Factory pluginUserFactory; @@ -107,6 +108,7 @@ public class PluginLoader implements LifecycleListener { UniversalServerPluginProvider pluginFactory) { pluginsDir = sitePaths.plugins_dir; dataDir = sitePaths.data_dir; + tempDir = sitePaths.tmp_dir; env = pe; srvInfoImpl = sii; pluginUserFactory = puf; @@ -325,8 +327,34 @@ public class PluginLoader implements LifecycleListener { } } + private void removeStalePluginFiles() { + DirectoryStream.Filter filter = + new DirectoryStream.Filter() { + @Override + public boolean accept(Path entry) throws IOException { + return entry.getFileName().toString().startsWith("plugin_"); + } + }; + try (DirectoryStream files = Files.newDirectoryStream(tempDir, filter)) { + for (Path file : files) { + log.info("Removing stale plugin file: " + file.toFile().getName()); + try { + Files.delete(file); + } catch (IOException e) { + log.error( + String.format( + "Failed to remove stale plugin file %s: %s", + file.toFile().getName(), e.getMessage())); + } + } + } catch (IOException e) { + log.warn("Unable to discover stale plugin files: " + e.getMessage()); + } + } + @Override public synchronized void start() { + removeStalePluginFiles(); log.info("Loading plugins from " + pluginsDir.toAbsolutePath()); srvInfoImpl.state = ServerInformation.State.STARTUP; rescan();