Dunc's programming and sysadmin blog

I'm an experienced C and Perl programmer and systems administrator, interested in large scale ruthless automation of systems. These are random musings about stuff I'm doing or thinking about.

PSD Article 10: Use Automation Wherever Possible - build tools to help you program

A few months ago, I wrote another <b>Practical Software Development (PSD)</b> article:

<a href=“http://www.doc.ic.ac.uk/~dcw/PSD/article10/“>Use Automation Wherever Possible -   build tools to help you program</a>.

Posted 40 weeks ago

Gitlab and gitolite

I now maintain a Departmental Gitlab service, and have been working out how to archive “old” Gitlab projects, users and groups, preserving them on a readonly Gitolite system.  This has involved the excellent Gitlab API, also digging into the Gitlab Postgres database, and writing numerous Perl scripts to extract information from Gitlab, and convert Gitlab information (and repos) into Gitolite format.

Posted 40 weeks ago

httpoxy: building custom Apache2 packages

Just built and released a new version of Apache2 for use where I work (where we need to apply a few locally written patches to generalise suexec) in order to fix the httpoxy vulnerability.  Took the latest Ubuntu Apache2 source package with the httpoxy vulnerability fixed, and automatically applied our suexec patches to it, generating a local package.  Released it to a test webserver, checked that it worked and fixed the bug, then released it to 5 other Departmental webservers.  Good afternoon’s work.

Posted 48 weeks ago

My Perl course got cancelled

A while ago, the Perl course that I gave every January to second year undergrads got cancelled, because “Perl is not modern enough”.  Clearly someone’s not heard of the “Modern Perl” Renaissance!

Posted 49 weeks ago

Brexit ramifications

Sigh, so stupid that we’ve chosen Brexit, but sadly having asked a question of the British people, and received the answer, you can’t unask the question - or ignore it.  So now we’ll be leaving the EU.  New Prime Minister, new Cabinet, it’ll be interesting to see what happens in the next few months.

Posted 49 weeks ago

How to Crash ZFS on Linux: Glob Snapshots over NFS

Building an experimental online backup system on Linux, using rsync and ZFS snapshots to build a time machine like “past versions of your files”.  Sucks up 15TB of home directories and shared volumes, then exposes the readonly results over NFS.  ZFS on Linux has only just got the ability to share snapshots via NFS, and we’ve found that globbing across multiple snapshots over NFS reliably crashes the online backup fileserver (nfsd threads go into D state and the NFS client hangs, over time more and more nfsd threads go into D state).

To work around this snafu, I’ve built a tiny RESTful API web service that runs on the backup fileserver, receives a path such as ~dcw/blah or /vol/blurgh, discovers all distinct versions (in all snapshots) of that path by globbing across all snapshots locally on the server, and reports the distinct version paths via a JSON report. These things are sent to try us!  

Posted 83 weeks ago

Banning Strong Encryption: sign the petition against it

I’ve just signed the UK Government petition against Prime Minister David Cameron’s recently reported idea of banning strong encryption in order to “ensure that terrorists do not have a safe space in which to communicate.

While that sounds laudable, reading deeper into his idea there is a spectacularly naive implication behind the Prime Minister’s words that strong encryption may be rendered ineffective for bad people (like terrorists) without rendering it equally ineffective for the entire internet, allowing authoritarian governments to repress their citizens even more than they do at present, etc.

One example of a cryptography expert’s reaction to the UK PM’s proposals may be found here:

http://uk.businessinsider.com/bruce-schneier-david-cameron-proposed-encryption-ban-destroy-the-internet-2015-7 

Is this the latest incarnation of the perennial favourite of dumb politicians, the Evil Bit?  see https://en.wikipedia.org/wiki/Evil_bit

Posted 95 weeks ago

Shared Norms of C Programming: followup

Ok, I’ve created a draft article discussing this idea of individual or shared norms of C programming, not quite finished yet, but available here:

http://www.doc.ic.ac.uk/~dcw/PSD/article9/

Also I’ve started a LinkedIn discussion about this, good comments already coming in.  It’s still an open question whether each C programmer’s personal lists of safety tips can merge together in any useful sense to form a shared knowledge base.  Let’s see:-)

Posted 97 weeks ago

Shared Norms of C Programming?

Following a discussion on the “Plain Ordinary C” LinkedIn newsgroup, I started wondering about whether C Programmers (or programmers more generally) develop a shared sense of normal ways of programming, rather in the sense of “Norms” in psychology, these rules of thumb might alert you to something “not right” just because it’s very abnormal, and thus keep you away from “Here be dragons” areas on the map.

The particular example was a C newbie, writing a recursive call to main().  In fact, worse than that, main() called function f() which called main() again, i.e. it was Mutual Recursion involving main().  This seemed so weird and evil to me that I thought it was a very confused example - in fact, the recursive calls had no conditions, so it was a confused example that could not possibly work.

I suspect every individual C programmer develops their own personal sense of what’s normal, but the more interesting question is whether these individual senses combine into a Shared Norm.  I don’t have an answer to this, but it’s interesting to think about:-)

A couple of my suggestions are:

Do not call main() from anywhere - it’s the entry point.

Do not use recursion when a simple iterative solution is available.

Posted 97 weeks ago

Oh bugger

Just heard that Terry Pratchett has died.  Damn damn damn.

greatmen–

Posted 119 weeks ago