Project

General

Profile

Actions

Defect #4494

closed

Mercurial access not working in jruby

Added by Drazen Baic over 14 years ago. Updated almost 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
-
Start date:
2009-12-28
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

When I try to access a mercurial repository with Redmine running under jruby I get the following error message:

Processing RepositoriesController#show (for 192.168.1.20 at 2009-12-28 01:03:07) [GET]
  Parameters: {"controller"=>"repositories", "action"=>"show", "id"=>"test"}
  SQL (1.0ms)   SELECT max(settings.updated_on) AS max_updated_on FROM settings 
  User Load (0.0ms)   SELECT * FROM users WHERE (users.id = 1) AND (users.status = 1) AND ( (users.type = 'User' OR users.type = 'AnonymousUser' ) ) 
  Project Load (0.0ms)   SELECT * FROM projects WHERE (projects.identifier = 'test') LIMIT 1
  Repository Load (0.0ms)   SELECT * FROM repositories WHERE (repositories.project_id = 1) LIMIT 1
Shelling out: hg -R '/repos/test/' root
  EnabledModule Load (1.0ms)   SELECT * FROM enabled_modules WHERE (enabled_modules.project_id = 1) 
  Setting Load (0.0ms)   SELECT * FROM settings WHERE (settings.name = 'autofetch_changesets') LIMIT 1
Shelling out: hg -R '/repos/test/' root
Shelling out: hg -R '/repos/test/' --cwd '/repos/test/' locate -r tip

