This Space for Rent

Dec 31, 2007

Happy New Eng!

EPT901_newyearseve

We were driving back from dinner out tonight and when we went on our usual diversion past the Eng!s we spotted this shiny new engine parked in the Portland Traction yard. Possibly it’s the ex-CR&IC engine that I spotted back in september? It’s certainly shaped the same (but with approximately 50,000 GM SW-somethingoranothers floating around, it would be hard to tell,) and this paint job looks brand sparkling new.

It was pitch black when the best and I returned with my *istDS and the flash, so it still has more of the black cow at midnight look that I’d like it to, but it’s still something new and improved that I’ll have to walk down to the yard to look at tomorrow when the local fusion reactor is shining on this side of the planet.

Dec 28, 2007

Friday Dust Mite Blogging™

DustMitePurse

Dust Mite attempts to hide from the paparazzi.

1 comment

Dec 26, 2007

(Lego) railroad picture of the day

LegoBoxcab

We got Russell a lego Hobby Train kit for Saturnalia this year, and he wanted me to build something while he and Silas were playing with it. Whatever plans I might have had of doing something elaborate vanished abruptly when they tore into the kit like small tornados, and all I was able to do was to build this model of a vaguely Swiss or Costa Rican electric locomotive (but third-rail instead of overhead wire, because it’s basically impossible to build a minifig scale pantograph that doesn’t look ridiculous.)

The whole lego railroad system is somewhat ridiculous; the flanges are too deep and the stock track is curved like a particularly erratic streetcar system. But the gauge is only a little wider than the standard hobby O Scale(ish) gauge, so it might be possible to fabricate modified wheelsets that are O Gauge (anywhere from meter gauge to standard gauge, depending on how tall you think a minifig is.)


The Bat-Speeder

BatSpeeder

Millionaire Bruce Wayne at the throttle of his speeder.

Dec 24, 2007

Railroad picture of the day

holidaytrainkentstation

Russell’s new Lego holiday train pulls into Kent station to pick up a crowd of minifigs heading home for the holiday.

Dec 23, 2007

New Code! (for suitably horrible definitions of “Code”)

Annotations has been pushed, kicking and screaming, up to version 1.0.4 with the replacement of the old klunky handmade html markup language with my re-implementation of John Gruber’s markdown (mentioned here, here, and here.)

I expect that a bunch of bugs were introduced when I grafted markdown onto the horrible code, but I think I’ve cleaned out the more-obvious ones, and so that means that while I’m getting up my courage to grab my machete and give this code the refactoring it so richly deserves I’m going to dump out some New Code! for your horror-story needs.


New Code!

