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

Fix #2036 (Ruby hash broken for Messages with repeated fields.) #2037

Merged
merged 2 commits into from
Sep 19, 2016

Conversation

abscondment
Copy link
Contributor

#2036 spells out how the hash function is broken in many Ruby messages. This PR fixes that.

* add a repeated field to the tested hash
* also assert that two messages with identical values produce identical hashes
Instead of shifting/xoring the hash at each field, use the built-in ruby
apis for generating a hash from multiple input values.

Now returns a Fixnum.
@grpc-kokoro
Copy link

Thanks for your pull request. The automated tests will run as soon as one of the admins verifies this change is ok to test.

@abscondment
Copy link
Contributor Author

@haberman Are you the right person to review this? thx!

@haberman
Copy link
Member

Ack sorry for the delay on this!

@haberman haberman merged commit b5bbdb0 into protocolbuffers:master Sep 19, 2016
@haberman
Copy link
Member

Oh, looks like this caused a breakage in JRuby: https://travis-ci.org/google/protobuf/jobs/160942507

@abscondment
Copy link
Contributor Author

abscondment commented Sep 19, 2016

@haberman Interesting. I think this should actually be considered a second bug in JRuby that this new test exposed. I.e. the hashes of two messages with identical values should be identical, but in this case they are not.

If you agree with that assessment, I'd be happy to open another issue and look into the fix.

@haberman
Copy link
Member

@abscondment that sounds like a reasonable assessment, thanks for taking a look!

@abscondment abscondment deleted the fix-2036-ruby-hash branch September 20, 2016 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants