Predictable
Stephen Hahn's blog at Sun Microsystems
All | Pastime | Person | Peruse | Position | Process | Product

« Previous month (Feb 2005) | Main | Next page of month (Mar 2005) »
20050331 Thursday March 31, 2005

For the record, 9

Tie knot: Bow.

(2005-03-31 09:00:00.0) Permalink Comments [0]
20050330 Wednesday March 30, 2005

Ballistics between sessions

Dropped in to a series of technical sessions being held in the Santa Clara Auditorium today. There was a longish lunch period and Adam, Eric, and Andrei passed the time launching water bottle lids between ever higher goal posts. Here's a cameraphone shot from an early phase

although the posts ended up a little over a foot high, once an additional steel water flask was repurposed from a nearby table.

Tie knot: Bow (with a bow tie).

(2005-03-30 23:20:46.0) Permalink Comments [0]
20050329 Tuesday March 29, 2005

Bespoke services: application/catman

For various reasons—some reasonable, some suspect—Solaris doesn't ship with a compiled set of windex databases for its manual pages. The unfortunate result is that helpful commands like apropos(1) or man -k are unhelpful:

$ apropos sort
/usr/man/windex: No such file or directory

smf(5) provides one way to address this shortcoming, via a transient service to be run during startup. Our service description would be roughly equivalent to the following:

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">

<service_bundle type='manifest' name='sch:catman'>

<service
        name='application/catman'
        type='service'
        version='1'>

        <create_default_instance enabled='false' />

        <single_instance />

        <!--
          By default, application/catman will run in the background
          during boot.  If you want to run it periodically, execute

             # /usr/sbin/svcadm restart catman

          If you wish to augment the default MANPATH, use the setenv
          subcommand to svccfg(1M).  For instance, to add the Java
          manual pages to the build:

             # /usr/sbin/svccfg -s application/catman
             > setenv MANPATH /usr/share/man:/usr/java/man
             > exit

             # /usr/sbin/svcadm refresh catman

          If MANPATH is not defined, the default manual path is
          /usr/share/man, as per catman(1M).
        -->

        <dependency
                name='local-filesystems'
                type='service'
                grouping='require_all'
                restart_on='none'>
                <service_fmri value='svc:/system/filesystem/local' />
        </dependency>

        <dependency
                name='remote-filesystems'
                type='service'
                grouping='optional_all'
                restart_on='none'>
                <service_fmri value='svc:/network/nfs/client' />
                <service_fmri value='svc:/system/filesystem/autofs' />
        </dependency>

        <exec_method
                type='method'
                name='start'
                exec='/usr/bin/catman -w'
                timeout_seconds='0' />

        <exec_method
                type='method'
                name='stop'
                exec=':true'
                timeout_seconds='0' />

        <property_group name='startd' type='framework'>
                <propval name='duration' type='astring' value='transient' />
        </property_group>

        <stability value='Unstable' />

        <template>
                <common_name>
                        <loctext xml:lang='C'>
                                manual page index generation
                        </loctext>
                </common_name>

                <documentation>
                        <manpage
                                title='catman'
                                section='1M'
                                manpath='/usr/share/man' />
                </documentation>
        </template>
</service>

</service_bundle>

Following my own instructions in the comment block, I defined a value for MANPATH and refreshed the service. My setting can be double-checked with svcprop(1) like so:

$ svcprop -p start application/catman
start/exec astring /usr/bin/catman\ -w
start/timeout_seconds count 0
start/type astring method
start/environment astring MANPATH=/usr/share/man:/usr/openwin/man:/usr/sfw/man:/usr/dt/man:/usr/perl5/man:/usr/java/man:/usr/apache/man:/usr/X11/man:/opt/sfw/man:/opt/csw/man

Issuing "svcadm enable catman" will cause the service to be executed immediately, and upon each subsequent boot. Our earlier query becomes fecund:

$ apropos sort
FcFontSort      FcFontSort (3fontconfig)    - Return list of matching fonts
aclsort         aclsort (3sec)  - sort an ACL
alphasort       scandir (3c)    - scan a directory
alphasort       scandir (3ucb)  - scan a directory
bsearch         bsearch (3c)    - binary search a sorted table
bunzip2         bzip2 (1)       - a block-sorting file compressor and associated utilities
bzcat           bzip2 (1)       - a block-sorting file compressor and associated utilities
bzip2           bzip2 (1)       - a block-sorting file compressor and associated utilities
bzip2recover    bzip2 (1)       - a block-sorting file compressor and associated utilities
disksort        disksort (9f)   - single direction elevator seek sort for buffers
ldap_sort       ldap_sort (3ldap)   - LDAP entry sorting functions
ldap_sort_entries               ldap_sort (3ldap)   - LDAP entry sorting functions
ldap_sort_strcasecmp            ldap_sort (3ldap)   - LDAP entry sorting functions
ldap_sort_values                ldap_sort (3ldap)   - LDAP entry sorting functions
libbz2          libbz2 (3)      - library for block-sorting data compression
look            look (1)        - find words in the system dictionary or lines in a sorted list
qsort           qsort (3c)      - quick sort
sort            sort (1)        - sort, merge, or sequence check text files
sortbib         sortbib (1)     - sort a bibliographic database
tsort           tsort (1)       - topological sort
...

Exercises
  1. Add a configuration property that makes the service also rebuild the nroffed versions of the manual pages, if set to true.
  2. Make the service regenerate only in the case that components in the path have changed.

Tie knot: Knot 54 (Hanover).

(2005-03-29 13:31:58.0) Permalink Comments [4]
20050328 Monday March 28, 2005

For the record, 8

Tie knot: No time, no knot, alas.

(2005-03-28 09:00:00.0) Permalink Comments [0]
20050325 Friday March 25, 2005

For the record, 7

Tie knot: Knot 5 (Pratt or Shelby).

(2005-03-25 09:00:00.0) Permalink Comments [0]
20050324 Thursday March 24, 2005

For the record, 6

Tie knot: Knot 25 (Christiansen).

(2005-03-24 09:00:00.0) Permalink Comments [0]
20050323 Wednesday March 23, 2005

For the record, 5

Tie knot: Knot 6 (Prince Albert variation).

(2005-03-23 09:00:00.0) Permalink Comments [0]
20050322 Tuesday March 22, 2005

Rained out

A rainy stretch here in Northern California is keeping me off the court while my body repairs itself. But I'll need to go practise in the wet if I'm ever to get my jump shot back...

Tie knot: Knot 44 (Grantchester).

(2005-03-22 22:49:00.0) Permalink Comments [0]
20050321 Monday March 21, 2005

For the record, 4

Tie knot: Knot 31 (Windsor).

(2005-03-21 22:48:22.0) Permalink Comments [0]
20050318 Friday March 18, 2005

For the record, 3

Tie knot: Knot 18 (Plattsburgh).

(2005-03-18 22:47:02.0) Permalink Comments [0]
20050317 Thursday March 17, 2005

On the court again

I'm a little sore and a bit bruised: I've started playing pick-up basketball on the outdoor court here at the Menlo Park campus. I pretty much stopped when we started (a) work on smf(5), and (b) parenting—three years. (Finishing my dissertation also required a break, but not nearly as long as this one.)

I feel slower, and my skills are very rusty. Regular practice will fix at least one of those.

Tie knot: Knot 23 (Cavendish).

(2005-03-17 23:18:12.0) Permalink Comments [0]
20050316 Wednesday March 16, 2005

String theory split

A few people mentioned an article in the San Francisco Chronicle describing the current support and skepticism around string theory in the physics community to me. It's worth a read. I would have liked to see some comments about aspects of theory—signs of the Higgs particle or supersymmetric structure—that should become testable at CERN's Large Hadron Collider in 2007. It's worth noting that, since some of its opponents are quoted in the article, we would already be exploring this energy regime at the Superconducting Super-Collider, if it had been ready by its revised completion date of 2003. (You didn't think this was a new argument, did you?)

Tie knot: Knot 12 (St Andrew).

(2005-03-16 22:43:52.0) Permalink
20050315 Tuesday March 15, 2005

Knotty engineer

As a California-residing, code-writing Sun engineer, I don't have a lot of sartorial restrictions beyond the standard requirements for coverage. It's been a bit of a shock, therefore, to co-workers and long time customers to catch me wearing a necktie. The most common question is "Are you interviewing?" Which, given that whole writing-code-in-California bit, isn't very appropriate—this isn't standard engineering costume out here.

I think the easiest way to understand it is as an eccentricity: I'm working my way through Fink and Mao's The 85 ways to tie a tie. They identify thirteen suitably aesthetic knots, nine of which are in some sense novelties, not being the standard three or four. Each day, I've been working my way through another one of the aesthetic or historically interesting knots, by tying it on and wearing it through the work day. My head hasn't popped off yet.

Tie knot: Knot 7 (Half-Windsor).

(2005-03-15 11:50:05.0) Permalink Comments [2]
20050314 Monday March 14, 2005

smf(5): manifest editing assistance

We had a productive wrap up meeting for Solaris 10 Platinum Beta last week, with lots of good feedback on smf(5). One point raised is that few people like to hand-edit XML—or, maybe, many people hate to—so tools for composing service manifests are needed. We'll need to percolate on how best to improve or extend the current set of tools, but there are a few tricks out there already.

A bad manifest. Let's take a well-formed and valid manifest file and add the nonsensical line

<french_fry>I,m a bad element.</french_fries>
to simulate a developer making a composition error during service development. How do we determine that our manifest is now broken?

svccfg(1M) validation. As I mentioned, the basic tools aren't helpful. The logical svccfg(1M) subcommand to check a manifest for correctness is validate. Its output on our manifest is

$ svccfg validate /tmp/gdm2-login.xml
svccfg: couldn't parse document
which accurately tells us the manifest is broken but does not indicate how (at all).

xmllint(1). The XML parser implementation of svccfg(1M) is the GNOME libxml2, which includes a general validation tool in the form of xmllint(1). If we invoke this command with its --valid long option, we get

$ xmllint --valid /tmp/gdm2-login.xml
/tmp/gdm2-login.xml:26: parser error : Opening and ending tag mismatch: french_fry line 26 and french_fries
        <french_fry>I,m a bad element.</french_fries>
                                                    ^
which isn't validating the document, but is telling us where and how it is not well-formed.

Graphically clear. An interesting option is to use the jEdit editor, with its XML plugin. With our document, the XML plugin will validate on save and highlight the incorrect line with red underlining:
jEdit main window
Moreover, the error window shows both the non-well-formedness and the invalid <french_fry> element (which is absent from the non-fast food-oriented service bundle DTD).
jEdit error window
So we see both the immediate and the deeper error, plus the plugin highlights matching tags and provides completion menus for tag selection. Civilization to most, I expect.

I happily use vim for development, but it's important to note the value in jEdit just from using a different XML implementation. Using other tools to ease your composition of service descriptions (or profiles)? Let us know—and, rest assured, we're working to make that svccfg(1M) output more useful.

Tie knot: Knot 6 (Victoria).

(2005-03-14 18:39:43.0) Permalink
20050311 Friday March 11, 2005

For the record, 2

Tie knot: Knot 3 (Kelvin).

(2005-03-11 09:00:00.0) Permalink Comments [0]
Stephen Hahn
Sun Microsystems
sch@sun.com
17 Network Circle
MS MPK17-301
Menlo Park CA 94025 USA