TypeError (can't convert nil into String):
  app/models/repository/mercurial.rb:39:in `entries'
  app/models/repository/mercurial.rb:35:in `each'
  app/models/repository/mercurial.rb:35:in `entries'
  app/controllers/repositories_controller.rb:72:in `show'
  /opt/jruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /opt/jruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /opt/jruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /opt/jruby/lib/ruby/1.8/webrick/server.rb:162:in `start'
  /opt/jruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /opt/jruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /opt/jruby/lib/ruby/1.8/webrick/server.rb:92:in `each'
  /opt/jruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /opt/jruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /opt/jruby/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendering /root/src/redmine/public/500.html (500 Internal Server Error)

it works without problems when running under ruby mri:

Processing RepositoriesController#show (for 192.168.1.20 at 2009-12-28 01:37:18) [GET]
  Parameters: {"action"=>"show", "id"=>"test", "controller"=>"repositories"}
  SQL (0.3ms)   SELECT max("settings".updated_on) AS max_updated_on FROM "settings" 
  User Load (0.7ms)   SELECT * FROM "users" WHERE ("users"."id" = 1) AND (users.status = 1) AND ( ("users"."type" = 'User' OR "users"."type" = 'AnonymousUser' ) ) 
  Project Load (0.6ms)   SELECT * FROM "projects" WHERE ("projects"."identifier" = 'test') LIMIT 1
  Repository Load (0.4ms)   SELECT * FROM "repositories" WHERE ("repositories".project_id = 1) LIMIT 1
Shelling out: hg -R '/repos/test/' root
Shelling out: hg --debug --encoding utf8 -R '/repos/test/' log -C --style '/root/src/redmine/lib/redmine/scm/adapters/mercurial/hg-template-1.0.tmpl' --limit 1
  Repository::Mercurial Update (0.6ms)   UPDATE "repositories" SET "root_url" = '/repos/test' WHERE "id" = 6
  EnabledModule Load (1.1ms)   SELECT * FROM "enabled_modules" WHERE ("enabled_modules".project_id = 1) 
  Setting Load (0.4ms)   SELECT * FROM "settings" WHERE ("settings"."name" = 'autofetch_changesets') LIMIT 1
Shelling out: hg -R '/repos/test/' root
Shelling out: hg --debug --encoding utf8 -R '/repos/test/' log -C --style '/root/src/redmine/lib/redmine/scm/adapters/mercurial/hg-template-1.0.tmpl' --limit 1
  Changeset Load (0.6ms)   SELECT * FROM "changesets" WHERE ("changesets".repository_id = 6) ORDER BY changesets.committed_on DESC, changesets.id DESC LIMIT 1
Fetching changesets for repository /repos/test
Shelling out: hg --debug --encoding utf8 -R '/repos/test/' log -C --style '/root/src/redmine/lib/redmine/scm/adapters/mercurial/hg-template-1.0.tmpl' -r 0:4 
  Changeset Load (0.4ms)   SELECT "changesets".id FROM "changesets" WHERE ("changesets"."revision" = '' AND "changesets".repository_id = 6) LIMIT 1

It seems that Shelling out: hg -R '/repos/test/' root doesn't work correctly as under ruby mri the next command is Shelling out: hg --debug --encoding utf8 -R '/repos/test/' log -C --style but under jruby it is Shelling out: hg -R '/repos/test/' --cwd '/repos/test/' locate -r tip

When I try to access the reposity under jruby after it worked under ruby mri I can see the repository and new files added to it but I don't see any new revisions.

Here is the environment for jruby:

# gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.5
  - RUBY VERSION: 1.8.7 (2009-11-02 patchlevel 174) [java]
  - INSTALLATION DIRECTORY: /opt/jruby-1.4.0/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /opt/jruby/bin/jruby
  - EXECUTABLE DIRECTORY: /opt/jruby/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-java-1.6
  - GEM PATHS:
     - /opt/jruby-1.4.0/lib/ruby/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "install" => "--env-shebang" 
     - "update" => "--env-shebang" 
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/

and the environment under ruby mri

# gem1.8 environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.5
  - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.8
  - RUBY EXECUTABLE: /usr/bin/ruby1.8
  - EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /var/lib/gems/1.8
     - /root/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/

The Redmine revision I'm currently using is r3255.

I tried to use subversion and bazaar and both worked without problems under jruby


Files

fix_4494_mercurial_on_jruby.diff (627 Bytes) fix_4494_mercurial_on_jruby.diff Gregor Schmidt, 2010-04-20 12:02

Related issues

Related to Redmine - Patch #5404: Fix Redmine tests for JRuby 1.4.x and 1.5.0Closed2010-04-29

Actions
Related to Redmine - Defect #8510: JRuby: Can't open administrator panel if scm command is not availableClosedToshi MARUYAMA2011-06-03

Actions
Actions #1

Updated by Drazen Baic over 14 years ago

  • Status changed from New to Resolved

This seems to be caused by a bug in jruby1.4 (see http://jira.codehaus.org/browse/JRUBY-3819) returning a wrong exit status after calling IO.popen. This bug will be fixed in jruby1.5.

In lines 67-70 in the script lib/redmine/scm/adapters/mercurial_adapter.rb

shellout(cmd) do |io|
root_url = io.gets
end
return nil if $? && $?.exitstatus != 0

returns the value nil due to this bug.

Actions #2

Updated by Gregor Schmidt about 14 years ago

Unfortunately, although JRUBY-3819 is solved in JRuby 1.5.0.RC1, the Mercurial/JRuby/Redmine incompatibility is not resolved. I am still seeing wrong exit codes when running the whole test suite under JRuby 1.5. I do not see them, when running the tests in isolation, though.

Actions #3

Updated by Gregor Schmidt about 14 years ago

The attached diff would fixes the issue

Actions #4

Updated by Felix Schäfer almost 14 years ago

Gregor, can you confirm if this still is a problem or not?

Actions #5

Updated by Toshi MARUYAMA almost 13 years ago

  • Status changed from Resolved to Closed

In trunk r5997, unit adapter test, unit model test, functional test pass.

$ jruby --version
jruby 1.6.2 (ruby-1.8.7-p330) (2011-05-23 e2ea975) (OpenJDK 64-Bit Server VM 1.6.0_18) [linux-amd64-java]
Actions

Also available in: Atom PDF