Bug solving for Systers
As part of proving myself for this Google Summer of Code, I started off with solving a few bugs. I succeeded in solving two bugs today.
The bugs mentioned at the trial bugs page seemed like a good place to start.
1. Bug #348692
This bug was quite easy to fix. But not that easy to locate. Initially I was a bit scared by looking at the description. I started off with my usual grep-ing to search through the code and tried to find the places where welcome_msg is located. I shortened to string to just ‘welcome’ and grep-ped again. One of the results immediately caught my eye. The file was in templates/ and called susbscribeack.txt. This contained the string %(welcome)s in the wrong place. I moved it to the top and it worked. Very easy but fun to see the end result.
Took several iterations of testing via command line mailx tool where I Joined and left the list several times to confirm the result.
2. Bug #514136
This one was more fun in terms of setting up a test environment. It involved testing digest messages. I wouldn’t want to wait whole day for the digest to come to me! Fortunately mailman sends a digest if the mailing list is quite active. But sending so many mails every time when I want to test a change to the code would make it tedious. So I took some time to quickly make an email sending script in Python. I could have done this using the mailx tool, but then I am not very good with shell scripts and I wanted to learn more of Python.
Here is the tiny “Spam” script that I wrote (this is a direct adaptation from the Python documentation on smtplib module):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #!/usr/bin/env python # Import smtplib for the actual sending function import smtplib # Import the email modules we'll need from email.mime.text import MIMEText s = smtplib.SMTP('localhost') i = 0 while i < 25: # Create a text/plain message msg = MIMEText("Message Contents for message number "\ + str(i) + " .") me = 'priya@localhost.localdomain' you = 'test@localhost.localdomain' msg['Subject'] = 'Message number ' + str(i) msg['From'] = me msg['To'] = you s.sendmail(me, [you], msg.as_string()) i = i + 1 s.quit() |
So this made it easier for me to test. Next I tried to locate the place where this might be happening. Since this was part of a message it made sense to have a look in the templates/ directory. After more grep-ing I located the following text in templates/masthead.txt:
Send %(real_name)s mailing list submissions to %(got_list_email)s
Another grep for got_list_email led me to Handlers/ToDigest.py where the action was taking place. I just changed the required code to make it output correctly ('got_list_email': mlist.real_name + "+new@" + mlist.host_name).
That is it. All in all a fun time. Let us see if they are approved by the developers or not. I have my fingers crossed!