chacadwa.com

Technical blog and writings by Micah Webner.

Blogrimage 2013 Day 1: Typos in LDAP module

Contributing patches to Drupal does not need to be a complicated process. For today's patches in my #1day1patch and #blogrimage challenge, I touched on a couple of simple typos.

The LDAP module is pretty important to us here at HFCC. LDAP (Lightweight Directory Authentication Protocol) support allows users to log into multiple systems using the same username and password, a huge requirement here where we can have over 20,000 current users at any given time. I tried to get involved with the LDAP module a couple of years ago, and really only managed to make a lot of noise before getting to busy to follow through with any actual helpful action. This blogrimage was a good reason to pick that back up, and I started with just a couple of simple tasks.

A while back I'd made some notes about some really simple typos we spotted in the module, so I dug those up for today's task. I started by checking the LDAP module issue queue for existing reports of typos and found one with a patch that needed to be reviewed.

Reviewing Drupal patches like this is pretty easy, especially from the Mac terminal. All you need is git, which is pretty easy to download and install. In my case, I've already installed the Xcode command-line tools from Apple, and the Homebrew package manager, so git is already installed on my machine.

I simply went to the Version control instructions page for the LDAP module and checked out the 7.x-1.x branch to a temporary directory, then downloaded the patch to be tested.

First, I viewed the patch. Even if you can't program and don't know anything about Drupal, git, or PHP, you should be able to see what this patch fixes:

[code lang=diff]
diff --git a/ldap_servers/ldap_servers.module b/ldap_servers/ldap_servers.module
index 35559e1..e6bb4d9 100644
--- a/ldap_servers/ldap_servers.module
+++ b/ldap_servers/ldap_servers.module
@@ -193,7 +193,7 @@ function ldap_servers_menu() {
);

$items['admin/config/people/ldap/servers/test/%'] = array(
- 'title' => 'Test LDAP Server Configuraion',
+ 'title' => 'Test LDAP Server Configuration',
'page callback' => 'drupal_get_form',
'page arguments' => array('ldap_servers_test_form', $menu_offset + 1, $menu_offset + 2),
'access arguments' => array('administer site configuration'),
[/code]

The line starting with a minus (-) sign is removed and replaced with the line starting with a plus (+) sign, changing the word Configuraion to Configuration. A pretty obvious fix, but best to make sure the patch applies cleanly with git apply. It did, of course, so I went back to the issue and marked it "reviewed & tested by the community" and added a comment about my testing.

Then I switched to the 7.x-2.x branch for the bug I wanted to report and fix, which was five places where the word mappings was spelled with three Ps (mapppings). Again, a super-simple fix. I opened a new issue to report the bug and attached a patch, which has already been marked rtbc by the module maintainer and is ready to commit.

This is the beauty of open source software. Rather than complaining to the module author about a bug and waiting for them to fix it, anyone can contribute a patch to make the software better. And you don't have to be a high-level programmer to submit patches. The only skills needed to review and create today's patches was to learn a couple of simple terminal commands and edit a couple of files to fix misspelled words. It took longer to write this post than to write and submit the patch and have it be reviewed by someone else.

Tomorrow's task: more typos in a different part of the LDAP module, and hopefully a shorter blog post explaining it!

Topics: