Patch #5117

mercurial_adapter should ensure the right LANG environment variable

Added by Alessio Caiazza over 7 years ago. Updated almost 7 years ago.

Status:ClosedStart date:2010-03-18
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:SCM
Target version:1.0.4

Description

http://www.redmine.org/projects/redmine/repository/revisions/3506/entry/trunk/lib/redmine/scm/adapters/mercurial_adapter.rb#L47 matches with a regular expression which may not work on some locales.

$ locale | grep LANG
LANG="it_IT.UTF-8" 
$ hg --version
Mercurial SCM Distribuito (versione 1.5+20100307)

To ensure the correct behaviour you may set LANG='C' before calling hg.

rake test error snippets

  2) Error:
test_annotate(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:125:in `test_annotate'

  3) Error:
test_changes(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:79:in `test_changes'

  4) Error:
test_diff(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:87:in `diff'
    app/controllers/repositories_controller.rb:167:in `diff'
    /test/functional/repositories_mercurial_controller_test.rb:113:in `test_diff'

  5) Error:
test_directory_entry(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:104:in `test_directory_entry'

  6) Error:
test_entry_download(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:97:in `test_entry_download'

  7) Error:
test_entry_show(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:86:in `test_entry_show'

  8) Error:
test_show(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:40:in `test_show'

  9) Error:
test_show_at_given_revision(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository/mercurial.rb:33:in `entries'
    app/controllers/repositories_controller.rb:72:in `show'
    /test/functional/repositories_mercurial_controller_test.rb:71:in `test_show_at_given_revision'

 10) Error:
