Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String#to_r is broken on 2.0.0-p247 Mac binaries #2189

Closed
aripollak opened this issue Sep 3, 2013 · 24 comments
Closed

String#to_r is broken on 2.0.0-p247 Mac binaries #2189

aripollak opened this issue Sep 3, 2013 · 24 comments

Comments

@aripollak
Copy link

I noticed a problem with the rvm 2.0.0-p247 binary for OS X, repeatable across different machines.

% rvm install 2.0.0
% ruby -e 'puts ".8".to_r'
0
% rvm reinstall 2.0.0 --disable-binary
% ruby -e 'puts ".8".to_r'
4/5

The last answer is the correct one. This causes lots of problems with ActiveRecord + PostgreSQL since it ends up truncating timestamps to integers instead of keeping millisecond precision.

@mpapis
Copy link
Member

mpapis commented Sep 4, 2013

I have just tried and can not reproduce this behavior, can you please try this:

rvm get head
rvm reload
rvm reinstall 2.0.0 --binary
rvm use 2.0.0
ruby -e 'puts ".8".to_r'

@ysamlan
Copy link

ysamlan commented Sep 4, 2013

I'm getting the bug reproduced over here when following those commands (MBP Retina, mid-2012, OS X 10.8.4):

~  rvm get head
Downloading RVM from wayneeseguin branch master
Upgrading the RVM installation in /Users/yoni/.rvm/
    RVM PATH line found in /Users/yoni/.bashrc /Users/yoni/.zshrc.
    RVM sourcing line found in /Users/yoni/.bash_login /Users/yoni/.zprofile.
Upgrade of RVM in /Users/yoni/.rvm/ is complete.
...
RVM reloaded!~  rvm reload
RVM reloaded!~  rvm reinstall 2.0.0 --binary
Removing /Users/yoni/.rvm/src/ruby-2.0.0-p247... - using Zsh, can not show progress, be patient...
Removing /Users/yoni/.rvm/rubies/ruby-2.0.0-p247... - using Zsh, can not show progress, be patient...
Searching for binary rubies, this might take some time.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' already are up to date.
Requirements installation successful.
...
ruby-2.0.0-p247 - #validate archive
ruby-2.0.0-p247 - #extract
ruby-2.0.0-p247 - #validate binary
ruby-2.0.0-p247 - #setup
Saving wrappers to '/Users/yoni/.rvm/wrappers/ruby-2.0.0-p247'...........
ruby-2.0.0-p247 - #importing default gemsets, this may take time.......................
Making gemset ruby-2.0.0-p247 pristine. - using Zsh, can not show progress, be patient...
Making gemset ruby-2.0.0-p247@global pristine. - using Zsh, can not show progress, be patient...

➜  ~  rvm use 2.0.0
Using /Users/yoni/.rvm/gems/ruby-2.0.0-p247
➜  ~  ruby -e 'puts ".8".to_r'
0

But then installing from source again fixes the issue:

~  rvm reinstall ruby-2.0 --disable-binary
/Users/yoni/.rvm/src/ruby-2.0.0-p247 has already been removed.
Removing /Users/yoni/.rvm/rubies/ruby-2.0.0-p247... - using Zsh, can not show progress, be patient...
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' already are up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/yoni/.rvm/rubies/ruby-2.0.0-p247, this may take a while depending on your cpu(s)...
ruby-2.0.0-p247 - #downloading ruby-2.0.0-p247, this may take a while depending on your connection...
ruby-2.0.0-p247 - #extracting ruby-2.0.0-p247 to /Users/yoni/.rvm/src/ruby-2.0.0-p247 - using Zsh, can not show progress, be patient...
ruby-2.0.0-p247 - #extracted to /Users/yoni/.rvm/src/ruby-2.0.0-p247
Applying patch /Users/yoni/.rvm/patches/ruby/2.0.0/logging.patch - using Zsh, can not show progress, be patient...
ruby-2.0.0-p247 - #configuring - using Zsh, can not show progress, be patient...
ruby-2.0.0-p247 - #post-configuration - using Zsh, can not show progress, be patient...
ruby-2.0.0-p247 - #compiling - using Zsh, can not show progress, be patient...
ruby-2.0.0-p247 - #installing - using Zsh, can not show progress, be patient...
Retrieving rubygems-2.0.7
Extracting rubygems-2.0.7 ...
Removing old Rubygems files...
Installing rubygems-2.0.7 for ruby-2.0.0-p247...
Installation of rubygems completed successfully.
Saving wrappers to '/Users/yoni/.rvm/wrappers/ruby-2.0.0-p247'...........
 - using Zsh, can not show progress, be patient...
ruby-2.0.0-p247 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-2.0.0-p247 - #importing default gemsets, this may take time - using Zsh, can not show progress, be patient...
Install of ruby-2.0.0-p247 - #complete 
Making gemset ruby-2.0.0-p247 pristine. - using Zsh, can not show progress, be patient...
Making gemset ruby-2.0.0-p247@global pristine. - using Zsh, can not show progress, be patient...
➜  ~  rvm use 2.0.0
Using /Users/yoni/.rvm/gems/ruby-2.0.0-p247
➜  ~  ruby -e 'puts ".8".to_r'               
4/5

@mpapis
Copy link
Member

mpapis commented Sep 4, 2013

can you try on the broken one:

ruby -e 'puts Rational("0.8")' -e 'puts Rational(".8")'

@ysamlan
Copy link

ysamlan commented Sep 6, 2013

Binary ruby:

~  ruby -e 'puts Rational("0.8")' -e 'puts Rational(".8")'
0
0

Source ruby:

~ ruby -e 'puts Rational("0.8")' -e 'puts Rational(".8")'
4/5
4/5

@mpapis
Copy link
Member

mpapis commented Sep 6, 2013

I'm afraid this can be because of compilation with clang, I will have to catch up someone from ruby team to investigate, please for now use source install (this is the only issue I know of)

@mpapis
Copy link
Member

mpapis commented Sep 8, 2013

reported it to MRI, I can not do much without their help => https://bugs.ruby-lang.org/issues/8879

@nobu
Copy link

nobu commented Sep 9, 2013

I just tried, but:

$ rvm reinstall 2.0.0 --binary
Removing /Users/nobu/.rvm/src/ruby-2.0.0-p247...
Removing /Users/nobu/.rvm/rubies/ruby-2.0.0-p247...
Searching for binary rubies, this might take some time.
Requested binary installation but no rubies are available to download, consider skipping --binary flag.

@mpapis
Copy link
Member

mpapis commented Sep 9, 2013

@nobu what version of OSX is that? the binary we have is for 10.8 ... but you could try it on other version system with:

rvm mount -r http://rvm.io/binaries/osx/10.8/x86_64/ruby-2.0.0-p247.tar.bz2 --verify-downloads 1

although I'm not sure it will work correctly in versions lower then 10.8

@nobu
Copy link

nobu commented Sep 9, 2013

It's 10.7.5.
The installation succeeded but installed 2.0.0 segfaults.

@mpapis
Copy link
Member

mpapis commented Sep 9, 2013

I will try to prepare version that is compatible with older osx ... but this might take some time

@TeresaP
Copy link

TeresaP commented Sep 13, 2013

Is it possible this issue might be causing problems when running Calabash/Cucumber tests in RubyMine? I ended up having to roll back RVM to version 1.22.3 in order to use Ruby 2.0.

@mpapis
Copy link
Member

mpapis commented Sep 25, 2013

@nobu I have uploaded binary that works also on 10.6 / 10.7 - you can try it with:

rvm get head
rvm install 2.0.0 --binary

as for the error as explained so far in the ticket for MRI this works:

require 'mathn'
"0.4".to_r

@nobu
Copy link

nobu commented Sep 26, 2013

It worked properly.

@mpapis
Copy link
Member

mpapis commented Sep 26, 2013

@nobu you were able to reproduce the error or it works for you?

@nobu
Copy link

nobu commented Sep 26, 2013

I got the correct result (2/5), and couldn't reproduce the error.

@mpapis
Copy link
Member

mpapis commented Sep 26, 2013

also with:

ruby -e 'puts Rational("0.8")' -e 'puts Rational(".8")'

@aripollak
Copy link
Author

Not sure if it matters, but all of the boxes that I've seen exhibiting the problem have been using Homebrew. I don't have access to a machine using MacPorts.

@mpapis
Copy link
Member

mpapis commented Sep 26, 2013

rvm uses SM Framework for building "static" ruby for OSX, I guess almost nobody will have that

@conner
Copy link

conner commented Oct 23, 2013

the pre-compiled binary still seems broken on 10.8? compiling from source solves it.

@mpapis
Copy link
Member

mpapis commented Nov 3, 2013

ok so there is a ruby commit 43514 that can be tested with this patch https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/43514/diff/load.c?format=diff ... unfortunately my OSX machine has to go back to EngineYard for data cleaning and I can not work on this right now (I should get it back someday), maybe @rys will be able work faster on this then me.

@mpapis
Copy link
Member

mpapis commented Nov 10, 2013

unfortunately the patch does not help, related => 1d2de5a

@mpapis mpapis closed this as completed in ee0440b Nov 11, 2013
@mpapis mpapis reopened this Nov 16, 2013
@mpapis
Copy link
Member

mpapis commented Nov 16, 2013

it appears the new patch breaks openssl - reopening and waiting for https://bugs.ruby-lang.org/issues/9117
there will be no new OSX binaries as long as they are buggy

@mpapis
Copy link
Member

mpapis commented Dec 31, 2013

I have recently uploaded 2.0.0-p353 and 2.1.0 binaries - please test with them

@mpapis
Copy link
Member

mpapis commented Jan 3, 2014

it works for me in latest binaries moved to other version of OSX - closing - if anyone has still issues please let me know

@mpapis mpapis closed this as completed Jan 3, 2014
@pkuczynski pkuczynski added this to the rvm-1.27.0-before milestone May 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants