Halloween is over!

Not just the festival, but my project to write a short story or part thereof every day of October and publish them on the website. See my blog post from a couple of weeks ago for more information

All of the stories are now written and published at http://netsplit.com/halloween/ - up to and including today’s. It’s a good feeling to be finally finished. I’ll leave them up for at least a little while longer before I decide what to next with them, a round of editing and tidying up or two is certainly in order; and my current plan is to publish them collected together in printed or eBook form if people want it.

But until then I have a new project…

NaNoWriMo Participant 2011

…I’m going to be taking part in NaNoWriMo. For those that have not heard of it, which included myself until a month ago, it’s a competition of sorts to write a 50,000 word (minimum) first draft of a novel in the month of November.

I’ve had the idea for the story for a couple of years now, and what with wetting my apetite for writing again with the October project. I’m eager to get started on it. Now I just need to wait until midnight…

Halloween

Readers of this blog will mostly know me for the software I’ve written, most likely Upstart or my work on Ubuntu, but there’s another kind of writing I enjoy doing and it’s something I haven’t taken much time to do in the last few years.

Like everyone else I had to do some creative writing at school, but I really enjoyed it and took it quite a bit further writing many short stories over the years.

A friend of mine is taking part in NaNoWriMo this year, and the two of us discussed ways of practicing and, most of all, warming up for it. After all, writing over 1,650 words of a novel a day is no mean feat to go into stone cold. She’s been using 750words.com for a while, and I suggested she use that to write short stories along the lines of her planned novel, but not to be used for it, to practice.

Discussing it really fired up my desire to do some writing again myself, so I decided to join her. But obviously rather than copying, I decided to do something completely different in tone.

Each day in October, leading up to Halloween, I’m writing a short story myself. Since that’s a spooky event, I’m vaguely sticking to a horror theme for the stories. I say vaguely because it’s quite easy to slip from horror to other genres, such as science-fiction or thrillers, but the intent is certainly there that these all have a darker theme than usual.

I’ve also been using 750words.com for the most part, with an aim that each story be a minimum of that in length. One of the most interesting outcomes is that the earliest stories were hard work to reach 750 words from a simple idea, whereas the latest ones easily reach 1,000. In fact my latest story is almost twice the minimum length.

But at the end of the day, they are roughly 3-5 pages each and since they’re posted and published each day, they’re more akin to first drafts of ideas than polished works. I remember reading once about an author who would pin up the pages of a story he was writing to a shop window as each one came off the typewriter (Google tells me this was almost certainly Harlan Ellison), I like to think I’m doing the Internet-era equivalent.

Perhaps they will give some people joy and delight, or perhaps they will give some people nightmares. Even if not, I’m enjoying writing them!

You can read those so far at http://netsplit.com/halloween/ in all the usual formats, and check back every day or so for new ones if you like what you read.

Is this a mount point?

One of those unusual tests you sometimes need to do is to determine whether a given directory on the filesystem is a mount point for another filesystem.

A good approach to do this is to compare the directory with its parent directory, specifically the device ID as returned by the stat() system call.

The following code would work:

stat (path, &path_stat);

parent = dirname (path);
stat (parent, &parent_stat);

is_mountpoint = (path_stat.st_dev != parent_stat.st_dev);

If you want to know more information about the filesystem mounted there, you can use the statfs() system call. This returns, amongst other interesting details, the filesystem type.

if (statfs (path, &statfsbuf) == 0)
    is_ext3 = statfsbuf.f_type == EXT3_SUPER_MAGIC;

Coming Out

Today is National Coming Out Day in the UK, I understand that National Coming Out Day was actually yesterday in the US; apparently an International Coming Out Day is hard or something.

I am gay.

That doesn’t really count as coming out though, if I am anything it’s openly gay. In fact a friend once joked that I manage to include a reference to my sexuality in every blog post or e-mail I write, and that every Twitter post of mine ends in “still gay”.

Maybe he’s right, but if it is, it’s probably subconsciously deliberate.

I confidently predict that there will be no surprise coming out statements this year from anybody in the public eye. Not even from those who don’t exactly do a good job of hiding it, yet deny it every time they are asked. You know who they are.

I think that’s quite sad.

I strongly believe that is the duty of those in the public eye to be open about their sexuality.

Firstly from a positive point of view, everybody needs role models. A young man or woman coming terms to their own sexuality will be able to do much easier knowing that there are public figures they respect who are comfortable with their own sexuality and open about it.

And from a negative point of view, every public figure who’s denying their sexuality is reinforcing the idea that you should not be comfortable with it and that being open about your sexuality will cause you problems.

Many celebrities, for example, claim that the reason they haven’t come out is because they’re afraid of what it will do to their careers. This is not only ironic, since they’re just perpetuating the problem, but clearly nonsense since there are a number of extremely well known and loved figures who are openly gay.

So this is why I’m open about it.

I want to make sure that any new members of our community who are coming to terms with their own sexuality can be assured that this is not going to cause them a problem.

(Still gay)

On Sexism

The ongoing debate about Mark Shuttleworth’s keynote at the Linux Plumber’s Conference has been bothering me for a little while now, but I’ve been avoiding posting until now.

Before I do, let me make one thing clear (as if it wasn’t already), I am a gay man.

Mark is a heterosexual man. In his LPC keynote he is accused of sexism because in his keynote he said that making Linux easier to understand would make it easier for him to explain what he does to girls.

Now, let’s pretend for a moment that I’d gave that keynote. Let’s pretend that I’d said that that making Linux easier would make it easier for me to explain what I did to boys.

Would there be this uproar?

Oh they’d be an uproar alright, but it wouldn’t be about sexism – the homophobic right of our community would be throwing their bibles out of their prams with vigour!

But nothing about sexism!

In fact the very people who are currently attacking Mark would be defending me as a gay man for right to say things like that. And if they didn’t I could cheerfully accuse them of homophobia.

And that’s why this bothers me.

If Mark was sexist, than he’s sexist for only being attracted to women and understandably caring what they think of him. That’s not sexism, that’s biology!

Sometimes a spade is just a spade.

Sometimes when a man says that he likes girls, HE LIKES GIRLS!

If your complaint is that he uses “girls” to mean “women” then you need to get (a) in touch with some mystical arbiter of the colloquial English language & (b) a grip.

I suspect this has ended my chances of ever being offered a Keynote (not that I ever have) and that Linux Today will now claim I should resign (I don’t work directly for mdz, but I have a tremendous amount of respect for him) then so be it.

And this is why the outcry bothers me.

Drabble Contest: The Siege

I’d like to propose a new meme for the Planets, something a little more interesting than the third paragraph in your nearest bowl of Alphabet Soup.  Something, in fact, a little creative.

I wonder if you’ve heard of a Drabble?

A drabble, simply put, is a story, normally science fiction or fantasy that is exactly one hundred (100) words in length.  No more, no less.

Such things were often written in a contest, and so I’d like to propose such a contest.

To participate, all you have to do is write a story in 100 words and post it on your blog.

Here’s my attempt, entitled The Siege.

‘The city, sir!  It’s under siege!’
The king put down his goblet and stared at the sergeant.
‘Who is it this time?
‘It can’t be the dwarfs, they can’t reach the ramparts.
‘The trolls just don’t have the stamina.
‘The elves get drunk and wander off singing.
‘The ents are easily dispatched with fire.
‘And as for the orcs, wait long enough and they kill each other.’
‘So who is it?  Hmm?’
The sergeant looked sheepish, as the king awaited his answer.
‘It’s our own people, Sir!’
Ah, this was going to be a problem.

Revision Control Systems suck

My recent series of posts in which I had some difficulty with GIT (1, 2, 3) have garnered a lot of interest, and generated some discussion.  Many of the replies saw the funny side, which is nice as I was hoping to be at least amusing (rants are, after all, a form of entertainment) and more than I expected sympathised.  Many tried to help by giving me a sequence of commands that might work, ironically often the exact same commands I used in my original post.

And many told me I was an idiot, and that they had no problem; and that I should learn how to use GIT instead of just stabbing at guesses.

Those made me realise what the fundamental difference between myself and them are.

I don’t want to use a revision control system.

It follows that if I don’t want to use one, I certainly don’t want to waste time learning one!  I don’t want to use a text editor either, again it’s just something that gets in the way of what I really want to do.

I want to write code, and I want to fix bugs and test the fixes.

Actually, I don’t really want to fix bugs; but it’s one of those things you have to do as a responsible software author and maintainer.  Now, I sadly can’t just write code by thinking about it.  Even though I use zsh, holding down the TAB key just doesn’t write my code for me, so I have to use a text editor.

And I hate them, especially emacs, which is the text editor I use.  I keep hoping that one day Anjuta or something like MonoDevelop will be usable for writing and debugging C – but alas, that day has not yet come.  (Incidentally, if a developer would like some constructive criticism from my side, I would be perfectly happy to do give it – just grab me on IRC).

Now I don’t have to use a Revision Control System, unlike a text editor which is somewhat essential, but there are a lot of advantages to using one.  In particular, I think I have two primary use cases:

  1. Keeping a history of my changes
  2. Sharing my work with others, and allowing others to share their work with me.

Since I don’t want to use a Revision Control System, it should be as simple and painless to use as possible.  I have probably a dozen common actions that I do; so each of these actions should be just one command, with no options or flags to make them do the right thing.  For bonus points, these commands should be obvious and ideally have aliases for the similar commands in other systems for easier learning.

Here’s the first set:

  • get a copy of some source code, to which I can make my own changes if I wish
  • save my current set of changes to the history
  • put a copy of my source code, with changes, somewhere others can get at it
  • update my source code with changes made to where I got it from

We could probably call these get, commit, push and pull. Note that I’m not allowing for any kind of add, move or remove command.  Such things are a pain in the neck; my most common preference is just for any changes I’ve made to be committed.  This is probably one big reason why GIT and I don’t get on so well; it’s written for somebody else’s use case where the most common use case is committing nothing.

Since I pretend to like other people working on my software, I’ll need a couple of commands for doing that:

  • review the changes somebody else’s source code makes to mine
  • add the changes they’ve made to my source code.

I’ve yet to see a revision control system that makes the first one easy, which is sad, because it’s just about the most common operation I do on other people’s branches/repositories/clones; I’d call that review, and then we can call the second one merge.

And then for the last set:

  • look at the history of changes
  • examine the difference between two versions
  • extract a single change, in a format compatible with mailing

We can call these log, diff and show (though ideally diff and show would be just the same command with a revision range or single revision).

I’ve probably forgotten something important, but in general, those are the operations I try and do with a revision control system.  Thus I can create a Revision Control System Hate Index.  The more commands, options or flags it takes to do any of these operations, the higher the Hate Index and the more I’ll loathe it.

GIT scores badly, very few of these operations are a simple command.  Many require pre-configuration, many require options and flags to do the right thing.  And a couple of them are actually multiple commands.

In fact, GIT’s hate index gets increased further, because after a while you realise that most of the top-level commands very rarely do the right thing.  Instead, you start to break down the commands to their fundamentals.  If you’ve ever found yourself using git fetch you know what I mean.

This means that I have to stop thinking about writing code, and start thinking about using the revision control system and what the best way to accomplish the operation that I want is.  This is a fail that only results in hate.

And just for the peanut gallery, I’d like to point out that Bzr has a non-zero Hate Index as well.  In fact, there are misfeatures and bugs in Bzr that make my blood boil just as much as GIT, sometimes even more since Bzr actually claims to always try to do what I mean.

You know what would make me happiest?  If I had a text editor that took care of revision control for me.  Sometimes I wish there was a Linux version of the good old Borland IDE or at least VisualStudio.

GIT sucks (3)

Unfortunately I have to make a correction to my previous post.

In that post, I suggested that the following git command would work:

quest util-linux% git clone --bare . ssh://kernel.ubuntu.com/srv/kernel.ubuntu.com/git/scott/util-linux.git

I wholeheartedly apologise.  It turns out that what this command does is make the following local directory: $(pwd)/ssh:/kernel.ubuntu.com/srv/kernel.ubuntu.com/git/scott/util-linux.git.

Unfortunately this means that normal service of hating git, while still being utterly unable to find any reasonable command to do what I want, will have to resume.

All I want to do is run a command to take the branch I have in my local working tree, and put that on a remote server so that other people can get at it.

Failing that, I want sharks with frikkin’ laser beams on their foreheads!

Is either so much to ask?

GIT sucks (2)

Jason Clinton replied to my virtiolic rant about GIT with a well researched and thought out reply.  Sorry, that’s not what I mean.  He replied to my rant against a piece of technology with a personal attack.

I feel that there’s a few points that I need to reply to.

Romeo Tango Foxtrot Mike

I did, in fact, the vast majority of my post was excerpts from the Foxtrot Mike.  It was the Foxtrot Mike that was half of the problem.

and because the company you work for has a horse in this race and they can do no wrong

What does this having anything to do with anything?  The company I work for develops many pieces of software, and a quick bit of searching will find people who work for the same company (including myself) complaining just as loudly about them.

Sometimes, sadly, it seems that people in the open source world are unable to separate other people from the companies that they work for.  Ironic, given the high turnover, and frequent moves between the different companies that most people seem to go through.

I am not Canonical.  I am not on the Bazaar team.  I have been involved in open source since long before I joined Canonical, and I will almost certainly be involved long after I leave Canonical.

Most importantly, I am able to hold my own opinions, and I am able to form those opinions without influence from my employers.

If you don’t believe me, just go back a couple of years and look at some of my rants about Arch, and the first Bazaar.  Ask for a copy of my book, “Arch is easy, and other lies the developers may have told you.” It has a cool cover.

