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

Already on GitHub? Sign in to your account

Syntax error: h = {}; h[:a] = b = sleep 1 #2004

chanks opened this Issue Nov 11, 2012 · 9 comments


None yet
4 participants

chanks commented Nov 11, 2012

The line in the title throws a SyntaxError on Rubinius master (it requires parentheses around the 1) in both 1.8 and 1.9 modes. MRI 1.9.3 handles this just fine, while 1.8.7 throws a similar error. JRuby 1.7.0 handles this in 1.9 mode but not 1.8 mode.

A simpler reproduction that also fails in the same versions: a = b = sleep 1

Aside from this, and having to drop a C-extension, Rubinius ran my Rails app's test suite without a hitch!


brixen commented Nov 11, 2012

a = b = foo arg was added in 1.9.3. We just haven't ported that yet. I need to add some machinery to mspec to support syntax changes in teeny versions.

Could you tell us what the C-extension was and what issue you ran into?

chanks commented Nov 11, 2012

Sure, it's the sequel_pg gem. It installs fine, but when I try to start up my app with it I get:

Detected bad handle checking global capi handles
(0.000172s) SET standard_conforming_strings = ON
(0.000143s) SET client_min_messages = 'WARNING'
(0.000127s) SET DateStyle = 'ISO'
(0.000853s) SELECT "oid", "typname" FROM "pg_type" WHERE (("typtype" = 'b') AND ("typname" IN ('hstore')))
(0.000462s) SELECT "oid", "typname" FROM "pg_type" WHERE (("typtype" = 'b') AND ("typname" IN ('hstore')))

CRASH: A fatal error has occurred.


.rubinius_last_error is here: https://gist.github.com/4056109


dbussink commented Nov 11, 2012

Are you able to create instructions for us so we can reproduce that crash and investigate it?


jeremyevans commented Nov 11, 2012

I've already talked to @brixen about sequel_pg compatibility with rbx. sequel_pg is currently not supported on rbx. @brixen seemed to think the problem is in sequel_pg, but as it works fine in MRI (no reported issues with many users), I think the problem is in rbx's capi support. Running rbx -S rake spec_postgres in a Sequel checkout with sequel_pg installed should reproduce the issue.


dbussink commented Nov 11, 2012

Well, Rubinius has a moving GC, so any C extension that expects object to stay in the same place will have a potential issue that will never occur in MRI since MRI doesn't move objects. I suspect this is a case like this. Could also very well be the pg gem them, we'll find out then.


dbussink commented Nov 11, 2012

Ok, I found the problem. It looks like you're registering an address as global variable that is located on the stack. The address on the stack is allocated here (spg_Postgres):


It is then assigned a variable and registered as a global variable here:


To be honest, it sounds almost like a miracle to me that this never has been an issue for anyone using MRI.


dbussink commented Nov 11, 2012

Opened pull request for the sequel_pg issue: jeremyevans/sequel_pg#7

chanks commented Nov 13, 2012

Thanks for your help. I think we can close this, unless you want to keep it as a reminder to port the 1.9.3 syntax?


brixen commented Nov 13, 2012

@chanks you can leave it open, I'll fix it shortly.

@dbussink dbussink closed this in ee39d2c Aug 19, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment