The major goal of my Summer of Code project, as I have said many times earlier is to make the procps tools run out of the box on Hurd. From a few days back I was looking at procps code to patch it run properly on Hurd. Though the number of places where the patches had to be done was not many, but I did not know much about Debian packaging, I was just wondering how to do. It was then my mentor antrik and Samuel Thibault (more about him later) asked me to ask Michael Banck(azeem) who is a Debian guy. I asked him and he was very kind enough to patiently explain me what to do for tools in procps that conflict with Hurd tools, what to do for tools that don't work on Hurd and such things. He answered almost all my silly questions patiently. He was also kind enough to add my account to Debian Hurd list on alioth.debian.net so that I myself could submit patches directly. I did all the work as suggested by him. Later there were some build issues due to most common build failures reason on Hurd, the PATH_MAX problem.
I had asked Samuel sometime back and he had asked me to allocate the path size dynamically. I just did that and submitted the patch. It was then I reached the most interesting point. Samuel replied almost as soon as I submitted the patch. Oops, I forgot who is Samuel? His full name is Samuel Thibault. He is one of the core Hurd developers. Does a lot of active development on Hurd. He is a post-doc at xensource. Over and above all those he is an amazing person at heart. I just wrote this blog post to dedicate this post to him. Ok enough of intro I think. I can call him too as my mentor, though not officially, but really speaking he has done a lot of mentoring for me through out Summer of Code period.
Samuel replied to my patch saying the memory allocation could be handled better. In the mean time I had committed a second patch changing few of the debian packaging rules. After seeing his suggestions I changed that submitted the patch again. He again noted few misconceptions in memory allocation and character array, though things were so basic and any Computer Science student is expected to know all those things, he explained me patiently where I was wrong. I just changed them and this time I did not want to take all the time to login to the patch tracker at alioth and upload it there, I just pasted in the paste-bin and asked him to review. He again said at some places you have used malloc unnecessarily and can be replaced by char arrays. He also noted me twice about spurious spaces. I changed them and submitted again. Now he said for snprintf statements you are hard coding the sizes to be read into the string where you can use sizeof operators on arrays since sizeof on arrays give correct values. This time he also noted how conditional for looping could be written better and what were the conceptual mistakes that I had done and few unnecssary code I had written, such as redundant checks. Also the funniest part was that pwdx tool in procps in which I was doing all these patchings, was being removed in debian/rules. He told me to keep it and not remove it since it does not mean that if it doesn't work now, it does not work anytime. In the mean time he also hinted that getting a happy code is a long process. implying that I should be patient I think ;-)
I again changed all of them and submitted the patch. To my surprise there was a spurious "]" character that was added somehow to the beginning of debian/rules file when I was editing it. He noticed it and he said that I was not freeing the memory I had just allocated using malloc and realloc. He also asked me to pull the allocation of memory out of the loop and free them in the end. I did that and submitted again.
Now he said while calling functions I was using this format foo (bar), but the procps convention was to use foo(bar). He asked me not to break the convention. Ah but this time he said he wanted some sleep, may be I think he thought I was too stupid and he could no more bear with me. So I told him that I would submit the next patch through mail and asked him to review later. I just left for the day.
So what? Why did I write all these? First of all I want to convey to all my friends who are thinking of contributing to Free and Open Source Softwares but staying away fearing that all the developers are Hi-Fi people and they may think you are too stupid that I am sorry to say it is not so. This incidence is the best example. I am sure if Samuel himself had written this patch he would have done it in less than 20 minutes. But he took all the pain to teach me good coding practices and few basics (which I should have known) of memory allocation for nearly 6 hours. I think we started the discussion at 10:30 PM or so and when I left it was 4:40 AM or so. What was the reason? Simple. He wanted me to learn how to do things. So I intend to say that, people at FOSS are too kind enough to help you out and guide you however stupid your questions may be (first of all they may not be stupid at all). So if you are considering to work on a FOSS project just go ahead, there are lots and lots of people out there eagerly willing to help those who contribute to their projects how much ever sacrifice they may have to do as Samuel nearly sacrificed 6 hours for something he himself could have done in much less time.
-- Thanks and regards,