Journal

bsda2: Presenting LST.sh - A Portable Shell Array Library

Unlike the Bourne-Again Shell, the FreeBSD Almquist Shell does not have native array support. So for bsda2 I have largely resolved to storing data in strings, using the Line Feed character as a separator. Over time I have established best practices for working with these strings, which some time last year I decided to put into a small library - LST.sh. And like any small project its exploded in my face …

Read More …

bsda2: 0.3.0 Release, the Return of pkg_validate

The 0.3.0 release of bsda2 reintroduces the pkg_validate command, providing the same functionality as running pkg check -s (see [pkg-check(8)]). The first BSD Administration Scripts collection provided pkg_validate, because at the time this functionality was missing. With bsda2 this was considered obsolete, but given the current state of multi core computing and fast SSDs there is an opportunity for significant performance gains.

Read More …

C++: Sane Shift Operators

Bitwise shift operators in C++ are wrought with perils. Undefined behaviour awaits those shifting negative integers or shifting too far, shifting by a negative number is implementation defined, which means the compiler cannot just pretend it didn’t happen or format your hard drive, but you still don’t have any guarantees about what exactly you get.

Read More …

bsda:obj: Object Oriented Programming Dos and Don'ts

Once upon a time I wrote an OOP framework for shell scripts and in 2010 I even presented it at EuroBSDCon. Originally I was going to use bsda:obj, the OOP shell scripting framework, to rewrite the bsdadminscripts. By now they have been rotting, mostly long obsolete and abandoned, on sourceforge. However a couple of the tools therein remain popular, which finally got me to recode and release them. Post-release I’ve started cleaning up bsda:obj so I would like to share a couple of lessons I’ve learned and applied over the years.

Read More …