GIT reminds me a lot of Arch.

My personal opinion about this is that Arch (and now GIT) is the first distributed revision control system that people try, and then they get it.  They understand why distributed revision control is so awesome, and they attribute this awesomeness to Arch (and now GIT) rather than realising that it’s an inherent property of any such system.  The learning curve is pretty damned steep, so there’s a lot of investment to learn Arch (and now GIT) and once people have made an investment in something, and received an epiphany as an award, they become very attached to it and very aggressive about attacks on it.

and because you can’t be bothered to look up what you want to do first

Again, it should be clear from the post that I had spent a very long time trying to look up what I needed to do and found no help.

From the very same Git Tutorial that you were about to link to in a giant section titled Using git for collaboration you could, you know, look at the command you think you might want:

Have you actually read that?  I have, yesterday as it happens.  All of the examples are with bob and alice working on the same machine, it makes a brief reference to the two being on different machines but then assumes that bob can access alice‘s workstation.

Utterly useless.

And since you’re a very smart person with a history of working with VCS’s and a resume a mile long in the FOSS community, you know that that’s a giant red flag that you’re about to force the tool you’re using in a mode that is not distributed.

And as you can clearly see, I was trying not to do so.  I was simply trying to push changes from my workstation to a server from which alice, err sorry, lamont could pull them.  If I am picking the wrong commands because of familiarity with other systems, then frankly GIT is being perverse in deliberately using commands in a different way.  Even BitKeeper used push for “make your changes public”.

You say that I’m using the wrong command?  Well, let’s try and figure out from first principles what command I actually want.  git help should tell us:

The most commonly used git commands are:
   add        Add file contents to the index
   bisect     Find the change that introduced a bug by binary search
   branch     List, create, or delete branches
   checkout   Checkout a branch or paths to the working tree
   clone      Clone a repository into a new directory
   commit     Record changes to the repository
   diff       Show changes between commits, commit and working tree, etc
   fetch      Download objects and refs from another repository
   grep       Print lines matching a pattern
   init       Create an empty git repository or reinitialize an existing one
   log        Show commit logs
   merge      Join two or more development histories together
   mv         Move or rename a file, a directory, or a symlink
   pull       Fetch from and merge with another repository or a local branch
   push       Update remote refs along with associated objects
   rebase     Forward-port local commits to the updated upstream head
   reset      Reset current HEAD to the specified state
   rm         Remove files from the working tree and from the index
   show       Show various types of objects
   status     Show the working tree status
   tag        Create, list, delete or verify a tag object signed with GPG

Any of those strike you as doing what I want?  I imagine that getting changes from your workstation to a web or git server is a sufficiently commonly used command, after all, even the kernel developers all publish their branches on master.kernel.org.

Well, it’s clearly not add, or fetchmerge? pull? no. reset? status? no.

You know, reading that, I really might think that the right command is push.

The git(1) manual page gives even more commands, one of them looks really appropriate:

git-send-pack(1)
Push objects over git protocol to another repository.

The manual page on this instantly refers us back to push.

DESCRIPTION
Usually you would want to use git-push, which is a higher-level wrapper
of this command, instead. See git-push(1).

If push really isn’t the right command, perhaps the Foxtrot Mike could stop referring to it everywhere?

Now, it happens that I received some helpful replies as well.  You clearly know the right command, and even manage to mention it, but not in any kind of helpful way.  Another kinder soul was much more helpful.

clone is the right command, it can take two arguments and the first argument can be “.” while the second can be a remote URL:

quest util-linux% git clone --bare . ssh://kernel.ubuntu.com/srv/kernel.ubuntu.com/git/scott/util-linux.git

was what I actually wanted.  Curiously nobody in the #git channel seemed to know about this when I was asking for help.

Users coming from other revision control systems will probably equate clone to branch, or checkout or some other similar operation.  It probably won’t occur to them that they can reverse the arguments.  This should definitely be prominently documented.

And no, the GIT tutorial never gives this example.  It’s always clone remote to local.

Random aside, I discovered that bzr supports bzr branch local remote as well; neat.

Someone else tried to be helpful, but ended up simply being amusing.  They suggested that I use git format-patch to extract my patches and then send them by e-mail.

Can I just say that if your revision control system is so bad for collaboration that patches must still be sent by e-mail, then something is deeply, deeply wrong.

To finish up, in a comment on your own blog post you say:

All the documentation in the world won’t help if even smart people like Scott decide not to read it and demand that git work exactly like bzr does. Which is exactly what happened here. Again.

A quick bit of checking would show that the example I gave wouldn’t work with bzr either.  Bzr needs a silly “bzr+” on the front of the URL, there’s a lot of fail there too.