I just had to reboot my computer after a Lisp program wedged it

I just had to reboot my computer after a Lisp program wedged it

I just had to reboot my computer after a Lisp program wedged it.

Well, I guess that needs a little qualification. The Lisp in question was librep, the librep interpreter was also running my window manager (Sawfish), and the program was (read-line). And the computer wasn't totally wedged (it carried on playing my MP3s) but wouldn't listen to any keyboard input or focus changes, nor even to M-C-F1 or M-C-Backspace, making it rather hard to regain control. So if I had another machine here I could probably have sshed into it, but I haven't, so there.

Still, if one of the supposed advantages of Lisp is the ease of interactive experimentation and debugging, (and I think I've said this before), Sawfish is not it.

Context: still flushed from my success in getting 90%-working suspend-to-disk, I thought I'd make the machine's power button activate it instead of having to su root and echo stuff into obscurely named files in /sys. That worked quite well once I'd accounted for my script getting run multiple times on each button press. Then I decided to make the volume buttons work too, and that's where I started playing with sawfish. Maybe it's time to try Eclipse again.

  1. !/bin/sh
  2. /etc/acpi/powerbtn.sh
  3. Initiates suspend-to-disk when the power putton has been
  4. pressed. Note use of background process and locking: button
  5. seems to send two events (up and down?) each time it's pressed,
  6. and we only get called for the second after the script has returned
  7. from the first. ( if lockfile -r0 /tmp/.acpi-suspend-lock; then echo 'platform' >/sys/power/disk echo 'disk' >/sys/power/state rm /tmp/.acpi-suspend-lock else echo 'Ignoring second suspend attempt' fi ) & exit 0;


Comments?

This blog has no comment-publishing facility: it's all done by hand. Feedback is welcome, though: if you would like to get in touch, email me on comment2010 @ telent . net and I will publish your thoughts (unless you tell me you don't want me to) as an addendum to the article, provided only that in my view they are interesting, amusing, relevant, accurate, or (best) some combination of the four. Relevant links are welcome in support of your argument: spam and untargeted requests for help are not.

telent netowrks

Geeky stuff about what I do. Many include Lisp, Android, Javascript, Linux and matters arising. For my other personality (less tech and more skating/cycling), see coruskate