Gerrit2 DatabasePubKeyAuth.java compile error

39 views
Skip to first unread message

Simon Liu

unread,
Jan 5, 2009, 1:25:55 AM1/5/09
to Repo and Gerrit Discussion, s...@google.com
I installed the Gerrit2 follow the introduce
http://android.git.kernel.org/?p=tools/gerrit.git;a=blob;f=DEV_README;hb=gerrit2#l11

I finished the MINA and database part. And installed the Jetty by "
apt-get install jetty ".

Then I modify the to_jetty.sh file to fit in my Jetty installation in
Ubuntu:
11c11
< if ! [ -f "$jetty/lib/start.jar" ]
---
> if ! [ -f "$jetty/etc/jetty.xml" ]

Then I run ./to_jetty.sh /usr/share/jetty/

It report some error :

[INFO] [compiler:compile]
[INFO] Compiling 215 source files to /export/home/simon/gerrit2/gerrit/
appdist/../appjar/target/classes
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Compilation failure

/export/home/simon/gerrit2/gerrit/appdist/../appjar/src/main/java/com/
google/gerrit/server/ssh/SshUtil.java:[25,37] cannot find symbol
symbol : class AttributeKey
location: package org.apache.sshd.common.session

/export/home/simon/gerrit2/gerrit/appdist/../appjar/src/main/java/com/
google/gerrit/server/ssh/SshUtil.java:[48,15] cannot find symbol
symbol : class AttributeKey
location: class com.google.gerrit.server.ssh.SshUtil

/export/home/simon/gerrit2/gerrit/appdist/../appjar/src/main/java/com/
google/gerrit/server/ssh/SshUtil.java:[49,10] cannot find symbol
symbol : class AttributeKey
location: class com.google.gerrit.server.ssh.SshUtil

/export/home/simon/gerrit2/gerrit/appdist/../appjar/src/main/java/com/
google/gerrit/server/ssh/DatabasePubKeyAuth.java:[38,0]
com.google.gerrit.server.ssh.DatabasePubKeyAuth is not abstract and
does not override abstract method hasKey
(java.lang.String,java.security.PublicKey) in
org.apache.sshd.server.PublickeyAuthenticator

It is the error message from " (cd appdist && mvn package) && ".

My build environment is Ubuntu 8.04 with java 1.6.0_07-b06 . Please
help to this error.

Shawn Pearce

unread,
Jan 5, 2009, 2:12:35 AM1/5/09
to Simon Liu, Repo and Gerrit Discussion
These compile errors are because you need a series of 3 patches I have proposed for MINA SSHD but which haven't been accepted upstream yet.  You need the patches off these issues:

  https://issues.apache.org/jira/browse/SSHD-11
  https://issues.apache.org/jira/browse/SSHD-10
  https://issues.apache.org/jira/browse/SSHD-6

Its been taking upstream a while to comment on these, or to apply them.  I may wind up needing to start distributing a fork of SSHD like I do with JGit to keep Gerrit moving along while upstream is busy.

Shawn Pearce

unread,
Jan 5, 2009, 2:19:55 AM1/5/09
to Simon Liu, Repo and Gerrit Discussion
Oh, also, I'm not sure anyone else has successfully setup Gerrit 2 besides me.  I would really appreciate any notes, especially pitfalls you run into, about the setup process so we can make it easier for people who aren't me to deploy it.  :)

Shawn Pearce

unread,
Jan 5, 2009, 11:38:05 PM1/5/09
to Simon Liu, Repo and Gerrit Discussion
There is now a fork of mina_sshd available through git.  repo sync should pull it down automatically if you are following the gerrit2 branch.

On Sun, Jan 4, 2009 at 23:12, Shawn Pearce <s...@google.com> wrote:

Simon Liu

unread,
Jan 6, 2009, 3:31:31 AM1/6/09
to Repo and Gerrit Discussion
I found two issue when I try to deploy the Gerrit2.

1. The repository of gwtorm and gwtjsonrpc in gerrit2/gerrit/appjar/
pom.xml is not availiable.
resolve: Currently, I manual compile the package ship with Gerrit2 and
install it to local.

2. the file gerrit/devdb/jdbc-postgresql.jar is missing so it will
fail when run to_jetty.sh
resolve: I download one from http://jdbc.postgresql.org/download/postgresql-8.3-604.jdbc4.jar

Here is my last operation log:

## *** install the local library since the repository in gerrit2/
gerrit/appjar/pom.xml is not availiable anymore

cd $HOME/gerrit2/gwtorm
mvn package

cd $HOME/gerrit2/gwtjsonrpc
mvn package

cd $HOME/gerrit2/appjar
mvn install:install-file -DgroupId=gwtorm -DartifactId=gwtorm -
Dversion=0.1-SNAPSHOT -Dpackaging=jar -Dfile=$HOME/gerrit2/gwtorm/
target/gwtorm-0.1-SNAPSHOT.jar
mvn install:install-file -DgroupId=gwtjsonrpc -DartifactId=gwtjsonrpc -
Dversion=0.1-SNAPSHOT -Dpackaging=jar -Dfile=$HOME/gerrit2/gwtjsonrpc/
target/gwtjsonrpc-0.1-SNAPSHOT.jar

## *** download the missing jdbc-postgres.jar in gerrit/devdb
cd $HOME/gerrit2/gerrit/devdb
wget http://jdbc.postgresql.org/download/postgresql-8.3-604.jdbc4.jar
mv postgresql-8.3-604.jdbc4.jar jdbc-postgresql.jar


## deploy to Jetty
cd $HOME/gerrit2/gerrit
./to_jetty.my.sh /usr/share/jetty/


At here, there is a error happen. When I run to_jetty.sh with normal
user account, it hint " cp: cannot create regular file `/usr/share/
jetty//lib/plus': Permission denied " .
When I switch to super user to run it by " sudo ./to_jetty.my.sh /usr/
share/jetty/", it download and compile and package again, but fail at
jgit test.
============== bellow is the message =============
[INFO]
------------------------------------------------------------------------
[INFO] Building jgit
[INFO] task-segment: [package]
[INFO]
------------------------------------------------------------------------
...
-------------------------------------------------------
T E S T S
-------------------------------------------------------
...
Running org.spearce.jgit.treewalk.TreeWalkBasicDiffTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.014
sec
Running org.spearce.jgit.lib.T0003_Basic
Tests run: 23, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.215
sec <<< FAILURE!
Running org.spearce.jgit.lib.T0008_testparserev
Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.109
sec
...
Results :

Failed tests:
test002_WriteEmptyTree(org.spearce.jgit.lib.T0003_Basic)
test003_WriteShouldBeEmptyTree(org.spearce.jgit.lib.T0003_Basic)
============== message end =============

My git version is 1.6.0.3 .


Regards
Simon Liu

Shawn Pearce

unread,
Jan 6, 2009, 2:06:56 PM1/6/09
to repo-d...@googlegroups.com
On Tue, Jan 6, 2009 at 00:31, Simon Liu <yunta...@gmail.com> wrote:

I found two issue when I try to deploy the Gerrit2. 
## deploy to Jetty
cd $HOME/gerrit2/gerrit
./to_jetty.my.sh  /usr/share/jetty/

Hmm, OK.  I should update the docs to say something about don't try to deploy into a root owned Jetty because it might not work. I've only ever tested it with a Jetty installed in my user account, or in the daemon's user account.

For the record, I setup the production Gerrit2 server yesterday.  I'm still waiting on a DNS record for it to get sent up to the android.com DNS servers, but its running so people can poke at it.  Anyway, the way I setup that server was I created a "gerrit2" user account and unpacked Jetty at ~/jetty, then tossed Gerrit into that server deployment.

In theory yes, it should deploy just fine under a root owned container, but the container needs to publish a JNDI DataSource for the database, which means the container needs the JDBC drivers and DataSource implementation in a classpath somewhere.  With Jetty I thought that was just tossing the JARs under $JETTY_HOME/lib/plus/, but maybe not...  anyone know?

Perhaps since your distro vendor has Jetty available as a package it also has the PostgreSQL JDBC driver available and can automatically register it with Jetty?  I don't know.  If it matters I'm running on Ubuntu, but I manage all of the software I really care about (e.g. Jetty, PostgreSQL, Gerrit, etc.) outside of the distro.

share/jetty/", it download and compile and package again, but fail at
jgit test.
...
Failed tests:
 test002_WriteEmptyTree(org.spearce.jgit.lib.T0003_Basic)
 test003_WriteShouldBeEmptyTree(org.spearce.jgit.lib.T0003_Basic)

Wow.  Must be something about the tests.  Nobody has ever run the JGit unit tests as root before.  Can you look under your jgit/jgit-maven/jgit/target directory, there's a surefire-reports or something with the output from this test.  I'd be interested in knowing what failed under root.  The tests should work as root, but building and testing software as root isn't generally encouraged by anyone.

My git version is 1.6.0.3 .

Doesn't matter.   JGit is a full re-implementation of Git.  It never calls out to the Git binary.

Shawn Pearce

unread,
Jan 6, 2009, 7:14:16 PM1/6/09
to repo-d...@googlegroups.com
On Tue, Jan 6, 2009 at 00:31, Simon Liu <yunta...@gmail.com> wrote:

I found two issue when I try to deploy the Gerrit2.

1. The repository of gwtorm and gwtjsonrpc in gerrit2/gerrit/appjar/
pom.xml is not availiable.
resolve: Currently, I manual compile the package ship with Gerrit2 and
install it to local.

2. the file gerrit/devdb/jdbc-postgresql.jar is missing so it will
fail when run to_jetty.sh
resolve: I download one from http://jdbc.postgresql.org/download/postgresql-8.3-604.jdbc4.jar

I think I've worked around these.  The INSTALL document now suggests using "mvn install" to build, due to these packages not being available from a repository, and the postgresql jar is now automatically fetched by Maven.  So is the c3p0 JDBC pool implementation.

Simon Liu

unread,
Jan 8, 2009, 1:45:36 AM1/8/09
to Repo and Gerrit Discussion
hi,

I am using Ubuntu 8.04 and I installed the jetty by " sudo apt-get
install jetty " . It seems that the webapps directory of jetty is
installed to /usr/share/jetty .

Because the etc directory and jetty.xml is install to /etc/jetty , so
I modify the to_jetty.sh for this :
11c11
< if ! [ -f "$jetty/lib/start.jar" ]
---
> if ! [ -f "$jetty/etc/jetty.xml" ]


And I also modify it this, because I find the filename is wrong in
original form. Is it right?
17c17
< out=appdist/target/gerrit-*-bin &&
---
> out=appdist/target/gerrit-*-bin.dir &&