markdown has been pushed up to version 0.4 with the addition of a whole raft of new features ranging from manpages through a collection of internal revisions that now make the code 100% (or as close as I can tell) reentrant. There are also a few other possibly-not-completely standard enhancements to the code;

  1. I now reparse the [included text] part of a link reference, so I can have markup inside an <A block. I did this for one reason; I wanted to be able to do my normal “click to embiggen” images from annotations without continuing to mix HTML with code, and ->image!<- is a whole bunch shorter than mixing {pic: with html and trying to quote things properly.
  2. You can now pass flags to markdown() to keep it from processing [link][] and ![image][] commands (as well as disabling inline <A and/or <IMG tags, so people who want to wedge their tags in won’t be able to do it the easy way.
  3. Did I mention the manpages yet? And if that’s not enough, I’ve actually got the markdown page written, so people can go there and browse all the releases without having to make guesses about what they are.

So, yeah, this definitely counts as New Code!, and it’s actually code that may not eat your computer or do anything more unpleasant than giving a nice way to convert prose to html.

Dec 21, 2007

Friday Dust Mite Blogging™!

dustmitehat
That’s quite a hat you’ve got there, Mr. Nutcracker man.

3 comments


Friday Dust Mite Blogging™ [fun with markdown edition]

Dust Mite From Hell

In a photo from the archives, Dust Mite is helping with the reassembly after the machine room was moved three blocks north a few years ago. (Pell and Gehenna are supporting the pile of newer, faster, and more expensive gear.)

This is the first post I've made with the new markdowned version of annotations; the source code for this post lookslooked [bug in article writing!] like:

->![Dust Mite From Hell](/~orc/fdmb/DMFH_t.jpg =400x309)<-

In a photo from the archives, [Dust Mite][] is helping with the reassembly after the machine room was moved three blocks north a few years ago. (Pell and Gehenna are supporting the pile of newer, faster, and more expensive gear.)

[Dust Mite]: http://www.giantmicrobes.com/us/products/dustmite.html
[Markdown]: http://weblog.pell.portland.or.us/~orc/2007/12/20/000/
[annotations]: http://www.pell.portland.or.us/~orc/Code/annotations/

Now I have to spend a few hours debugging the rest of annotations, push out the markdown changes I did to support it, then New Code! it upon the rest of the world.

Dec 20, 2007

New Code! (down with html! version)

The major part of my "replace the clunky old version control system" webpage project is to replace the current "edit things offline with vi, then use rsync to push the pages over" arrangement with a more-wikiish online editor so I can directly type changes in and not have do do my previous dance of "edit/push/refresh webbrowser/etc."

But I'm not going to use the existing hacky editor that I've got in my existing weblog program, because it sucks dead bunnies through a straw (and, yes, I've been using it for 4 years now. I'm resistant to change.) Instead, I decided that I'd be far better off if I used a markup language like John Gruber's Markdown, and then I could edit via the web and the one true editor and have it mangle down into the same sort of html for browsers to look at.

Markdown is a pretty spiffy markup language, but it has one very serious bug; it's written in p*rl, it hasn't been ported to C, and all of the existing ports appear to be simple translations of the original massively search and replacey source.

Those bugs made it unworkable for me, so I decided I'd correct them by writing my own implementation of the code. In C.

So since Monday morning, I've been spending every spare cycle doing nothing but hacking away, and this morning I finally nailed it down to the point where it could recompile the language description into a form that is almost identical to the reference version, with only one large difference (and a few enhancements.)

My markdown misses some of the interactions between list items and paragraphs; the reference compiles

      * foo

* bar

to

      <li><p>foo</p></li>
      <li><p>bar</p></li>

while mine does

      <li>foo</li>
      <li>bar</li>

But, to make up for this loss, I've extended the image link format to allow me to specify image dimensions, via

    ![alt text] (http://here.I.am =WWWxHHH "this is the title")

or

     [tag]: http://here.I.am =WWWxHHH "this is still the title"

which means It's ready for me to hack into Annotations, and to be counted as my New Code! for the day.

Dec 16, 2007

New Code! (refactoring? What’s that? edition)

Savelogs has (silently, due to the s-l-o-w-l-y ongoing sccs/posting replacement project I'm doing now) been upgraded to version 1.5 with the addition of several things, not the least of which was the replacement of the old ARY()/IT()/NR()/GROW() macros that I was using for Pascal-string-style arrays[] with the (now that it's in two packages it must be...) standard STRING() pseudo-template scheme that I've implemented in cstring.h for the knights-who-say-NIH! version of pstree.

There are some other enhancements, too, like

  • Per-file backup name and compression options, so you can set the general rule to be to compress everything with SET COMPRESSED, then use the keyword UNCOMPRESSED to turn that off for a logfile that you don't want to have to uncompress to read.
  • Numbered backups have the revision number padded out to the # of digits present in the largest possible revision, so if you set a file to have 10 backups, the backups will be named 00,01,02,...,09,10. A nasty bitter little mind might point out that 0 to 10 is actually eleven backups, and, um, they're right. I'll leave that bug in to encourage me to produce a version 1.6.
  • Somewhat tidier trace output for -d.
  • And aliases for DOTS (DOT, DOTTED) and NUMBERS (NUMBER,NUMBERED) to make the language a little less fussy about syntax.

Surprisingly, it still appears to make logfile backups without dumping core. At least it does for me. So it's New Code! for the daring.

Dec 15, 2007

Defeating the mutant citrus menace

As promised, friday's giant mutant citron met its demise this afternoon. I chopped it up and used approximately the Joy of Cooking recipe for candied citrus peel to convert it from fruit to candy.

The recipe I used was:

Assemble

  1. One citron
  2. 2 cups sugar
  3. 1 cup water
  4. a cup or so of powdered sugar.
  5. one saucepan (~3-5 quarts)
  6. one plate
  7. drying racks to spread the candied citron on.
  8. the usual collection of kitchen implements of destruction.

Then

  1. wash, quarter, and slice up the citron.
  2. put the citron pieces into a pot, cover with water, bring to a boil.
  3. boil for 10 minutes.
  4. drain the water, and ...
  5. repeat steps 2-4, and ...
  6. repeat steps 2-4 (three times total)
  7. set the pot aside, then mix a syrup of 2 cups sugar + 1 cup water.
  8. pour the syrup over the citron, then put back on the burner and bring to a boil.
  9. cover, then boil approximately 30 minutes (reducing the burner as low as it can go while keeping the mix boiling; on the stove at home I could get it down to the simmer setting) stirring frequently.
  10. when the syrup gets stiff and sticky (it should be foaming up in the saucepan, and it will have reduced quite a bit), take the saucepan off the burner, then
  11. dump the powdered sugar onto the plate, then take the candied citron pieces out of the saucepan, roll them in powdered sugar, then put them onto the drying rack to dry.
  12. Try to avoid eating them all on the spot.

There will be a little sauce left in the saucepan, probably all crystallised at this point. You can scrape it out (I got about 2 tablespoons worth) and set it aside for some other cooking project. I'd recommend doing this because the candied citron and the syrup has this terrifically good concentrated citrus taste to it, to the point where other candied fruit becomes "eh, it's okay."

The local grocery store doesn't get citrons in stock very often. I think they've got them in stock leading up to Sukkot, but other than that they're few and far between. This particular citron was a lucky surprise -- I'd mentioned that I wanted a citron for fruitcake, and the best remembered when she was at the big big store and saw a single solitary mutant in the produce section. It was barkingly expensive, but it was worth it.

Yum! Yum! Yum! Yum! Yum!

Dec 14, 2007

Household vermin picture of the day


Half a cat is better than none.


Friday Dust Mite Blogging™

Dust Mite flees from a giant mutant citrus fruit. The citron might laugh now, but Dust Mite will get the last laugh because it's fruitcake season and we're going to make another fruitcake tomorrow afternoon.

1 comment


Trivial hack of the day

One of the minorly annoying featurettes in Linux (and, for that matter, in every version of Unix) is the nonstop battle between ^H and ^? for who's going to be the official backspace character. Years ago, I worked around it on pell by the simple expedient of only using the console (and then, after I put pell into a co-lo [where it's been for about 11(!) years now] by including "set-backspace-to-del-damnit" in my standard putty setup.

This is a bit of a kludge, and it only works (most of the time) because I remember that I have to do it.

At work, there's much the same problem, except that at work we have massively multiuser Linux boxes scattered all over North America, which 10s of thousands of people logging into them from a variety of different terminals and terminal emulators. The standard login drops people into a all-singing-all-dancing menuing interface which understands both ^H and ^?, so 99% of the time it's not a problem. The other 1% is a problem, though -- when telnet forks off /bin/login, it's handing off erase handling to the kernel, which, as is traditional for Unix, only allows one character erase key, and, because it's traditional for Linux, that key is ^?. And if your terminal or terminal emulator has a backspace key that does backspace, a typo is forever.

This makes some people very unhappy, and they complain -- for good reason -- bitterly about having to do hand workarounds to deal with it. And because this Linux is based off a modern one, all of the input for logging in comes from deep in the bowels of PAM (which is, at least as far as I've seen the grand prize winner for unreadable code outside of the deliberately obfuscated that makes up the bulk of the FSF's catalogue) so my old kludge of hand-tweaking getty and login won't work.

So what to do? Patch the kernel, of course:

--- ./drivers/char/~n_tty.c	Thu Dec 13 08:49:02 2007
+++ ./drivers/char/n_tty.c	Thu Dec 13 08:52:33 2007
@@ -422,12 +422,22 @@
 	enum { ERASE, WERASE, KILL } kill_type;
 	int head, seen_alnums, cnt;
 	unsigned long flags;
+	unsigned char erase1, erase2;
 
 	if (tty->read_head == tty->canon_head) {
 		/* opost('\a', tty); */		/* what do you think? */
 		return;
 	}
-	if (c == ERASE_CHAR(tty))
+
+	if ( erase1 = ERASE_CHAR(tty) )
+	    erase2 = erase1;
+	else {
+	    /* default ^H & DEL are both erase character keys */
+	    erase1 = '\010';
+	    erase2 = '\177';
+	}
+
+	if (c == erase1 || c == erase2 )
 		kill_type = ERASE;
 	else if (c == WERASE_CHAR(tty))
 		kill_type = WERASE;
@@ -506,7 +506,7 @@
 					put_char(tty->read_buf[head], tty);
 				}
 			} else if (kill_type == ERASE && !L_ECHOE(tty)) {
-				echo_char(ERASE_CHAR(tty), tty);
+				echo_char(ERASE_CHAR(tty) ? ERASE_CHAR(tty) : '\010', tty);
 			} else if (c == '\t') {
 				unsigned int col = tty->canon_column;
 				unsigned long tail = tty->canon_head;
@@ -672,6 +672,15 @@
 static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
 {
 	unsigned long flags;
+	unsigned char erase1, erase2;
+
+	if ( ERASE_CHAR(tty) ) {
+		erase1 = erase2 = ERASE_CHAR(tty);
+	}
+	else {
+		erase1 = '\010';
+		erase2 = '\177';
+	}
 
 	if (tty->raw) {
 		put_tty_queue(c, tty);
@@ -757,7 +766,7 @@
 		}
 	}
 	if (tty->icanon) {
-		if (c == ERASE_CHAR(tty) || c == KILL_CHAR(tty) ||
+		if (c == erase1 || c == erase2 || c == KILL_CHAR(tty) ||
 		    (c == WERASE_CHAR(tty) && L_IEXTEN(tty))) {
 			eraser(c, tty);
 			return;
@@ -1038,7 +1047,12 @@
 			set_bit('\n', tty->process_char_map);
 
 		if (L_ICANON(tty)) {
-			set_bit(ERASE_CHAR(tty), tty->process_char_map);
+			if ( ERASE_CHAR(tty) )
+				set_bit(ERASE_CHAR(tty), tty->process_char_map);
+			else {
+				set_bit('\010', tty->process_char_map);
+				set_bit('\177', tty->process_char_map);
+			}
 			set_bit(KILL_CHAR(tty), tty->process_char_map);
 			set_bit(EOF_CHAR(tty), tty->process_char_map);
 			set_bit('\n', tty->process_char_map);
--- ./include/asm-i386/~termios.h	Wed Dec 12 09:56:33 2007
+++ ./include/asm-i386/termios.h	Thu Dec 13 08:53:23 2007
@@ -60,13 +60,13 @@
 #ifdef __KERNEL__
 #include 
 
-/*	intr=^C		quit=^\		erase=del	kill=^U
+/*	intr=^C		quit=^\		erase=0		kill=^U
 	eof=^D		vtime=\0	vmin=\1		sxtc=\0
 	start=^Q	stop=^S		susp=^Z		eol=\0
 	reprint=^R	discard=^U	werase=^W	lnext=^V
 	eol2=\0
 */
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
+#define INIT_C_CC "\003\034\0\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
 
 /*
  * Translate a "termio" structure into a "termios". Ugh.

This little hack tweaks n_tty.c so that if ERASE_CHAR(tty) == 0, ^H AND ^? become erase characters and everything will work happily up until the point where the shell runs your .profile and tsets ERASE_CHAR() to the wrong thing. Which is not a problem if you're kept away from the icky shell.

3 comments

Dec 12, 2007

A day that will live in infamy

12-dec-2000

1 comment


New Code! (half a bee is better than none edition)

pstree has finally slowed down enough so I can nail it down and go on to the next shiny bauble on my list. Version 0.5 cleans up a few of the dangling bugs in 0.3 (the notable one was the erratic garbage appearing at the end of clipped lines), adds one new feature (-A, which prints the full pathname for each command in the heirarchy), modifies -a to take the command name from the argument list instead of using the actual command name [so if the program changes argv[0] to "OOchy mcbaba!", that's the name that pstree -a will display] and does a few more fussy tweaks to the code just because it's there.

When pstree 0.5 installs, it will attempt to put the setuid bit on if it's using kvm_getprocs(3) or sysctl(3) to pick out process information (kvm_getprocs() needs to be root to even get the process list, sysctl() needs to be root to KVM_PROCARGS2 processes that belong to other people. There may be security holes here -- I don't actually write anything back into system space and I try to pay attention to what I'm writing to, but 4 days of evening hacking to decompress from my job isn't really conducive to putting the Q back into uality. But it's still New Code!, and where would that be without one or two magic cookies hidden away for the security auditors?)

Dec 10, 2007

New Code! (third release’s the charm)

After spending a couple of days figuring out the woefully undocumented macos KVM_PROCARGS2 sysctl, I'm releasing pstree 0.3, which now supports the -a option on macos 10.0.4, and which, as a special bonus, also supports line clipping when you don't supply the -l argument.

This one almost works on R*dh*t Linux, too (it works, but clipping doesn't work properly yet.) I've got three machines at home that do run modern versions of Linux (three little ARM boxes; two of them are my routers so aren't likely to be upgraded to an as-yet-vapo(u)rware RTKBA Mastodon, but the third is a Technologic Systems TS7800 which may be clipped onto the top of Dust Mite's new ride, so it's likely to have the embedded Debian ripped right out of it and replaced with a somewhat slimmer Linux distribution, which will need this version of pstree to help sate the knights who say NIH!)

Oh, and the guts of ptree() are kind of gross where they wrap around the KVM_PROCARGS2 sysctl. The leading zero on the version number is the mark of that kind of quality, and you can get it too, if you want New Code! for your machine.

Dec 09, 2007

Lovely

In September 2002, four members of Congress met in secret for a first look at a unique CIA program designed to wring vital information from reticent terrorism suspects in U.S. custody. For more than an hour, the bipartisan group, which included current House Speaker Nancy Pelosi (D-Calif.), was given a virtual tour of the CIA's overseas detention sites and the harsh techniques interrogators had devised to try to make their prisoners talk.

Among the techniques described, said two officials present, was waterboarding, a practice that years later would be condemned as torture by Democrats and some Republicans on Capitol Hill. But on that day, no objections were raised. Instead, at least two lawmakers in the room asked the CIA to push harder, two U.S. officials said.

"The briefer was specifically asked if the methods were tough enough," said a U.S. official who witnessed the exchange.

(damning accusation via The Washington Post)

You would think that members an opposition party that was already being painted as the spawn of Satan would have the good sense to violently disapprove of torture when Maximum Leader Genius's inquisitors chirpily announced that this is what they were doing, but, no, this is the Stupid Party we're talking about and if there's anything it's good at doing it's good at buying into the National Socialist equivalent of a Wile E Coyote roadrunner catching plan, then whining that they didn't know that war crimes were war crimes because

Congressional officials say the groups' ability to challenge the practices was hampered by strict rules of secrecy that prohibited them from being able to take notes or consult legal experts or members of their own staffs.

Since, as you know, it's too hard for a member of the Stupid Party congressional caucus to do any research on their own, and that would take away from the atmosphere of bipartisan comity that they were (and are) trying to maintain with people that would be happy to see them dead.

Congratulations, Democrats, you're making my plan to vote a straight SPUSA ticket in perpetuity seem like a better idea every time I read the newspaper. Is there any way (other than the self-pitying tone of your "we're sooooo helpless with our Senate and Congressional majorities!" whining) that you're different from the Republicans?

(WaPo article via correntewire)

Dec 08, 2007

More PolarHoliday Express



New Code!

When I reinvented the pstree wheel yesterday it didn't work on MacOS 10. Since I'm using MacOS for half of my coding these days, this would not do.

So I fixed it:

orc@poison(ps-etc)> ./pstree
launchd-+-ATSServer
        |-2*[automount]
        |-bfobserver
        |-configd---blued
        |-coreaudiod
        |-coreservicesd
        |-crashreporterd
        |-cupsd
        |-DirectoryService
        |-diskarbitrationd
        |-distnoted
        |-dynamic_pager
        |-ioxdeviced
        |-KernelEventAgent
        |-kextd
        |-loginwindow---pbs
        |-lookupd
        |-2*[mdimport]
        |-mDNSResponder
        |-mds
        |-memberd
        |-netinfod
        |-nfsiod
        |-notifyd
        |-ntpd
        |-rpc.lockd
        |-securityd
        |-syslogd
        |-update
        `-WindowServer-+-AppleSpell
                       |-Dock---4*[DashboardClient]
                       |-Finder
                       |-firefox-bin
                       |-ioxdeviced
                       |-ioxsessiond
                       |-Mail
                       |-Preview
                       |-QuickTime Player
                       |-Safari
                       |-SystemUIServer
                       |-Terminal-+-2*[login---ksh---ssh]
                       |          `-login---ksh---pstree
                       |-TextEdit
                       `-UniversalAccess

pstree 0.2 doesn't add much to what 0.1 had (and if you're on a macos 10 box it takes away the -a option because by the time I got to the point of starting to figure out what KERN_PROGARGS and/or KERN_PROCARGS2 returned (they don't return what the (erroneously documented) KERN_PROC_ARGS is claimed to) I realized that it was almost 2am and it was well past my expiration date.

Aside from MacOS 10 support (now it's superportable™; it builds on Mastodon, FreeBSD 4.4, FreeBSD 4.8, and MacOS 10.0.4 [I fully expect that MacOS 10.0.6 will not support sysctl().]) I did some tweaking to the display format for collapsed groups, but I've started to set up to do subtree sorting so I can better collapse groups on a busy system. But the MacOS support is the big feature that justifies upping the release to 0.2.

It's new, it's code, it's running on 4 boxes now, so what are you waiting for?

Dec 07, 2007

Friday Dust Mite Blogging™

It's the second fruitcake of the season (I use the Moosewood Italian fruitcake recipe, which is wicked good; all the fruitcake recipes I've seen say that fruitcakes get better if you let them age for a little while, but when I make one of these it's lucky if any of it lasts even a week,) but it's still the same old Dust Mite.


Festive colo(u)rs, trainspotter-style

The New New working Eng!, freshly washed
Red and white are nice and traditional.


Red and orange? It's certainly festive, but it's not overly traditional.


Jingle jingle jingle go the Twinkies as they whip by in the night.

The Oregon Rail Heritage Foundation and the EPT are, once again, running the PolarHoliday Express from Oaks Park down to the vicinity of OMSI and back. Today was the first day of operation, so I zipped out of work at the dot of 8 hours worked and bolted down to the north end of the EPT so I could get some pictures of the festivities. The new new working Eng! was standing on the mainline at the north end of the private ROW/Springwater Trail, the GS4 was heading south back to Oaks Park, and the twinkies came zipping by while I was standing at 12th and Clinton waiting for the southbound #70 bus to arrive (it was not an accident that I was waiting there, because I knew that the northbound Coast Starlight was scheduled to arrive at Union Station at 5:05pm. I didn't realize just how dark it would get by 5pm, and this picture (f1.2 @ iso400) suffers by the long exposure it needed to get enough image to actually see the locomotives.)


And in today’s “classic military blunders of the 20th century,” we present …

tickling a superpower, 1941-style
Japanese photo of the blunder in progress (Wikimedia)

The United States might have an overinflated view of its abilities, but it's still a really dumb idea to prod it with a sharp stick.


New Code! (But this one goes to 11! edition)

When I switched my server farm from Linux to FreeBSD (something I may have to revisit now that I've got nothing but FreeBSD machines without X11 at home) I abandoned most of the creeping features I'd been using on the Linux boxes (since most of these machines ran Mastodon, there weren't quite as many creeping features as you can find on the aggressively malignant tumors that make up a commercial Linux release, but there were one or two that made it into my codebase.)

Some of the more useful features had already been ported to the *BSDs, so it was merely a matter of a deathmatch or two in the Ports arena to get them loaded onto my systems, but when I did the last server upgrade (from 105 watts down to 35 watts, baby!) I left Ports off the install list so I could keep the root filesystem down to under half a gigabyte (the first Linux install on Pell fit onto a 40mb disk with room to spare), so I didn't get any of the prerequisites that you need to run or install anything from Linuxland. This meant no pstree, which is apparently wired into my finger memory these days.

About two months ago I made some preliminary pokes at pstree when I was writing my own version of who, but I must have lost interest somewhere around the point where I'd written the function that slurps process information in from /proc, makes it into a tree, then returns it in a tidy little linked list.

I only realized it was still floating around when I started tiding up $HOME on pell today at lunch and ran across a file titled trace. When I looked at it and realized it was the forlorn orphan of a hacking expedition, I decided that this was a good day to finish up the job.

Ta-Dah! It doesn't support some of the fancier options that the standard Linux one does, and I've cheerfully left out -l support and proper support for hierarchies more than 200 processes deep, but it's portable, if by "portable" you mean "compiles on Mastodon, FreeBSD 4.4, and FreeBSD 4.8" (it compiles on MacOS 10.0.4.x, but there isn't actually a /proc on that particular FreeBSD variant, so I'll need to figure out how to grovel through kernel memory to get the proc out before it will actually be useful there. I'd use kvm(3) but the manpage for kvm_getprocs(3) states, ominously, that these function calls "do not belong" there. The combination of Jordan Hubbard and Apple, Inc means that "do not belong" translates to "will vanish without warning as soon as you've gotten used to them," so I'm going to look for a better supported solution.)

But the code (a) works for me, (b) is small, (c) is BSD-licensed, and (d) took less than 4 hours to drag up to version 0.1. So it's New Code! for the bravehearted and suicidally foolhardy.

Dec 06, 2007

Remember

Geneviève Bergeron (b. 1968) • Hélène Colgan (b. 1966) • Nathalie Croteau (b. 1966) • Barbara Daigneault (b. 1967) • Anne-Marie Edward (b. 1968) • Maud Haviernick (b. 1960) • Maryse Laganière (b. 1964) • Maryse Leclair (b. 1966) • Anne-Marie Lemay (b. 1967) • Sonia Pelletier (b. 1961) • Michèle Richard (b. 1968) • Annie St-Arneault (b. 1966) • Annie Turcotte (b. 1969) • Barbara Klucznik-Widajewicz (b. 1958).

(via James Nicoll, who remembered)

Dec 05, 2007

An important part of your C Programming Language verification suite

#define fine #define de #define/**/ /**/*#define*/
#define de #define
#define do de
 
do { begin
do you like (green eggs and ham++)?
do you eat them: in a box?
do you eat them with a fox?0
do } end
 
fine
fine, just fine.
 
                    /*@@@@@@@@@@@@=___
                   /@@@@@@@@@@@@@@@@@@@a
                   @@@@@@@@@@@@@@@@@@@@@
                   |@@@@@@@@@@@@@@@@@@@@
                    @@@@@@@@@@@@@@@@@@@@
                     @=~         ~~@@@/
                                     /
                                     |
                       /@@@@@===__    |
                       @@@@@@@@@@@@==/
                      /@@@@@@@@@@@@@@
                      @@@@@@@@@@@@@@@
                     / ~~~====@@@@@@
                    /           ~~~/
                   |              /
                  /____          |
                 @@@@@@@@=====__/
                @@@@@@@@@@@@@@@@
               /@@@@@@@@@@@@@@@
              /@@@@@@@@@@@@@@@|
          ___/        ~~~~@@*/
   char groo(p,q)int p;int q;{return
((char)          (--q*q+   (p/10)*q+--p))
       ;          }void grem /**/  (){ int x=0
     ;             printf("   ")
     ;/**/   /**/    for(;x<16
    ;                x++)printf
   (                 "%c",groo(x
   ,    8))            ;printf
   (                   "nn")
  ;                  }void cred(a
 )                   int a;{int
                    x=0;printf
 (                  "%c  "
 , /*_____===~*/  groo(a,8))
  ;             for(;x<16
   ;           x++)printf
    (         "%c",(char)
      a*16+ x);printf(
       "n");}main(a
          ,b)int a;
 char **b   ;{int        x=2;
    do(x=0;x<4;x++)exit(0);
  for(grem();x<1<<3+(int)b[0]
[0]%2;)cred            (++x-1);}

It will come as no surprise that modern tentacleware "C" compilers will not compile this lovely example of standards stress-testing, while gcc 2.7.0 compiles this code without more han a slight anguished whimper. Too bad Apple didn't ship 2.7 with Xcode.

(gandalf.c is one of the winners of the 1996 International Obfuscated C Code Contest)

2 comments

Dec 04, 2007

New Code!

Savelogs has, after an interval of only about 5 years, been updated to version 1.4. 1.4 does some fairly substantial changes to the way that logfiles are archived; I've changed to numbered archives instead of dotted archives, and have added code that lets me switch the archived logfiles from dots to revision numbers, putting the revision numbers at the start or at the end of the archive file, and compression of the archived files.

All of these settable things are switched by settings in the savelogs.conf file, as follows:

set dots
Use the old-style o. prefix instead of numbered prefixes.
set suffix
Append the archive versions instead of prefixing. (file.o instead of o.file)
set compression
Compress the archive with gzip or compress (whichever is found first)

None of this is documented in the webpage, alas, because I'm switching version control systems there and I can't currently update pages. But it's still New Code!, even if it is on a very leisurely update schedule.

Dec 02, 2007

(involuntary facial twitch)

A comic that is all too accurate during the middle of winter.

(--via Avram Grumer @ Making Light)

Dec 01, 2007

There’s going to be a lot of wailing and garment-rending in Ottawa this weekend

Canada's treaty with the U.S. on the treatment of refugees is illegal because the U.S. doesn't comply with conventions protecting asylum seekers and sometimes sends people to countries where they may be tortured, a Canadian judge said.

(--Bloomberg)

So, just how will Mini-Me keep saying that Canada is Maximum Leader Genius's bestest buddy and that he'll do anything to ensure that The True North will maintain its position of #1 bootlicker-4-evah when that damned law keeps stepping up to say "uh, uh, no special privileges for rogue states!" and *interfering* with the torture trade?

Why, you'd almost think that Canada still maintained some simple human dignity despite the increasingly blatant machinations of the EP(C).

Perhaps this will be the time to whip out the notwithstanding clause? It doesn't really apply here, but a skillful despot can twist almost any law to suit their own despicable desires and a swift cloud of rhetoric might be able to dazzle the punters for long enough to get away with it.

(via The Galloping Beaver)

—30—


orc@pell.portland.or.us

Archives