2012-01-24

A Bugs Life

In this post I collected the things I did to fix a bug and get it released in Nemo Mobile. While this is not exactly guide on the matter, this might help if you are interested in helping Nemo.

Every monday morning at 10 o'clock Nemo-project is having a error triage meeting to set priority for new bugs. We do it as open IRC meeting, everybody is welcome, like the project does all of its meetings. One of the bugs we discussed yesterday was bug 56: "VKB overlaps with terminal content in landscape". Originally we thought it might be issue in the virtual keyboard code and therefore we decided to file bug to upstream (maliit) bugzilla. This I agreed to do. I marked the bug status as assigned and myself as assignee.

I had taken a look at terminal code already earlier and knew that it had some strange looking code related to virtual keyboard handling. I decided to take one more look at the terminal, before filing the bug. Quickly I saw where where problem likely was. Terminal checked if the screen area of virtual keyboard started from edge of device for detecting if screen was in landscape orientation. Since in N950 the virtual keyboard does not fill the whole width of the device in landscape, its screen area does not start from edge and therefore terminal does not understand that it is in landscape. That is why it miscalculates the available size for the content.

I decided to test if using MInputMethodState::instance()->activeWindowOrientationAngle() to check orintation would fix the bug.

I pulled terminal sources from its gitorious repository and created a local branch for my fix. Since terminal does not have dependencies to internal APIs I was pretty sure that I could just compile it using QtSDK for Harmattan and test the resulting binary on Nemo. This turned out to be true. I opened the the project with Qt Creator and added Harmattan as the only target. I added my fix and did a build. As result I got a binary, which I copied to my device with scp. Binary worked fine on my N950 with Nemo. The bug was gone.

Since the fix worked I decided to submit my fix to Nemo. First I commited the change to my local git bug fixing branch. Then I created a patch file that included the fix with git format-patch. I logged into community OBS Web UI and searched for meego-terminal. From the search results I choce the version of the package that was in project CE:Apps:MTF, since I knew that it is the repository that we use in release.

I branched the package to add my fix.

I added the patch file as part of the sources.

Then I edited .yaml to include the patch. At this point I changed from community OBS's web UI to command line on linux. I checked out my branched package with:
osc -A https://api.pub.meego.com/ co home:vesku:brances:CE:Apps:MTF/meego-terminal

I changed into the directory that I checked out and for updating .spec file I executed: specify meego-terminal.yaml Finally, I updated .changes file by adding the following on the top:

* Mon Jan 23 2012 Vesku H <vesku.h@gmail.com> - 0.2.2-1
- Fixes NEMO#56: VKB overlaps with terminal content in landscape

Both the header and the fixes line follow a specific syntax so that build system can automatically parse them and make certain checks and do some automated tasks.

I was now ready to check in my changes and see if package builds and works. I checked in my changes to OBS with: osc ci -m "Fix for Nemo#56"

I went back to web ui and checked my packages build status. OBS built it quite quickly. From repositories I had to change publish flag true for all architectures. To grab the generated .rpm I clicked: CE_MW_MTF_armv7hl -> Go to download repository -> armv7hl from there I copied url to the generated rpm. Then I logged into my device and pulled the rpm with wget and installed it with rpm -U meego-terminal*.rpm.

Since the package worked fine I went back to Web UI and submitted my package. I marked the bug as fixed and added link to the submit request as comment.

I had to do a minor change to my initial submission based on automated review and another minor change based on comment I got from Nemo maintainer (Sage) at irc before the submission was approved. If you do contributions it is good to hang around at #nemomobile and #mer channels (@freenode) for feedback.

Finally the submission was approved and fixed package is now at the repository. After approving the submission request Nemo maintainer marked the bug as released in bugzilla and the fixed package will be included in the next weekly build of Nemo.

As a last step I should contribute my fix back to upstream project (gitorious), so that future versions of terminal would have the fix by default and the patch would no longer be needed.