The bellow is the report file content after I run " sodo to_jetty.sh /
usr/share/jetty ":
==================== start =====================
"
============================================================================
" Netrw Directory Listing
(netrw v109)
" /export/home/simon/gerrit2/jgit/jgit-maven/jgit/target/surefire-
reports
" Sorted by name
" Sort sequence: [\/]$,\.h$,\.c$,\.cpp$,\.[a-np-z]$,*,\.info$,\.swp$,
\.o$\.obj$,\.bak$
" Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by
x:exec
"
============================================================================
../
./
TEST-org.spearce.jgit.dircache.DirCacheBasicTest.xml
TEST-org.spearce.jgit.dircache.DirCacheBuilderIteratorTest.xml
TEST-org.spearce.jgit.dircache.DirCacheBuilderTest.xml
TEST-org.spearce.jgit.dircache.DirCacheCGitCompatabilityTest.xml
TEST-org.spearce.jgit.dircache.DirCacheFindTest.xml
TEST-org.spearce.jgit.dircache.DirCacheIteratorTest.xml
TEST-org.spearce.jgit.dircache.DirCacheLargePathTest.xml
TEST-org.spearce.jgit.dircache.DirCacheTreeTest.xml
TEST-org.spearce.jgit.fnmatch.FileNameMatcherTest.xml
TEST-org.spearce.jgit.lib.AbbreviatedObjectIdTest.xml
TEST-org.spearce.jgit.lib.ConstantsEncodingTest.xml
TEST-org.spearce.jgit.lib.IndexDiffTest.xml
TEST-org.spearce.jgit.lib.IndexTreeWalkerTest.xml
TEST-org.spearce.jgit.lib.ObjectCheckerTest.xml
TEST-org.spearce.jgit.lib.ObjectIdMapTest.xml
TEST-org.spearce.jgit.lib.PackIndexV1Test.xml
TEST-org.spearce.jgit.lib.PackIndexV2Test.xml
TEST-org.spearce.jgit.lib.PackReverseIndexTest.xml
TEST-org.spearce.jgit.lib.PackWriterTest.xml
TEST-org.spearce.jgit.lib.ReadTreeTest.xml
TEST-org.spearce.jgit.lib.RefUpdateTest.xml
TEST-org.spearce.jgit.lib.RepositoryConfigTest.xml
TEST-org.spearce.jgit.lib.T0001_ObjectId.xml
TEST-org.spearce.jgit.lib.T0001_PersonIdent.xml
TEST-org.spearce.jgit.lib.T0002_Tree.xml
TEST-org.spearce.jgit.lib.T0003_Basic.xml
TEST-org.spearce.jgit.lib.T0004_PackReader.xml
TEST-org.spearce.jgit.lib.T0007_Index.xml
TEST-org.spearce.jgit.lib.T0008_testparserev.xml
TEST-org.spearce.jgit.lib.TreeIteratorLeafOnlyTest.xml
TEST-org.spearce.jgit.lib.TreeIteratorPostOrderTest.xml
TEST-org.spearce.jgit.lib.TreeIteratorPreOrderTest.xml
TEST-org.spearce.jgit.lib.WorkDirCheckoutTest.xml
TEST-org.spearce.jgit.patch.FileHeaderTest.xml
TEST-org.spearce.jgit.patch.GetTextTest.xml
TEST-org.spearce.jgit.patch.PatchCcErrorTest.xml
TEST-org.spearce.jgit.patch.PatchCcTest.xml
TEST-org.spearce.jgit.patch.PatchErrorTest.xml
TEST-org.spearce.jgit.patch.PatchTest.xml
TEST-org.spearce.jgit.revwalk.RevCommitParseTest.xml
TEST-org.spearce.jgit.transport.BundleWriterTest.xml
TEST-org.spearce.jgit.transport.IndexPackTest.xml
TEST-org.spearce.jgit.transport.OpenSshConfigTest.xml
TEST-org.spearce.jgit.transport.PushProcessTest.xml
TEST-org.spearce.jgit.transport.RefSpecTestCase.xml
TEST-org.spearce.jgit.transport.RemoteConfigTest.xml
TEST-org.spearce.jgit.transport.TransportTest.xml
TEST-org.spearce.jgit.transport.URIishTest.xml
TEST-org.spearce.jgit.treewalk.CanonicalTreeParserTest.xml
TEST-org.spearce.jgit.treewalk.EmptyTreeIteratorTest.xml
TEST-org.spearce.jgit.treewalk.FileTreeIteratorTest.xml
TEST-org.spearce.jgit.treewalk.NameConflictTreeWalkTest.xml
TEST-org.spearce.jgit.treewalk.PostOrderTreeWalkTest.xml
TEST-org.spearce.jgit.treewalk.TreeWalkBasicDiffTest.xml
TEST-org.spearce.jgit.treewalk.filter.NotTreeFilterTest.xml
TEST-org.spearce.jgit.treewalk.filter.TreeFilterTest.xml
TEST-org.spearce.jgit.util.IntListTest.xml
TEST-org.spearce.jgit.util.NBTest.xml
TEST-org.spearce.jgit.util.QuotedStringBourneStyleTest.xml
TEST-org.spearce.jgit.util.QuotedStringBourneUserPathStyleTest.xml
TEST-org.spearce.jgit.util.QuotedStringGitPathStyleTest.xml
TEST-org.spearce.jgit.util.RawParseUtils_LineMapTest.xml
TEST-org.spearce.jgit.util.TemporaryBufferTest.xml
org.spearce.jgit.dircache.DirCacheBasicTest.txt
org.spearce.jgit.dircache.DirCacheBuilderIteratorTest.txt
org.spearce.jgit.dircache.DirCacheBuilderTest.txt
org.spearce.jgit.dircache.DirCacheCGitCompatabilityTest.txt
org.spearce.jgit.dircache.DirCacheFindTest.txt
org.spearce.jgit.dircache.DirCacheIteratorTest.txt
org.spearce.jgit.dircache.DirCacheLargePathTest.txt
org.spearce.jgit.dircache.DirCacheTreeTest.txt
org.spearce.jgit.fnmatch.FileNameMatcherTest.txt
org.spearce.jgit.lib.AbbreviatedObjectIdTest.txt
org.spearce.jgit.lib.ConstantsEncodingTest.txt
org.spearce.jgit.lib.IndexDiffTest.txt
org.spearce.jgit.lib.IndexTreeWalkerTest.txt
org.spearce.jgit.lib.ObjectCheckerTest.txt
org.spearce.jgit.lib.ObjectIdMapTest.txt
org.spearce.jgit.lib.PackIndexV1Test.txt
org.spearce.jgit.lib.PackIndexV2Test.txt
org.spearce.jgit.lib.PackReverseIndexTest.txt
org.spearce.jgit.lib.PackWriterTest.txt
org.spearce.jgit.lib.ReadTreeTest.txt
org.spearce.jgit.lib.RefUpdateTest.txt
org.spearce.jgit.lib.RepositoryConfigTest.txt
org.spearce.jgit.lib.T0001_ObjectId.txt
org.spearce.jgit.lib.T0001_PersonIdent.txt
org.spearce.jgit.lib.T0002_Tree.txt
org.spearce.jgit.lib.T0003_Basic.txt
org.spearce.jgit.lib.T0004_PackReader.txt
org.spearce.jgit.lib.T0007_Index.txt
org.spearce.jgit.lib.T0008_testparserev.txt
org.spearce.jgit.lib.TreeIteratorLeafOnlyTest.txt
org.spearce.jgit.lib.TreeIteratorPostOrderTest.txt
org.spearce.jgit.lib.TreeIteratorPreOrderTest.txt
org.spearce.jgit.lib.WorkDirCheckoutTest.txt
org.spearce.jgit.patch.FileHeaderTest.txt
org.spearce.jgit.patch.GetTextTest.txt
org.spearce.jgit.patch.PatchCcErrorTest.txt
org.spearce.jgit.patch.PatchCcTest.txt
org.spearce.jgit.patch.PatchErrorTest.txt
org.spearce.jgit.patch.PatchTest.txt
org.spearce.jgit.revwalk.RevCommitParseTest.txt
org.spearce.jgit.transport.BundleWriterTest.txt
org.spearce.jgit.transport.IndexPackTest.txt
org.spearce.jgit.transport.OpenSshConfigTest.txt
org.spearce.jgit.transport.PushProcessTest.txt
org.spearce.jgit.transport.RefSpecTestCase.txt
org.spearce.jgit.transport.RemoteConfigTest.txt
org.spearce.jgit.transport.TransportTest.txt
org.spearce.jgit.transport.URIishTest.txt
org.spearce.jgit.treewalk.CanonicalTreeParserTest.txt
org.spearce.jgit.treewalk.EmptyTreeIteratorTest.txt
org.spearce.jgit.treewalk.FileTreeIteratorTest.txt
org.spearce.jgit.treewalk.NameConflictTreeWalkTest.txt
org.spearce.jgit.treewalk.PostOrderTreeWalkTest.txt
org.spearce.jgit.treewalk.TreeWalkBasicDiffTest.txt
org.spearce.jgit.treewalk.filter.NotTreeFilterTest.txt
org.spearce.jgit.treewalk.filter.TreeFilterTest.txt
org.spearce.jgit.util.IntListTest.txt
org.spearce.jgit.util.NBTest.txt
org.spearce.jgit.util.QuotedStringBourneStyleTest.txt
org.spearce.jgit.util.QuotedStringBourneUserPathStyleTest.txt
org.spearce.jgit.util.QuotedStringGitPathStyleTest.txt
org.spearce.jgit.util.RawParseUtils_LineMapTest.txt
org.spearce.jgit.util.TemporaryBufferTest.txt
==================== end =====================



On 1月7日, 上午3时06分, Shawn Pearce <s...@google.com> wrote:

Wiktor

unread,
Jan 8, 2009, 4:19:07 AM1/8/09
to Repo and Gerrit Discussion
I managed to run Gerrit on Jetty (on Mac OS X).

I don't know why but when I go to http://localhost:8080/Gerrit#all all
I see is toolbar with All/Recent Changes&Unclaimed changes, Sign In
links and content saying:
"Not Found
The page you requested was not found."

Clicking on Sign In and going through Google Login screen results in
"Code Review - Unexpected Error -
com.google.gwt.user.client.rpc.InvocationException
Invalid JSON Response" ...weird!

Is it possible to enable logging in Gerrit? Or maybe it does log but I
don't know where is the log file.

Btw those are failed tests:
testDequote_OctalAll
(org.spearce.jgit.util.QuotedStringGitPathStyleTest)
testDequote_Latin1
(org.spearce.jgit.util.QuotedStringGitPathStyleTest)
testDequote_RawLatin1
(org.spearce.jgit.util.QuotedStringGitPathStyleTest)
testParse_implicit_mixed_encoded
(org.spearce.jgit.revwalk.RevCommitParseTest)
testParse_explicit_bad_encoded
(org.spearce.jgit.revwalk.RevCommitParseTest)
testGetText_DiffCc(org.spearce.jgit.patch.GetTextTest)

adding -Dmaven.test.skip=true to "mvn install" bypasses them.

Shawn Pearce

unread,
Jan 8, 2009, 10:37:23 AM1/8/09
to repo-d...@googlegroups.com
On Wed, Jan 7, 2009 at 22:45, Simon Liu <yunta...@gmail.com> wrote:

Because the etc directory and jetty.xml is install to /etc/jetty , so
I modify the to_jetty.sh for this :
11c11
< if ! [ -f "$jetty/lib/start.jar" ]
---
> if ! [ -f "$jetty/etc/jetty.xml" ]

Looks like you are looking at an older version of to_jetty.sh.  Try getting the latest, it already has this (and your other) fix.

The bellow is the report file content after I run " sodo to_jetty.sh /
usr/share/jetty ":

Ok, but what is in the file org.spearce.jgit.lib.T0003_Basic.java ?


Shawn Pearce

unread,
Jan 8, 2009, 10:46:34 AM1/8/09
to repo-d...@googlegroups.com
On Thu, Jan 8, 2009 at 01:19, Wiktor <wiktor.kw...@gmail.com> wrote:

I managed to run Gerrit on Jetty (on Mac OS X).

Yay!
 
