10.5.[01] broke ptys

Hey, I think I found a kernel bug. It's preventing the "Phosphor" screen saver (and others) from working properly on 10.5. As far as I can tell, if you have a pipe, and the process on the other end exits, the pipe flushes: all bytes that have been written to the pipe from the child but not yet read by the parent vanish. I reported it to Apple (5606018); no response yet.

<LJ-CUT text=" --More--(33%) ">


/* gcc test.c -lutil */

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <util.h>

static int
do_fork(void)
{
int fd = -1;
pid_t pid;

if ((pid = forkpty(&fd, NULL, NULL, NULL)) < 0)
perror("forkpty");
else if (!pid)
{
printf ("0123456789\n");

/* #### Uncommenting this makes it work! */
/* sleep(20); */

exit (0);
}

return fd;
}


int
main (int argc, char **argv)
{
char s[1024];
int n;
int fd = do_fork();

/* On 10.4, this prints the whole 10 character line, 1 char per second.
On 10.5, it prints 1 character and stops.
*/
do {
n = read (fd, s, 1);
if (n > 0) fprintf (stderr, "%c", *s);
sleep (1);
} while (n > 0);

return 0;
}


Update, 2 Sep 2009: Still broken in exactly the same way in 10.6.
(And also 10.7.)

Tags: , ,

PSA: de-lameify your dock and menubar

Make your Dock be flush against the corner of the desktop, instead of centered vertically or horizontally. This means your icons will stay put, regardless of how many windows are open:

    defaults write com.apple.dock pinning -string start ;
    killall Dock

Turn off menubar transparency on 10.5:

    sudo defaults write /System/Library/LaunchDaemons/com.apple.WindowServer EnvironmentVariables -dict CI_NO_BACKGROUND_IMAGE 1

and then reboot (logging out isn't enough).

Tags: , , ,
Current Music: Pindoll -- Lost ♬

mini-DVI splitting to DVI plus SVideo

Dear Lazyweb,

Let's say I was thinking about upgrading the second monitor I have attached to my iMac from a CRT (SVGA) to an LCD (DVI). I want that second monitor to run in 1600×1200 or so, and yet be mirrored onto my TV (projector) via an SVideo cable. Right now, I am accomplishing this by having the iMac's mini-DVI going into a mini-DVI-to-SVGA converter, and thence to an AverKey 300 SVGA splitter, which gives me an SVGA pass-through plus a downsampled SVideo output. (As discussed earlier.)

So, there are cables like this which split DVI into DVI-plus-SVGA, but they only work with DVI-I... and as far as I can tell, the only mini-DVI-to-DVI adapters that exist are DVI-D only (suggesting that perhaps Macs don't do analog DVI output at all?)

So, what's the cheapest way to do it?

Tags: , , ,
Current Music: Frostiva -- Pathos ♬

TivoTool

Dear Lazyweb,

TivoTool stopped working on 10.5, and mail to the author bounces. It's looking for this "CamelBones" library that no longer exists. I installed some newer version of it, but that didn't work either. What are my alternatives for getting video off my Tivo without an analog phase? (If you're going to point me at some forum page on tivocommunity or dealdatabase, please try harder: I can never figure out how to download shit from there.)


Update: So, here's one semi-horrible way:

To get the show ID number:
/Library/Application\ Support/TivoTool/vstream-client tivo://hostname/llist

To download that show as an MPEG2 file:
/Library/Application\ Support/TivoTool/vstream-client tivo://hostname/number -o tmp.ty
/Library/Application\ Support/TivoTool/vsplit -m tmp.ty filename unused

Tags: , , , , ,

mixtape 005

Please enjoy jwz mixtape 005.

Questions? Comments? Phrenology?

If you haven't taken the poll I posted with the last one, there's no time like the present.

Tags: ,
Current Music: as noted