Dispatches from Andyland "Your reality, sir, is lies and balderdash and I'm delighted to say that I have no grasp of it whatsoever!" — The Adventures of Baron Munchausen

September 20, 2006

Nightmares of computer obsolesce

Filed under: Uncategorized — Andrew @ 1:34 pm

Last night I had a dream that I was being asked to solve a computer-related problem my mother-in-law was having. In the dream, she was running a business accounting package on an old single board PDP-11 (I guess maybe something like a DEC Falcon, if I wanted to think my dream was at all realistic) It was showing signs of failing and we were scrambling to figure out how to get replacement parts to keep it running.

September 19, 2006

When people ask how to do something, be sure they’ve figured out if they should

Filed under: Uncategorized — Andrew @ 12:03 pm

A co-worker just came up to me to ask if I could help with a problem. He had a shell script full of environment variable changes, and he needed them in his perl script. His first attempt system("source /path/to/vendors/env/script.sh"); didn’t work. I did a quick rundown of how child and parent processes work in Unix, and made sure to mention how children can’t change the behavior of the parent. I then explained how the %ENV hash worked, but the problem with that is that he would have to rewrite the logic in the shell script, and for the most part the script is under control of the vendor.

I came up with a solution something like:

open ( SH, ". /path/to/vendors/env/script.sh;env") or warn "Can't execute vars script: $!";
while() {
     my($key,$value)=split(/=/,$_,2);
     $ENV{$key} = $value;
}
close(SH) || warn "Can't get vars from script: $!";

Sometime later he came back with another question. I don’t recall, a syntax error in my penciled out version or something. At that time, I asked if it would be possible to source the environment variable script before launching the perl script. The answer was no, because this perl script was a daemon whose execution was beyond his control. He then let on that he needed the environment variables because the child processes of the daemon spawned off other perl scripts written by the vendor that depended on the environment variables. I then suggested that instead of spawning off the vendors scripts, that he spawn off shell script wrappers that adjusted the environment and then ran the vendors code. (and then drove the point home by asking for the keyboard and typing in an invocation of the wrapper script at the point where he needed it”) Once he saw that, he agreed that was much more what he needed and went of implementing that.

If I left it at solving the solution he wanted, rather than digging further and finding out what he needed, he would have had a really awkward result.

Powered by WordPress