test_show_directory(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:59:in `test_show_directory'

 11) Error:
test_show_root(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:48:in `test_show_root'

This patch applies on redmine 0.9.3

$ script/about
About your application's environment
Ruby version              1.8.7 (universal-darwin10.0)
RubyGems version          1.3.6
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Application root          /Users/nolith/Documents/Projects/redmine-hg
Environment               development
Database adapter          sqlite3
Database schema version   20100222000000

fix_mercurial_localization_issue.diff Magnifier (627 Bytes) Alessio Caiazza, 2010-03-18 12:12

windows-lang-c.png (17 KB) Toshi MARUYAMA, 2010-03-18 13:46

hg-lang-c.patch Magnifier (1.22 KB) Toshi MARUYAMA, 2010-03-18 18:23

fix_mercurial_localization_issue.diff Magnifier (1002 Bytes) Alessio Caiazza, 2010-03-19 11:01

hg-version-20100929.diff Magnifier (5.01 KB) Toshi MARUYAMA, 2010-09-29 14:30

hg-version-yuya-mq-c5a47a5f63.diff Magnifier (5.11 KB) Toshi MARUYAMA, 2010-09-30 16:15

hg-version-20101114.diff Magnifier (5.43 KB) Toshi MARUYAMA, 2010-11-14 13:19

hg-version-2010-11-15.patch Magnifier (5.11 KB) Yuya Nishihara, 2010-11-14 17:29

hg-version-minimal-2010-11-15.patch Magnifier (2.24 KB) Yuya Nishihara, 2010-11-14 17:29

hg-version-2010-11-20.patch Magnifier (5.05 KB) Toshi MARUYAMA, 2010-11-20 17:23

mercurial_adapter_each_line.patch Magnifier (482 Bytes) Yuya Nishihara, 2010-11-20 17:26

mercurial_adapter_1.8.6fix.patch Magnifier (1.45 KB) Yuya Nishihara, 2010-11-20 19:34

hg-version-2010-11-21.diff Magnifier (2.5 KB) Toshi MARUYAMA, 2010-11-21 02:28


Related issues

Duplicated by Redmine - Defect #7059: Error on the implementation issues Repository.fetch_chang... Closed 2010-12-07

Associated revisions

Revision 4417
Added by Jean-Philippe Lang about 7 years ago

Fixed: MercurialAdapter.client_version depends on LANG environment variable (#5117).

Revision 4422
Added by Jean-Philippe Lang almost 7 years ago

Fixed: r4417 breaks MercurialAdapter with ruby 1.8.6 (#5117).

History

#1 Updated by Toshi MARUYAMA over 7 years ago

This patch does not work on windows.

#2 Updated by Toshi MARUYAMA over 7 years ago

$ hg diff
diff -r 8152d1bdeac5 lib/redmine/scm/adapters/mercurial_adapter.rb
--- a/lib/redmine/scm/adapters/mercurial_adapter.rb     Sun Feb 28 22:12:54 2010 +0900
+++ b/lib/redmine/scm/adapters/mercurial_adapter.rb     Thu Mar 18 23:30:34 2010 +0900
@@ -23,7 +23,8 @@
       class MercurialAdapter < AbstractAdapter

         # Mercurial executable name
-        HG_BIN = "hg" 
+        # HG_BIN = "hg" 
+        HG_BIN = "env LANG=C hg" 
         TEMPLATES_DIR = File.dirname(__FILE__) + "/mercurial" 
         TEMPLATE_NAME = "hg-template" 
         TEMPLATE_EXTENSION = "tmpl" 
$ env LANG=ja_JP.UTF-8 hg --version
Mercurial - 分散構成管理ツール(バージョン 1.5+99-bedef1c228d3)

#3 Updated by Toshi MARUYAMA over 7 years ago

MSysGit has env.exe in "C:\Program Files\Git\bin".
But TortoiseHg does not have env.exe in "C:\Program Files\TortoiseHg".
This is not solution.

#4 Updated by Alessio Caiazza over 7 years ago

Toshi Maruyama wrote:

MSysGit has env.exe in "C:Program FilesGitin".
But TortoiseHg does not have env.exe in "C:Program FilesTortoiseHg".
This is not solution.

Does it install python?

# HG changeset patch
# Parent 0dc60afda5722afecf6f7fc5c13552d3f008bdf2
sets LANG variable before calling hg

diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb
--- a/lib/redmine/scm/adapters/mercurial_adapter.rb
+++ b/lib/redmine/scm/adapters/mercurial_adapter.rb
@@ -45,6 +45,12 @@

           def hgversion_from_command_line
             %x{#{HG_BIN} --version}.match(/\(version (.*)\)/)[1]
+          rescue NoMethodError
+            hgversion_from_python
+          end
+          
+          def hgversion_from_python
+            %x{python -c "from mercurial import util; print util.version()"}.strip
           end

           def template_path

#5 Updated by Alessio Caiazza over 7 years ago

TortoiseHG didn't install python, it compiles hg.
Not a solution.

#6 Updated by Toshi MARUYAMA over 7 years ago

I create patch and finish test on Windows.
This patch for Redmine 0.9.3.

#7 Updated by Jean-Philippe Lang over 7 years ago

IMHO, it would be simplier to assume that the version number is of the first line of the output.
Just like we do for other SCM:

if m = io.gets.to_s.match(%r{((\d+\.)+\d+)})
  version = m[0].scan(%r{\d+}).collect(&:to_i)
end

#8 Updated by Alessio Caiazza over 7 years ago

Patch based on Jean's advice.

#9 Updated by Toshi MARUYAMA about 7 years ago

#12 Updated by Toshi MARUYAMA about 7 years ago

I update the patch referring of note-13 of #6860.

  • change io.gets to io.read
  • update regular expression for multi lines
  • update test for multi lines

Please set this issue target next stable 1.0.4.

#13 Updated by Yuya Nishihara about 7 years ago

Toshi MARUYAMA wrote:

hg-version-20101114.diff

Hi, I think your patch is overengineerd. Here's a patch to fix this issue with minimal changes: hg-version-minimal-2010-11-15.patch

I have another one to fix this, hg-version-2010-11-15.patch, but it contains more changes to simplify the codes.

#14 Updated by Jean-Philippe Lang about 7 years ago

  • Status changed from New to Closed
  • Target version set to 1.0.4

I've committed hg-version-minimal-2010-11-15.patch in trunk and 1.0-stable as it solves the reported error.
Thanks.

#15 Updated by Toshi MARUYAMA about 7 years ago

  • Status changed from Closed to Reopened

Unit test fails.

$ LANG=C ruby test/unit/repository_mercurial_test.rb 
./test/unit/../test_helper.rb:405: warning: don't put space before argument parentheses
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
Loaded suite test/unit/repository_mercurial_test
Started
.EEEEE
Finished in 2.508805 seconds.

  1) Error:
test_cat(RepositoryMercurialTest):
NoMethodError: undefined method `lines' for #<String:0x7fa9541f9a28>
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    test/unit/repository_mercurial_test.rb:67:in `test_cat'

#16 Updated by Toshi MARUYAMA about 7 years ago

I refresh a patch for SVN trunk based on Yuya's hg-version-2010-11-15.patch.

#17 Updated by Yuya Nishihara about 7 years ago

Toshi MARUYAMA wrote:

Unit test fails.

Gee, Ruby 1.8.6 doesn't seem to have String#lines method, sorry. Could you test the attached patch? mercurial_adapter_each_line.patch

#18 Updated by Toshi MARUYAMA about 7 years ago

Yuya Nishihara wrote:

Toshi MARUYAMA wrote:

Unit test fails.

Gee, Ruby 1.8.6 doesn't seem to have String#lines method, sorry. Could you test the attached patch? mercurial_adapter_each_line.patch

It fails.

$ ruby test/unit/repository_mercurial_test.rb 
./test/unit/../test_helper.rb:405: warning: don't put space before argument parentheses
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
Loaded suite test/unit/repository_mercurial_test
Started
.EEEEE
Finished in 3.546667 seconds.

  1) Error:
test_cat(RepositoryMercurialTest):
LocalJumpError: no block given
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `each_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    test/unit/repository_mercurial_test.rb:67:in `test_cat'

$ ruby --version
ruby 1.8.6 (2010-02-05 patchlevel 399) [x86_64-linux]
$ LANG=C rpm -qi ruby
Name        : ruby                         Relocations: (not relocatable)
Version     : 1.8.6.399                         Vendor: Fedora Project
Release     : 6.fc13                        Build Date: Mon Aug 23 02:56:25 2010
Install Date: Wed Sep  1 10:42:01 2010         Build Host: x86-14.phx2.fedoraproject.org
Group       : Development/Languages         Source RPM: ruby-1.8.6.399-6.fc13.src.rpm
Size        : 1740271                          License: Ruby or GPLv2
Signature   : RSA/SHA256, Tue Aug 24 02:03:58 2010, Key ID 7edc6ad6e8e40fde
Packager    : Fedora Project
URL         : http://www.ruby-lang.org/
Summary     : An interpreter of object-oriented scripting language
Description :
Ruby is the interpreted scripting language for quick and easy
object-oriented programming.  It has many features to process text
files and to do system management tasks (as in Perl).  It is simple,
straight-forward, and extensible.

#19 Updated by Yuya Nishihara about 7 years ago

Toshi MARUYAMA wrote:

mercurial_adapter_each_line.patch

It fails.

Hmm, #each_line => Enumerator seems also introduced in 1.8.7, according to string.c:rb_str_each_line().
I changed #hgversion_from_command_line to return whole lines and updated the test case accordingly:

mercurial_adapter_1.8.6fix.patch

This should fix the problem on Ruby 1.8.6.
We could use String#to_a (only for 1.8.x) or String#split("\n"), but I think it's simple just not to eliminate trailing lines.

#20 Updated by Toshi MARUYAMA almost 7 years ago

I update the patch for SVN trunk referring JPL's implementation of r4419(#6860) which uses io.read and '\A' regular expression.

#21 Updated by Jean-Philippe Lang almost 7 years ago

  • Status changed from Reopened to Closed

Toshi MARUYAMA wrote:

I update the patch for SVN trunk referring JPL's implementation of r4419(#6860) which uses io.read and '\A' regular expression.

Fix for 1.8.6 committed in r4422, thanks.

Also available in: Atom PDF