Feature #4050

Ruby 1.9 support

Added by Alexey Froloff over 7 years ago. Updated about 5 years ago.

Status:ClosedStart date:2009-10-18
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Ruby support
Target version:1.4.0
Resolution:Fixed

Description

With attached patches redmine passes all tests with Rails 2.3.4 and Ruby 1.9.1. I'm trying to package redmine for ALT Linux distro, these patches are not distribution specific.

I have packaged and installed following modules (never tried to patch vendored versions):

ruby-coderay (http://svn.rubychan.de/coderay)
rails-plugin-engines (http://github.com/lazyatom/engines)
rails-plugin-rfpdf (http://github.com/edwinmoss/rfpdf)

Excerption from redmine spec just for reference:

rm -rf vendor/plugins/coderay*/
rm -rf vendor/plugins/engines/
rm -rf vendor/plugins/rfpdf/
# these locales fail test_load(DefaultDataTest)
rm -f config/locales/hu.yml
rm -f config/locales/zh.yml
rm -f config/locales/zh-TW.yml

cat <<EOF >config/database.yml
production:
  adapter: sqlite3
  database: db/production.db

development:
  adapter: sqlite3
  database: db/development.db

test:
  adapter: sqlite3
  database: db/test.db
EOF
rake --trace config/initializers/session_store.rb
rake --trace db:migrate
rake --trace test:scm:setup:create_dir
rake --trace test:scm:setup:filesystem
rake --trace test:scm:setup:git
rake --trace test:scm:setup:subversion
rake --trace test:units
rake --trace test:functionals
rake --trace test:integration

0006-Fix-weird-characters.patch Magnifier (1.32 KB) Alexey Froloff, 2009-10-18 12:51

0007-Missing-users_groups-fixture.patch Magnifier (1.13 KB) Alexey Froloff, 2009-10-18 12:51

0008-Quotes-should-not-be-escaped.patch Magnifier (1.21 KB) Alexey Froloff, 2009-10-18 12:51

0009-Use-pt_BR-instead-of-buggy-zh_TW-locale.patch Magnifier (2.04 KB) Alexey Froloff, 2009-10-18 12:51

0001-New-CSV-API.patch Magnifier (2.11 KB) Alexey Froloff, 2009-10-18 12:51

0002-Round-up-Rational-value.patch Magnifier (1.29 KB) Alexey Froloff, 2009-10-18 12:51

0003-Object-methods-returns-Array-of-Symbols.patch Magnifier (1.53 KB) Alexey Froloff, 2009-10-18 12:51

0004-Fix-Regexp.patch Magnifier (904 Bytes) Alexey Froloff, 2009-10-18 12:51

0010-20000-days-is-less-than-55-years.patch Magnifier (1.46 KB) Alexey Froloff, 2009-10-18 12:51

0005-Do-not-require-non-existant-modules.patch Magnifier (936 Bytes) Alexey Froloff, 2009-10-18 12:51

0011-Process-fixtures-as-binary.patch Magnifier (1.14 KB) Alexey Froloff, 2009-10-18 12:52

Ruby-1.9-Encoding.default_external.diff Magnifier (595 Bytes) Toshi MARUYAMA, 2011-03-04 06:24

application_controller.diff Magnifier (1.11 KB) Toshi MARUYAMA, 2011-04-28 13:59

application_controller_chili_21a45b4e.diff Magnifier (1.08 KB) Toshi MARUYAMA, 2011-10-30 12:46


Related issues

Related to Redmine - Defect #2664: Mercurial: Repository path encoding of non UTF-8 characters Closed 2009-02-04
Related to Redmine - Defect #6853: Ruby 1.9: translation missing: en, field_lock_version (ru... Closed 2010-11-08
Related to Redmine - Feature #8209: I18n YAML files not parsable with psych yaml library Closed 2011-04-22
Related to Redmine - Defect #8847: I18n YAML files not parsable with psych yaml library Closed 2011-07-19
Related to Redmine - Defect #9798: Release 1.3.0 does not detect rubytree under ruby 1.9.3p0... Closed
Related to Redmine - Feature #10046: Update installation doc on release Closed
Related to Redmine - Defect #7096: CSV Issues Export + Ruby 1.9 + Thin + non-ascii character... Closed 2010-12-11
Related to Redmine - Defect #10575: Uploading of attachments which filename contains non-ASCI... Closed
Related to Redmine - Defect #10593: Error: 'incompatible character encodings: UTF-8 and ASCII... Closed
Duplicated by Redmine - Defect #8600: Encoding::CompatibilityError in Welcome#index Closed 2011-06-14
Duplicated by Redmine - Defect #10051: Ruby 1.9.2 and mailer encoding Closed
Blocks Redmine - Defect #6725: Acronyms don't works for russian language New 2010-10-22
Blocked by Redmine - Patch #4869: Redmine doesn't support ruby 1.9's radio buttons Closed 2010-02-18
Blocks Redmine - Defect #6551: Highlighting in search results is case sensitive for cyri... New 2010-10-01
Blocked by Redmine - Defect #4824: Unable to connect (can't convert Net::LDAP::LdapError int... Closed 2010-02-13 2010-02-17
Blocks Redmine - Defect #9730: Redmine leaks memory over 1G, YAML New
Blocks Redmine - Defect #10134: Case insensitive search is not working with postgres 8.4 ... Confirmed

Associated revisions

Revision 4359
Added by Jean-Baptiste Barth over 6 years ago

Use File#expand_path for require's in script/* for Ruby 1.9.2 compatibility. #4050

Since Ruby 1.9.2, LOAD_PATH does not include "." directory anymore, so
we should use absolute paths instead to ensure both 1.8.x and 1.9.x
compatibility. It has been included in railties 2.3.x branch since
july 2009, see http://github.com/rails/rails/commit/7a427a83ca4da92c70760007aaf313638a5d8374

Revision 4509
Added by Jean-Baptiste Barth over 6 years ago

Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050

Revision 4510
Added by Jean-Baptiste Barth over 6 years ago

Set encoding to utf-8 for ruby 1.9 compatibility. #4050

Revision 5000
Added by Toshi MARUYAMA about 6 years ago

scm: mercurial: add path encoding tests in functional test (#2664, #4050).

TODO: This test fails in Ruby 1.9 and Encoding.default_external is not UTF-8.

Revision 6461
Added by Toshi MARUYAMA almost 6 years ago

Ruby 1.9: set Encoding.default_external = 'UTF-8' (#4050).

Without this setting, Redmine cannot boot on Japanese Windows
nor on non UTF-8 locale Linux (e.g. LANG=en_US.ISO-8859-1).

Revision 6462
Added by Toshi MARUYAMA almost 6 years ago

Ruby 1.9: force use syck yaml library (#8847, #4050).

Revision 6647
Added by Toshi MARUYAMA almost 6 years ago

Ruby 1.9: add rake task to check parsing yaml by psych library (#8847, #4050).

Original code is written by Etienne Massip.

Revision 6649
Added by Toshi MARUYAMA almost 6 years ago

Ruby 1.9: fix typo of rake task name to check parsing yaml by psych library (#8847, #4050).

Revision 7927
Added by Toshi MARUYAMA over 5 years ago

Ruby 1.9: fix encoding error on wiki diffs (#4050)

WikiDiff#to_html returns a string with ASCII encoding if
the WikiJournal content has been Zlib compressed because
Zlib::Inflate.inflate returns strings with ASCII encoding.
Forcing the encoding to be UTF8 fixes this bug.

Contributed by Moritz Breit.

Revision 7928
Added by Toshi MARUYAMA over 5 years ago

Ruby 1.9: fix TabularFormBuilder to show "translation missing: en, field_lock_version" (#6853, #4050)

Contributed by Moritz Breit.

Revision 8713
Added by Toshi MARUYAMA over 5 years ago

Ruby1.9: set Encoding.default_external on only Rails2 (#4050, #4796)

Revision 8714
Added by Toshi MARUYAMA over 5 years ago

Ruby1.9: enforce UTF-8 encodings on the params hash on Rails2 (#4050, #4796)

Without this change, non ASCII subject issue cannot be created on Ruby 1.9.

Revision 8716
Added by Toshi MARUYAMA over 5 years ago

Ruby1.9: skip enforcing UTF-8 encodings on the params hash on Rails2 if it is frozen (#4050, #4796)

Tests on CI server fail.
http://www.redmine.org/builds/build_trunk-1.9.2-sqlite3_257.html

  1) Error:
test_index_with_short_filters(IssuesControllerTest):
RuntimeError: can't modify frozen string
    /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:58:in `force_encoding'
    /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:58:in `utf8nize!'
    /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:60:in `block in utf8nize!'
    /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:60:in `each'
    /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:60:in `utf8nize!'
    /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:52:in `params_filter'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in `evaluate_method'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:166:in `call'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:225:in `call'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:629:in `run_before_filters'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:615:in `call_filters'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:610:in `perform_action_with_filters'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/benchmarking.rb:68:in `block in perform_action_with_benchmark'
    /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/core_ext/benchmark.rb:17:in `block in ms'

Revision 8833
Added by Toshi MARUYAMA over 5 years ago

Ruby1.9: move setting Encoding.default_external after boot (#4050, #4796)

"ruby test/functional/repositories_git_controller_test.rb" fails
on Japanese Windows and Mingw Ruby 1.9.3p0
because "Rails" is not defined.

History

#2 Updated by Alexey Froloff over 7 years ago

Forgot to mention. All patches made against yesterday's trunk.

#3 Updated by Holger Just almost 7 years ago

  • Category set to Ruby support

#4 Updated by Etienne Massip almost 7 years ago

That would be great as ruby 1.9.2 is out now and is meant to be the first 1.9 release ready for production use.

This could improve greatly the speed and usability of Redmine.

#5 Updated by Alexey Froloff almost 7 years ago

$ git diff --stat tags/1.0.0..master -- app/ config/ lib/ test/ vendor/ | tail 1
60 files changed, 264 insertions(+), 220 deletions(
)

Works perfect with 1.9.1p376. Since there's no reaction on my patches, I don't see any reason for me to submit anything again.

#6 Updated by Jean-Baptiste Barth almost 7 years ago

Alexey, please don't take it that way, be sure that such contributions are very appreciated.

There were no reaction to your patch for various reasons. Mainly because we are very few contributors around to review thousands of pending issues. Plus, if I remember correctly, 1.9.1 has always been said to be not really ready for production (I remember articles about weird cases, segfaults, etc.).

But now with 1.9.2 released, the situation is very different. I'd personnaly like 1.1 to be fully compatible with ruby 1.9, and maybe we'll begin to support more recent rails versions.

I'll have a look at your patches and integrate them one by one as soon as I come back from my holidays in september. Thank you again.

#7 Updated by Alexey Froloff almost 7 years ago

This issue is already obsolete. In http://git.altlinux.org/people/raorn/packages/?p=redmine.git I have working redmine 1.0.0 (upstream sources were imported with git-svn) with bunch of fixes related to 1.9.1 incompatibilities, encoding issues, rails 2.3.8 anti-XSS false-positive escapes as well as several really nasty bugs.

I am packaging redmine for ALT Linux distro, we have ruby 1.9.1 as the only ruby version in repository. I am doing this just for fun, although there are several users who runs this version in their "production".

I can comment on any my commit, but submitting issues without any feedback in months don't worth the effort. Nothing personal.

#8 Updated by Etienne Massip almost 7 years ago

This issue can't be obsolete, you just brought a considerable help to Redmine's development for which we, users, are very thankful.

BTW, it looks like someone else did the same to get early Rails 3 support (issue #4796) : http://github.com/jeremy/redmine

#9 Updated by Jean-Baptiste Barth almost 7 years ago

Alexey Froloff wrote:

This issue is already obsolete. In http://git.altlinux.org/people/raorn/packages/?p=redmine.git I have working redmine 1.0.0 (upstream sources were imported with git-svn) with bunch of fixes related to 1.9.1 incompatibilities, encoding issues, rails 2.3.8 anti-XSS false-positive escapes as well as several really nasty bugs.

OK thanks, I mirrored this repo on my laptop so that I can hack a bit on it.

#10 Updated by David Morton over 6 years ago

I'm very interested in this too, as I just spent a week or two getting an application ready for rails 3, and then I discovered that passenger needs to run the same ruby version for all apps on the server - and so to run redmine on the testing server along with the application, I need both to run in 1.9.2. :(

Alexsey: you said 1.0.0, how is it tracking with 1.0.1 ?

#11 Updated by Toshi MARUYAMA about 6 years ago

After Redmine updated Rails 2.3.11, I can't run on my Japanese Windows nor Linux Latin-1 locale on Ruby 1.9.

$ ruby --version
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-linux]

$ locale
LANG=en_US.ISO-8859-1
LC_CTYPE="en_US.ISO-8859-1" 
LC_NUMERIC="en_US.ISO-8859-1" 
LC_TIME="en_US.ISO-8859-1" 
LC_COLLATE="en_US.ISO-8859-1" 
LC_MONETARY="en_US.ISO-8859-1" 
LC_MESSAGES="en_US.ISO-8859-1" 
LC_PAPER="en_US.ISO-8859-1" 
LC_NAME="en_US.ISO-8859-1" 
LC_ADDRESS="en_US.ISO-8859-1" 
LC_TELEPHONE="en_US.ISO-8859-1" 
LC_MEASUREMENT="en_US.ISO-8859-1" 
LC_IDENTIFICATION="en_US.ISO-8859-1" 
LC_ALL=

ActionView::TemplateError (incompatible character encodings: UTF-8 and ISO-8859-1) on line #62 of app/views/layouts/base.rhtml:
59:     
60:     <div id="content">
61:                 <%= render_flash_messages %>
62:         <%= yield %>
63:         <%= call_hook :view_layouts_base_content %>
64:                 <div style="clear:both;"></div>
65:     </div>

    app/views/layouts/base.rhtml:62:in `concat'
    app/views/layouts/base.rhtml:62:in `_run_rhtml_app47views47layouts47base46rhtml'
    <internal:prelude>:10:in `synchronize'
    /home/xxxxx/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
    /home/xxxxx/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
    /home/xxxxx/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'

Rendered rescues/_trace (228.3ms)
Rendered rescues/_request_and_response (2.0ms)
Rendering rescues/layout (internal_server_error)

I apply this patch, then I can run Redmine.

#12 Updated by Etienne Massip about 6 years ago

  • Target version set to Candidate for next major release

#13 Updated by Toshi MARUYAMA about 6 years ago

This is additional patch.
Without this patch, I can not input non ASCII characters.

#14 Updated by Toshi MARUYAMA almost 6 years ago

  • Tracker changed from Patch to Feature

#17 Updated by Etienne Massip over 5 years ago

  • Target version changed from Candidate for next major release to 1.4.0

#18 Updated by Jean-Philippe Lang over 5 years ago

r8714 breaks tests with ruby 1.9. I'd really like that this fix comes with a test so that we can safely remove it in the future.

#19 Updated by Toshi MARUYAMA over 5 years ago

Japanese attachment filename is broken on Japanese Windows Ruby 1.9
https://www.chiliproject.org/issues/856

#20 Updated by Jean-Philippe Lang about 5 years ago

  • Status changed from New to Closed
  • Resolution set to Fixed

I'm closing it as the test suite passes with both 1.9.2 and 1.9.3 (1.9.1 is not supported by Rails):
http://www.redmine.org/builds/index.html

Separate issues should be open if incompatibilities are found.

#21 Updated by Alexander Oryol about 5 years ago

Please, add to related issue #10593

Also available in: Atom PDF