only you can prevent cthulhu

Download Only You Can Prevent Cthulhu

If you can't read please download the document

Upload: andrew-grimm

Post on 16-Apr-2017

763 views

Category:

Documents


5 download

TRANSCRIPT

Only you can prevent Cthulhu

How finding a bug in BioRubyfixed a bug in Rails

Andrew Grimm, University of New South Wales

Bite me once...

Tried running my work project under JRubyResult: BioRuby DO NOT LIKE

Googled whether anyone else had tried doing this. No-one had, but core reckoned it ought to work

Conclusions at the time:Notify them of the issue

Stop experimenting with other implementations, stick with MRI/YARV

Bite me twice...

Next week, tried RubyInstaller on WindowsResult: BioRuby DO NOT LIKE

This time it needed fixing!

Culprit: trying to determine OS by parsing RUBY_PLATFORM, rather than using rbconfig's Config::CONFIG["host_os"]

Summoning Cthulhu

How did Rails handle it?

Couldn't find ideal test for ability to fork (e.g. telling if JRuby has fork enabled)

May as well see how Rails handles it949 forkers and 5606 watchers can't be wrong!

Rails summons Cthulhu too?

Pick a bug. Any bug

Couldn't understand why they still used RUBY_PLATFORM

Decided to test one of the uses of RUBY_PLATFORM and see if it produced a bug

It did duplicate of #3999

So Easy a Caveman Can Do It

Here's the bug

Here's the offending code

Here's a link showing what to do

If you know require, you could fix it

No-one did for 2 months

Lessons learnt

It's ok to extensively test code

Select can be broken

Check for duplicates before filing

Don't forget to put your name and email in git

Only you can prevent Cthulhu!

It's ok to extensively test code

You're not being unreasonable in testing code in JRuby

Select can be broken

Select isn't broken (SIB) suggests that if there's a bug either in heavily-used code third-party code, and code you've just written, consider the possibility that it's the latter

Rails can't possibly have a bug?It can. It has 800 tickets. (Hat tip: Ryan Bigg)

SIB applies less if the code can't be unit tested, only manifests under certain circumstances, and isn't used much

Check for duplicates before filing

I assumed the bug was so simple that if it had been noticed before, it would have been fixed

Check for duplicates before filing

Check for duplicates before filing

Check for duplicates before filing

Check for duplicates before filing

Check for duplicates before filing

Don't forget username and email

With people named Avdi Grimm and Andrew Grim, agrimm@unknown is unhelpful for a commit

Happened because I was on a rarely-used partition

Only you can prevent Cthulhu!

My bug fix inspired someone else to remove use of RUBY_PLATFORM for determining OS from Rails entirely

Best way to test something: use it?

I've heard people complain that ruby core don't test whether their changes break RailsShould Rails developers do that?

I've heard Rails users complain that changes to Rails breaks their codeShould Rails users run their code's tests against new versions of Rails?