I don't know why but when I go to http://localhost:8080/Gerrit#all all
I see is toolbar with All/Recent Changes&Unclaimed changes, Sign In
links and content saying:
"Not Found
The page you requested was not found."

Yup.  That's the current state of Gerrit when you aren't signed into a user account.  The entire "All" menu isn't implemented yet, because its mostly just a query thrown into a ChangeTable.  That's basically the same as the "#mine" page, so I haven't spent any time on these but instead focused on the signed-in user functions.

So #all doesn't exist, and you get a page saying it doesn't exist, but Gerrit assumes that URL should be there.  :-)
 
Clicking on Sign In and going through Google Login screen results in
"Code Review - Unexpected Error -
com.google.gwt.user.client.rpc.InvocationException
Invalid JSON Response" ...weird!

Yikes.  What browser is this?
 
Is it possible to enable logging in Gerrit? Or maybe it does log but I
don't know where is the log file.

The problem is that error is on the browser, where logging is always disabled when you generate a build for a browser. 

You'll have to try applying this patch to gwtjsonrpc and rebuilding Gerrit:

diff --git a/src/main/java/com/google/gwtjsonrpc/client/JsonUtil.java b/src/main/java/com/google/gwtjsonrpc/client/JsonUtil.java
index fdb1182..d2574ab 100644
--- a/src/main/java/com/google/gwtjsonrpc/client/JsonUtil.java
+++ b/src/main/java/com/google/gwtjsonrpc/client/JsonUtil.java
@@ -78,7 +78,7 @@ public class JsonUtil {
     try {
       resobj = encoded != null ? resultSerializer.fromJson(encoded) : null;
     } catch (RuntimeException e) {
-      callback.onFailure(new InvocationException("Invalid JSON Response", e));
+      callback.onFailure(new InvocationException("Invalid JSON Response: "+e, e));
       return;
     }
     callback.onSuccess(resobj);
 

Btw those are failed tests:
 testDequote_OctalAll
(org.spearce.jgit.util.QuotedStringGitPathStyleTest)
 testDequote_Latin1

Funny story... these JUnit tests pass just fine in Eclipse on Mac OS X.  They pass just fine in Maven on Linux.  They fail in Maven on Mac OS X.

When you look at the output files, the actual value produced by the code under test in the JUnit assert line created the correct result, but the *expected* value we are comparing to is incorrect.  Although the source files are encoded as UTF-8, and we use \uNNNN escapes for any character outside of the US-ASCII character set, and we told Maven to run javac with "-encoding UTF-8", somehow, somewhere, Maven did something that caused javac to produce incorrect String constants.  So JUnit is given the wrong expected input, JGit produces the correct result, and JUnit complains because they don't match.

If anyone has any ideas... I'm open.  Its driving me nuts.  I just gave up on it.

adding -Dmaven.test.skip=true to "mvn install" bypasses them.

Yup, that's what I do when building on Mac OS X.

Shawn Pearce

unread,
Jan 8, 2009, 2:11:47 PM1/8/09
to repo-d...@googlegroups.com
On Thu, Jan 8, 2009 at 07:46, Shawn Pearce <s...@google.com> wrote:
On Thu, Jan 8, 2009 at 01:19, Wiktor <wiktor.kw...@gmail.com> wrote:
Clicking on Sign In and going through Google Login screen results in
"Code Review - Unexpected Error -
com.google.gwt.user.client.rpc.InvocationException
Invalid JSON Response" ...weird!

Yikes.  What browser is this?

Huh, I just got this in Firefox 2.  I'm debugging it now... must be something recent that I introduced.

Shawn Pearce

unread,
Jan 8, 2009, 3:38:49 PM1/8/09
to repo-d...@googlegroups.com

Found it.  Its data dependent.

The following dates are not valid according to GWT, but only when compiled into JavaScript:

  2008-08-30
  2008-09-05
  2009-01-08

Under the hosted mode debugger things work fine, because the JRE's java.sql.Timestamp can parse these date strings correctly.  The emulated java.sql.Timestamp used by GWT only in JavaScript mode contains a fatal bug where it splits the string on "-" then proceeds to parse the segments as though they were octal strings... because they have a leading "0".

I'm committing a patch to gwtjsonrpc to work around it... should be online in a few minutes.

Simon Liu

unread,
Jan 8, 2009, 11:53:08 PM1/8/09
to Repo and Gerrit Discussion
This is the file /jgit/jgit-maven/jgit/target/surefire-reports/
org.spearce.jgit.lib.T0003_Basic.txt

-------------------------------------------------------------------------------
Test set: org.spearce.jgit.lib.T0003_Basic
-------------------------------------------------------------------------------
Tests run: 23, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.25
sec <<< FAILURE!
test002_WriteEmptyTree(org.spearce.jgit.lib.T0003_Basic) Time
elapsed: 0.03 sec <<< FAILURE!
junit.framework.AssertionFailedError: Read-only trash/
trash1231395890218.244/.git/objects/4b/
825dc642cb6eb9a060e54bf8d69288fbee4904
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at org.spearce.jgit.lib.T0003_Basic.test002_WriteEmptyTree
(T0003_Basic.java:87)

test003_WriteShouldBeEmptyTree(org.spearce.jgit.lib.T0003_Basic) Time
elapsed: 0.007 sec <<< FAILURE!
junit.framework.AssertionFailedError: Read-only trash/
trash1231395890255.246/.git/objects/7b/
b943559a305bdd6bdee2cef6e5df2413c3d30a
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at
org.spearce.jgit.lib.T0003_Basic.test003_WriteShouldBeEmptyTree
(T0003_Basic.java:114)




On 1月8日, 下午11时37分, Shawn Pearce <s...@google.com> wrote:

Wiktor

unread,
Jan 9, 2009, 7:54:41 AM1/9/09
to Repo and Gerrit Discussion
Thanks Shawn for the fix! Now everything works as expected.

I'll try to investigate jgit test failures next week (by the way -
just out of curiosity: why jgit's repository on android.git.kernel.org
is named "egit.git" - with e instead of j?).

One more issue. Maybe I'm missing something but I can't make Gerrit
display my git repositories. I did everything as described in INSTALL:

"- Create and configure the Git repository base:

This directory holds the Git repositories that Gerrit knows
about and can service. Gerrit needs write access to this
directory and any Git repository stored within it.

mkdir /srv/git
psql -c "UPDATE system_config SET git_base_path='/srv/git'" reviewdb"

Is git_base_path directory supposed to contain only bare repositories?
Or maybe they need to contain "git-daemon-export-ok" file?

Shawn Pearce

unread,
Jan 9, 2009, 10:22:29 AM1/9/09
to repo-d...@googlegroups.com
On Thu, Jan 8, 2009 at 20:53, Simon Liu <yunta...@gmail.com> wrote:

This is the file /jgit/jgit-maven/jgit/target/surefire-reports/
org.spearce.jgit.lib.T0003_Basic.txt

test002_WriteEmptyTree(org.spearce.jgit.lib.T0003_Basic)  Time
elapsed: 0.03 sec  <<< FAILURE!
junit.framework.AssertionFailedError: Read-only trash/
trash1231395890218.244/.git/objects/4b/
825dc642cb6eb9a060e54bf8d69288fbee4904

Oh.  That's always going to fail as root.  JGit has tried to make the file read-only, then asked "File.canWrite()".  As root, that is always true, even if the file is read-only.  But there isn't an easy way to ask "am I root" from within Java, so our tests can't work around this feature of being root.

I think you just have to ignore tests if you are building as root.  My suggestion?  Don't build as root.

Shawn Pearce

unread,
Jan 9, 2009, 10:50:53 AM1/9/09
to repo-d...@googlegroups.com
On Fri, Jan 9, 2009 at 04:54, Wiktor <wiktor.kw...@gmail.com> wrote:

I'll try to investigate jgit test failures next week

Thanks, any insight (patches are even better!) as to why this is failing would be much appreciated.
 
(by the way -
just out of curiosity: why jgit's repository on android.git.kernel.org
is named "egit.git" - with e instead of j?).

Because the upstream repository is named that way too:

  http://repo.or.cz/w/egit.git

Our egit.git on android.git.kernel.org is a fork of the upstream.  Right now it might actually just be a few changes behind the upstream, because I haven't updated it recently and the changes have no impact on Gerrit.  Somedays its 30 or 40 commits *ahead* of the upstream project, because I have made changes to JGit to support Gerrit, but the patches haven't yet been accepted by the upstream project.

One more issue. Maybe I'm missing something but I can't make Gerrit
display my git repositories. I did everything as described in INSTALL:

"- Create and configure the Git repository base:

This directory holds the Git repositories that Gerrit knows
about and can service.  Gerrit needs write access to this
directory and any Git repository stored within it.

mkdir /srv/git
psql -c "UPDATE system_config SET git_base_path='/srv/git'" reviewdb"

Is git_base_path directory supposed to contain only bare repositories?

Yes.
 
Or maybe they need to contain "git-daemon-export-ok" file?

Nope, Gerrit ignores that file.

What Gerrit cares about is having a record in the projects table in the database...

  INSERT INTO projects (
    project_id,
    owner_group_id,
    name
  ) VALUES (
    nextval('project_id'),
    (SELECT admin_group_id FROM system_config),
    'my/project');

Would give you access to the Git repository "/srv/git/my/project.git", assuming that Git repository also exists in the filesystem.  If not you'd need to create it with git init.

Right now the Admin->Projects menu shows you all projects you have ownership access to, based on the groups you are a member of.  Initially when a database is created there are no accounts in the admin group, so you can't manage the groups, or anything else really.

Add yourself to the magic admin group:

  INSERT INTO account_group_members
  (account_id, group_id)
  VALUES (
  (SELECT account_id FROM accounts WHERE preferred_email  = 'y...@you.com'),
  (SELECT admin_group_id FROM system_config)
  );

Since you directly edited the projects and account group data in the database you need to flush the application data caches.  You can do that one of two ways:

  - Restart the web application.  Probably the easiest during early setup.  For Jetty you just need to "touch $JETTY_HOME/contexts/gerrit.xml" and wait ~60 seconds for the application to be reloaded.

  - "ssh -p 29418 you@localhost gerrit flush-caches", this will require that you have an SSH key stored in your user account (you can set that in the web interface under Settings), but there's a "chicken and egg" problem here.  To run "gerrit flush-caches" you must be in the magic admin group.  If the admin group has already been loaded into memory and you aren't in it yet, this command will fail.  If the admin group hasn't been loaded yet, this command may actually succeed, because it'll read the group from the database and recognize that you are in it.

Currently there is no UI to create projects over the web.  This is a feature that Android wants, so that members of the Core Technical Team can "self-service" the creation of new projects that the CTT has approved for hosting on the Android instance of Gerrit.  Its just very, very low on my priority list.  I'm actually hoping that someone else will contribute the feature.  :-)

You can see the current projects by Admin->Projects, but only if you are in the magic admin group, or you are in the group that owns the project.  The latter feature is how Android's server gives out project management to teams that are strictly outside of Google.  I think we already have 4 or 5 such projects in Android, and more coming.

Gerrit2 supports git clone/fetch over SSH; "ssh://you@localhost:29418/$projectname.git".  Push is supported but "classic" push commands are rejected.

To upload changes for review you push to a special ref name, "refs/for/$branch".  E.g. to send changes to the "gerrit2" branch:

  git push ssh://you@localhost:29418/$proj.git HEAD:refs/for/gerrit2

(FWIW I have a form of "repo upload" that knows how to do this.  I just can't remember where I put the change, its either in a "for-gerrit2" branch in repo, or I didn't upload it yet.  I plan on trying to release an updated repo today that knows how to speak to both Gerrit1 and Gerrit2.)

However, uploading changes requires that the branch also exist in the database:

  INSERT INTO branches
  (project_name, project_name, branch_id)
  VALUES (
    '$proj',
    'refs/heads/gerrit2',
    nextval('branch_id')
  );

Make sure the branch name actually starts with "refs/heads/".  Technically "refs/for/gerrit2" is shorthand for "refs/for/refs/heads/gerrit2".

Like with projects, the web UI should let you manage the branches table, but it doesn't; its also very low on the priority list.  As I'm writing this email I'm starting to wonder about the value of the branches table.  I probably can do just as well with entries in ~/.git/config and paying attention to the branches actually present in the Git repository.

Because Gerrit1's web UI doesn't have access to Git we had this branch entity in the database to validate user requests and give meaningful error messages back.  In Gerrit2 we have direct access to Git, and make use of it rather extensively (e.g. the embedded SSH server)... but I carried the entity over anyway under a "copy what Gerrit1 had, get it in production, then iteratively improve" model.


Yea, I know, the current install documentation is far too thin.  I think I'm going to try and spend some time to write more down for folks.  Gerrit 1 is only really documented in my head, but very, very few people are using it.  Gerrit 2 is another animal, folks are actively trying to work with it and deploy it as soon as its ready.  So docs are important.

Wiktor

unread,
Jan 12, 2009, 12:17:35 PM1/12/09
to Repo and Gerrit Discussion
Thanks to Shawn's detailed description I've finally git-pushed a patch
into my local Gerrit 2 installation (yup, it works!).

I had few minor difficulties:

- SSH Username - at first I didn't notice it was there, it's not set
by default (for example to user's primary email) nor it is editable in
Gerrit,

- Web Identities/Email Address - I don't know why but when I logged
with Google Account info this field was not set. That causes Gerrit to
refuse my git-pushes with message "invalid committer".

For now only editing Gerrit's database solves both issues.

On Jan 9, 4:50 pm, Shawn Pearce <s...@google.com> wrote:
>   (SELECT account_id FROM accounts WHERE preferred_email  = '...@you.com'),

Shawn Pearce

unread,
Jan 12, 2009, 12:53:46 PM1/12/09
to repo-d...@googlegroups.com
On Mon, Jan 12, 2009 at 09:17, Wiktor <wiktor.kw...@gmail.com> wrote:

Thanks to Shawn's detailed description I've finally git-pushed a patch
into my local Gerrit 2 installation (yup, it works!).

I had few minor difficulties:

- SSH Username - at first I didn't notice it was there, it's not set
by default (for example to user's primary email) nor it is editable in
Gerrit,

Doh.  That's a bug.

We're experimenting with JIRA issue tracker.  There's a project for Gerrit:

  http://140.211.167.230/jira/browse/GERRIT

I've opened a bug for this:

  http://140.211.167.230/jira/browse/GERRIT-3
 
- Web Identities/Email Address - I don't know why but when I logged
with Google Account info this field was not set. That causes Gerrit to
refuse my git-pushes with message "invalid committer".
For now only editing Gerrit's database solves both issues.

But obviously this shouldn't be required. :-)

Entringer Robert-W19085

unread,
Jan 12, 2009, 1:03:36 PM1/12/09
to repo-d...@googlegroups.com

Shawn,

Is there a work flow diagram for Gerrit2? Is there any difference from
Gerrit?
Do you have anything for describes how Gerrit2 works from a high-level?

What are the features of Gerrit2?
Do you have information on continuous integration aspects of Gerrit2?
Auto-build? Auto-test? Auto-release?


Best Regards,
Robert Entringer
Motorola
414-331-0791

Wiktor

unread,
Jan 12, 2009, 1:18:25 PM1/12/09
to Repo and Gerrit Discussion
> We're experimenting with JIRA issue tracker.  There's a project for Gerrit:
>
>  http://140.211.167.230/jira/browse/GERRIT
>

That's neat. I'll file some bug-reports later if you don't mind :-)

Oh and one more question - when does Gerrit 2 merge verified &
approved patches into its projects? Because Gerrit 2 has direct access
to the repository I'd assumed it would be instantaneous but it doesn't
seem so (I don't see any changes in my project's repository).

Shawn Pearce

unread,
Jan 12, 2009, 2:00:47 PM1/12/09
to repo-d...@googlegroups.com
On Mon, Jan 12, 2009 at 10:03, Entringer Robert-W19085 <Robert.E...@motorola.com> wrote:

Is there a work flow diagram for Gerrit2?

No, not yet.
 
 Is there any difference from Gerrit?

No.  However, Gerrit2 permits you to control the workflow on a per-database level at this point in time.  You can remove the "Verified" step for example, or add a "Legal Review" step.  There isn't any documentation yet on this.  I need to write some on how to configure the workflow, but I haven't gotten to that yet.
 
Do you have anything for describes how Gerrit2 works from a high-level?

No.  Needs to be written.  Its right now mostly a copy of Gerrit1, with the exception that:

* Runs on Java and PostgreSQL, instead of Python and Google App Engine.
* Uses JavaScript and AJAX in the client to render the UI, instead of rendering it on the server.
* Uses SSH to upload changes, instead of HTTP POST.
* Uses OpenID for authentication in the public case, or HTTP auth if you want to use a corporate SSO solution.  E.g. Siteminder.
* Has a more flexible workflow, configured from the database by the Gerrit administrator.
 
What are the features of Gerrit2?

See above.  But the only new features are:

* No Google App Engine required.
* Slightly more flexible workflow.

after that there's been a lot of talk lately with some of my coworkers about trying to improve some aspects of the code review screens.  But nothing concrete enough to write up a feature request for, or to write code for.

Do you have information on continuous integration aspects of Gerrit2?
Auto-build?  Auto-test?  Auto-release?

None.  We haven't tried to integrate it with anything.  In Gerrit1 we tried to define a build step and never used it.  It muddied up the workflow code.  I'm avoiding it in Gerrit2 until we understand how to connect to these tools, and actually have them working.  Or did you mean to ask these questions about Gerrit2 as a project itself?

Shawn Pearce

unread,
Jan 12, 2009, 2:02:35 PM1/12/09
to repo-d...@googlegroups.com
On Mon, Jan 12, 2009 at 10:18, Wiktor <wiktor.kw...@gmail.com> wrote:

> We're experimenting with JIRA issue tracker.  There's a project for Gerrit:
>
>  http://140.211.167.230/jira/browse/GERRIT
>

That's neat. I'll file some bug-reports later if you don't mind :-)

Thanks, that's why I pointed you to it.  :-)
 
Oh and one more question - when does Gerrit 2 merge verified &
approved patches into its projects? Because Gerrit 2 has direct access
to the repository I'd assumed it would be instantaneous but it doesn't
seem so (I don't see any changes in my project's repository).

After I write the code to do this.  :-)

The submit patchset button marks the change record with state SUBMITTED, but then nothing tries to merge it in as there is no merge code copied in from Gerrit1 yet.  You are correct, it should be instantaneous, and my plan is to try and do the merge during the web request, because its basically instant to execute.  I'm working on that code today.  So you should see some changes for it start to trickle through.

Jey

unread,
Feb 4, 2009, 3:34:50 AM2/4/09
to Repo and Gerrit Discussion


On Jan 12, 11:02 am, Shawn Pearce <s...@google.com> wrote:
> On Mon, Jan 12, 2009 at 10:18, Wiktor <wiktor.kwapisiew...@gmail.com> wrote:
>
> > Oh and one more question - when does Gerrit 2 merge verified &
> > approved patches into its projects? Because Gerrit 2 has direct access
> > to the repository I'd assumed it would be instantaneous but it doesn't
> > seem so (I don't see any changes in my project's repository).
>
> After I write the code to do this.  :-)
>
> The submit patchset button marks the change record with state SUBMITTED, but
> then nothing tries to merge it in as there is no merge code copied in from
> Gerrit1 yet.  You are correct, it should be instantaneous, and my plan is to
> try and do the merge during the web request, because its basically instant
> to execute.  I'm working on that code today.  So you should see some changes
> for it start to trickle through.

So, I assume this is now available in Gerrit2?

I made a couple of repo uploads and approved them with another account
on gerrit2.
And I am seeing the 'green tick' on Approved/Verified, and got mails
from Gerrit2.
But I still dont see the changes, in the repository. (Tried repo-
init'ing, repo-sync'ing on separate workspace)
Neither are they moved to 'Merged Changes' in web-ui.

Am I missing some obvious step, Shawn?

thanks,
-Jey

Shawn Pearce

unread,
Feb 4, 2009, 10:03:08 AM2/4/09
to repo-d...@googlegroups.com
On Wed, Feb 4, 2009 at 00:34, Jey <jey.m...@gmail.com> wrote:
On Jan 12, 11:02 am, Shawn Pearce <s...@google.com> wrote:
> On Mon, Jan 12, 2009 at 10:18, Wiktor <wiktor.kwapisiew...@gmail.com> wrote:
>
> > Oh and one more question - when does Gerrit 2 merge verified &
> > approved patches into its projects?
>
> After I write the code to do this.  :-)
>
> The submit patchset button marks the change record with state SUBMITTED,

So, I assume this is now available in Gerrit2?

Yes, in 2.0 and later the "Submit Patch Set N" button will merge the change into the project automatically.
 
I made a couple of repo uploads and approved them with another account
on gerrit2.
And I am seeing the 'green tick' on Approved/Verified, and got mails
from Gerrit2.
But I still dont see the changes, in the repository. (Tried repo-
init'ing, repo-sync'ing on separate workspace)
Neither are they moved to 'Merged Changes' in web-ui.

Did you push "Submit Patch Set N"?
Are you running 2.0 or later?

If you can't see the "Submit Patch Set N" button next to "Publish Comments" you need to give one of your groups the Submit approval category in the project admin page.

Jey Michael

unread,
Feb 4, 2009, 11:47:19 AM2/4/09
to repo-d...@googlegroups.com
On Wed, Feb 4, 2009 at 7:03 AM, Shawn Pearce <s...@google.com> wrote:

> If you can't see the "Submit Patch Set N" button next to "Publish Comments"
> you need to give one of your groups the Submit approval category in the
> project admin page.

This is it. Thanks. Works now!
I had created groups with increased 'permission range' for Review, but
the 'Submit' Category was not too visible.

Perhaps having a default group as 'Reviewers' belonging to 'Code
Review' Category with '-2:+2' range and 'Submit' Category would be a
good initial state to have.

-Jey

Shawn Pearce

unread,
Feb 4, 2009, 11:50:23 AM2/4/09
to repo-d...@googlegroups.com
On Wed, Feb 4, 2009 at 08:47, Jey Michael <jey.m...@gmail.com> wrote:

Perhaps having a default group as 'Reviewers' belonging to 'Code
Review' Category with '-2:+2' range and 'Submit' Category would be a
good initial state to have.

Not a bad idea.

I need to completely rework the way permissions are handled to address GERRIT-60 (*1*), so its very likely that after that rework setting up this sort of default/example on new installations is worthwhile.  The new stuff will be a little bit more complex to setup permissions, but a lot more flexible.  So out of the box examples will really help.


*1* http://jira.source.android.com/jira/browse/GERRIT-60

Reply all
Reply to author
Forward
0 new messages