Tuesday, 30 April 2013

Diff Project part 1 --invoke-diff-cmd -- Take 2 (interlude)

Because I couldn't decide what to do about the delimiter-prefix issue, where %f1 could potentially cause issues for script users, I made the shape of the switches OS dependent (%f1...%fn for unix, ---f1... for windows) and also added a feature that allows people to change that prefix, so you could say svn diff --invoke-diff-cmd="# diff -u #f1 #f2" if you want, and use '$', '-' or even '---' etc.

Not such a good idea(it was fun to code though) because changing the user interface across platforms is disorienting. 

I also rewrote svn_io_create_custom_diff_cmd() to use svn_string_buf_t instead of the string.h functions I used previously.

However, for now, I'm feeling somewhat strfry(Gabriela) and so I'll take a little break from --invoke-diff-cmd to let the concepts I've learned settle, and instead have a go at writing a short introduction to the SVN_DBG tool for the HACKING guide -- watch this space :)

Monday, 29 April 2013

The RULES of C STRING club

1st RULE: You do not talk about C STRING club.

2nd RULE: You DO NOT talk to the cat about C STRING club.

3rd RULE: If Subversion says "stop" or goes limp, taps out the fight starts.

4th RULE: Only one woman to a fight.

5th RULE: Always more than one fight at a time.

6th RULE: No direct assignments of strings, no third pot of coffee.

7th RULE: Fights will go on as long as they have to.

8th RULE: If this is your first night at C STRINGS club, you HAVE to compile.

Wednesday, 24 April 2013

Life Pro Tip: svn up regularly!

I was fiddling with the --internal-diff command and when testing, svn coredumped on me.   So,  I removed my recent changes leaving the original patch I'm working on in place and... it still coredumped. 

OMG,  what did I break?  And how?  Because nothing I did should have caused this...

Just for luck, I decided to compile the original version, and the bug was there all the time.  Phew, I'm innocent(just this once...)

So, I post the fix to the dev list and --- Ben already found and patched the issue 2 weeks ago.

Note to self:

 before you do anything!

Monday, 22 April 2013

Fun with Null Terminated Character Arrays

The function svn_io_create_custom_diff_cmd(...) that I wrote returns a null-terminated character array (ntca) which
svn_io_run_external_diff(...) passes to

svn_io_run_cmd(...) which passes it to

svn_io_start_cmd3(...) where this loop:

for (num_args = 0; args[num_args]; num_args++)

relies on the NULL as a sentinel, before copying and utf converting it into the new ntca it then passes into apr_proc_create().

This arrangement presented me with quite some difficulty because it failed at random points and made it appear as if my function was correct, but that the diff programs themselves were randomly failing with colourful error messages.

Unfortunately, I was completely innocent of the idea that this NULL terminator would be an implicit conditional 3 functions ahead.

I mistakenly offset the NULL by one and ... I got a very good (and thorough) demonstration of how droll a broken pointer can be ;-D

Saturday, 20 April 2013

How to deal with recalcitant snakes

Subversion's test suite is written in Python.  Easy enough one would think, but, not so trivial at all and so I have resorted to taking combat lessons from the vorpal bunny:

... as always, it's just a matter of attacking the problem from the right direction.

Thursday, 18 April 2013

Yesterday was my last OPW day...

...and do take note that the door I opened in the previous post was a way-in and not a way-out :)

Without OPW I wouldn't have taken up coding again --- In fact I'm very surprised at myself that I am (nearly almost!) a geekess again.  But so it is indeed, I have be given partial commit access to Subversion, and some of the work I produced was good enough to be added to the project.

What's more, with almost every failure I learned a lot -- the Subversion devs are a fount of knowledge and very generous with useful advice and constructive, direct feedback.

I plan to continue to contribute to Subversion --- I only just started to make inroads into producing functional code, so now I can finally get to actually be productive.

I would like to thank the OPW team and Elego for providing me with both opportunity and motivation.

Tuesday, 16 April 2013

An instant playground for Subversion

Subversion is a huge program with many dependencies, and writing a small test program outside of the code body is not so easily possible.

True, you can copy a function and change it and hook into an existing command, but it litters the code and takes up valuable time that you could spend coding what you had in mind instead.

So I made a patch that plugs in a command line option and a function, and thus sets up an instant playground for you.

Seasoned devs might not find this toy very useful, but casual submitters, rookie coders and tourists who just want to poke around the code without too much effort might find this to be just the ticket that makes starting to play easy.  Also, if you want to explore one of the APIs that Subversion uses (APR for example), this patch is for you.

All I need now for perfect happiness is an 'unpatch' tool that removes this patch when it's no longer needed from the resulting patch, without touching any other work that people did!

Sunday, 14 April 2013

The next OPW round is on!

The Gnome Outreach Program for Women is launching  another round of FOSS internships, to start on the 1st of May.

Since OPW doesn't have the cool advertisement video they deserve to have, I think I let Sabah sing to lure the ladies to the show, she has practice and casts the summoning spell so beautifully:

Btw, Sabah is 80 (eighty!) in this video, and the song is a classic Lebanese love song, I hope you enjoy it! 

Thursday, 11 April 2013

Diff Project part 1 --invoke-diff-cmd

The first attempt at adding a new diff command to Subversion can be found on the Subversion dev mailing list.

I've not seen the '---' switch pattern I used in the solution in Unix(which sort of suits my purpose very well) but I think it looks quite in keeping with the style.

Part II will take less time I hope :)