-
-
Notifications
You must be signed in to change notification settings - Fork 931
accept string based port for pack_sockaddr_in #85
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the MRI/Rubinius logic for converting? We should probably do that rather than relying on RubyObject.toString(). It might work here, but we should be more explicit about the conversion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure, not so experienced/great at trying to understand the c code. Here are the areas in question though, so far as I can tell:
MRI: https://github.com/ruby/ruby/blob/trunk/ext/socket/raddrinfo.c#L343
Rubinius: https://github.com/rubinius/rubinius/blob/master/lib/socket.rb#L397
I'd just try to fix it, but from looking at those and the pointer stuff, etc I'm not entirely sure what the answer is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like MRI is converting to char* https://github.com/ruby/ruby/blob/trunk/ext/socket/raddrinfo.c#L315-316, and Rubinius is most definitely calling port.to_s, so this should be fine.
Turns out I still don't know java. I can't get things to compile even with my changes reverted on my machine. I'm just going to open a bug and leave it to you guys. |
Actually, I can't figure out how to create issues either. Maybe this just isn't a good week for me. Anyway, would be nice if you could fix this. I had to code around it by adding my own conversion in something, which is suboptimal. |
geemus, You'll have to register on codehaus in order to open a ticket. If you can describe the problem with a test case, I'm sure we can work this out. Thank you for your time and effort. |
I think this failing test capture the intent: |
It seems to me that JRuby is behaving exactly the same as MRI:
Did I miss something? |
No, sorry. I think I missed the ball. I mistakenly thought that Socket.new would end up using Socket.sockaddr_in internally. I've added a test that does it directly (which fails in jruby but passes elsewhere, I believe). Sorry for all the confusion. Here is my latest (hopefully successful) attempt: |
Confirmed the test. Yay! |
I also added a spec: khu-twilio/rubyspec@7648a35 |
Thanks for helping out on this, I had hoped to take care of it myself, but it ended up being a bit harder than I had originally suspected. |
0957d24 add BigDecimal#round special value specs dc36858 Fix spec title e145d75 Fix ARGF.seek spec a27e082 Add spec for Comparable#== without #<=>. 7bbd215 Add a couple specs for constant resolution under module_eval 0afb501 Add spec for resolving constants in Module#module_eval 002731e Fix assertion in Module#module_eval. e450b4a Add spec for redo in a method 63603b5 Add spec for next in a method 09db199 Add spec for spawn redirect to [file,mode]. 071a996 Merge pull request #90 from ruby/time fdf1ced Fix typos f23b1cb Separate Time#<=> specs for millisecond vs microsecond precision b0a3bd4 Remove duplicated assertion 541d1f7 Add spec for ARGF.argv a0a5ca8 Mention it "needs to be reviewed for spec completeness" 4d680ed Remove extra backslash c6558a5 Merge pull request #88 from JuanitoFatas/feature/string-concat-by-spaces 0258119 Update spec description for string literals bca9b5f Add two specs for string concatenations by spaces e9e02f5 Deduplicate example names 4355c35 Merge pull request #87 from JuanitoFatas/string/unicode-normalize 8626efe Fix unicode normalized spec f1de617 Remove unused IO in File#read spec 293f6e4 Fix variable name in FIle#open 62a7b2c Prefer setting autoclose to close + rescue d46d063 mkspec -c String; Copy spec content to mkspec generated spec 50fade7 Apply code review changes 7b6ce1f Try to clarify specs using the map_fd fixture. 7747042 General cleanup of IO specs 850f3ed Reorganize IO#popen specs b8dd40b Make sure the old IO is closed in IO#initialize spec 136b80e Remove 1.8 readlines specs 21b694d No need to check for closed? since IO#read examples never close themselves 39d00ff Just use autoclose=false in socket for_fd specs f58eb48 No need to re-assign @fd in IO.sysopen spec b5aeacb Fix typo in CONTRIBUTING.md 93bc817 Improve notes about mkspec 43685be [core/string] Add String#unicode_normalize specs bb3e13d SVG Travis badge to please the eyes 👀 ea9f106 Reorganize specs for multiple unnamed arguments. c95400b Merge pull request #83 from JuanitoFatas/proc/arguments 5c9b2f1 [Language/block_spec] Add specs to check SyntaxError for block arguments 113e7e6 Merge pull request #85 from ruby/use-standard-require 24d31d1 Standardize require line for unboundmethod/shared/to_s.rb 6f18131 update MSpec 4527d8d The fixture helper now resolves real paths automatically 5aa9134 Fix duplication with CODE_LOADING_DIR 21dae98 Do not use the fixture helper on already expanded path 4c4523c Just check for realpath in spec_helper.rb 4dea397 Resolve realpath to fixture directory in -C spec a03ed0e Have a better check for CODE_LOADING_DIR and realpath a8884b9 Update required MSpec version c1ab544 Update instructions to directly use a MSpec checkout 186300a Remove $SAFE-related specs. b762526 Merge pull request #82 from ruby/fix-ruby-version bc11d67 fixed wrong version of ruby 2b8e36b Merge pull request #81 from ruby/remove-safe3 7c640e2 discarded =3 example with Ruby 2.3 19af98c Improve a bit Array#bsearch_index spec 4e1a9b3 Merge pull request #78 from JuanitoFatas/feature/bsearch_index_spec c5374cd Merge pull request #79 from JuanitoFatas/feature/bundled-with 18dd536 Clearer description of @array.bsearch_index { |x| (1 - x / 4) * (2**100) ea9bd82 Remove specs of break de6124c Add BUNDLED WITH to Gemfile.lock 7732e00 Fix example descriptions and reorganize specs ac55574 Fix ARGF spec for Windows 2cab1f3 Fix syntax errors 0cf2e94 Port Array#bsearch_index spec from ruby/ruby@c64d283 git-subtree-dir: spec/ruby git-subtree-split: 0957d245b6170480c880a62da19a335113cc8c84
MRI/Rubinius accept string based ports for sockaddr_in and convert appropriately, seems like jruby probably should as well.