How I found a bug in HackerEarth

I am not a competitive programmer. I love programming, but more so I love building things. As a result, I rarely participate in coding contests. Even when I do, I try to use languages like Ruby and Python just to see if I can do itmy way, so to speak.While trying a contest in Ruby, I realized that I could not use the rubyprimelibrary. This is a standard library in Ruby for a long while, and HackerEarth platform runs on 2.1.1, which is quite new.I reported this as a bug to HackerEarth in September ’14. A quick reply from HE made me realize that they weren’t understanding the issue:Modules like mathn or erb are part of standard library. They are available.Try using, require ‘erb’require ‘mathn’ in code editor.However 3rd party libraries are not available.I decided to do some tests and checkall standard librariesfor their availability. For those unfamiliar with Ruby, this is how you load a standard library in ruby:require ‘prime’Using the HackerEarth API, I was able to write some quick code that tested all expected libraries:while read lib; do
echo “Testing $lib”
curl -s -d “client_secret=API_SECRET&lang=RUBY&async=0&source=$SOURCE” > $lib.json
done < libs.txtHerelibs.txtcontains a list of all standard libraries. The above code is in bash, and makes use of curl.
Parsing the results, I replied with the following:Requiring the following libraries raises a missing error:coverage – REextmk – REfiddle – REio/console – REjson – REminitest – REminitest/benchmark – REminitest/spec – REmkmf – REobjspace – REprime – REpsych – REracc – RErake – RErdoc – RErexml – RErinda – REripper – RErubygems – REtk – REwin32ole – RExmlrpc – REHackerEarth admitted the issue (I posted code to replicate ongithub), and have since worked on it. I just ran the tests again, and only the following libraries are unavailable now:curses – REdbm – REdebug – REextmk – REgdbm – REgenerator – REiconv – REracc – REreadline – RErexml – RErinda – REtk – REwin32ole – REA few of these are understandable (win32since HE platform runs on Linux, andtk, which is a graphical library). A few of these are unavailable in Ruby 2.1.1 (I copied the list of libs from the 2.1.3 docs).Kudos to HackerEarth for fixing a bug that very few of their users would have faced. All the source code for this post can be found atgithub.

News Reporter

Leave a Reply

Your email address will not be published. Required fields are marked *