Moving Dictionary.app

sw No Comments »

OS X does a good job of tracking what applications are where and what they do. I have little idea how this works, but if I move VLC.app into a new home then all the files that open in VLC still work. Great. I imagine it involves FSEvents and gobs of XML somewhere.

However the magic doesn’t touch everything. I was so bold as to move Dictionary.app from its default home in /Applications into the Utilities subdirectory. This broke the Ctrl-Cmd-D system-wide (Cocoa-wide?) lookup box. I don’t use it that much but that irked me nonetheless.

Console logs included this:

com.apple.launchd[335] (com.apple.DictionaryPanelAgent[490]): posix_spawn(”/Applications/Dictionary.app/Contents/SharedSupport/DictionaryPanel.app/Contents/MacOS/DictionaryPanel”, …): No such file or directory

Clearly something thinks it knows where the nested DictionaryPanel application should live. This thing is a launchd-managed process used by the keyboard shortcut, configured out of /System/Library/LaunchAgents/com.apple.DictionaryPanelAgent.plist.

The hoojah to tweak this does of course involve XML:


$ launchctl unload /System/Library/LaunchAgents/com.apple.DictionaryPanelAgent.plist

$ plutil -convert xml1 -o - /System/Library/LaunchAgents/com.apple.DictionaryPanelAgent.plist | perl -pe 's|/Applications/Dictionary.app/|/Applications/Utilities/Dictionary.app/|;' > /var/tmp/com.apple.DictionaryPanelAgent.plist

$ plutil -lint /var/tmp/com.apple.DictionaryPanelAgent.plist
/var/tmp/com.apple.DictionaryPanelAgent.plist: OK


$ plutil -convert binary1 /var/tmp/com.apple.DictionaryPanelAgent.plist

$ mkdir /Library/LaunchAgents-orig

$ sudo mv /System/Library/LaunchAgents/com.apple.DictionaryPanelAgent.plist /Library/LaunchAgents-orig && sudo cp /var/tmp/com.apple.DictionaryPanelAgent.plist /System/Library/LaunchAgents/com.apple.DictionaryPanelAgent.plist

$ launchctl load /System/Library/LaunchAgents/com.apple.DictionaryPanelAgent.plist

The last step was intended to make the change work this session, but it didn’t work. The DictionaryPanelAgent still loads but didn’t do anything until logged out and in again. I think this is something to do with launchctl domains / sessiontype. Blunder factor is high.

This violates the “don’t frig with stuff in /System” principle but I don’t know how else to solve it. The modified plist could go in /Library/LaunchAgents of course, but I’d still need to disable the system version (with launchctl unload -w) which is equally naughty. I think.

DIY Avocent / Cyclades DB9/RJ45 serial console adapters

stash No Comments »

These are quite pricey if you buy them pre-made. Depending on how fast you can make them up you can save money.

The self-wire kits I found have the RJ45 connections fixed but let you decide the DB9 pin assigments. The Avocent needs a crossover which means the wiring isn’t one to one. It’s detailed here.

So I don’t lose it again:

Colour RJ45 DB9
Blue 1 8
Orange 2 1&6
Black 3 2
Red 4 5
Green 5 7
Yellow 6 3
Brown & White 7&8 4

DB9 pin 9 is unused. No idea how standard the colour / RJ45 assignment is. The merging of brown and white wires, and the splitting of the orange into two pins is the fudge: admittedly I thought I was building straight-through connectors when I set out!

Assembly

Truncated and borked Thunderbird attachments

stash No Comments »

Fixed thus:

mail.server.default.fetch_by_chunks to false

From here. Unsure if the break is local or on the mailserver, a reasonably normal Courier IMAP deal.

ZFS on FreeBSD

sw No Comments »

… rocks! However, some early VM-related kernel panics - kmem_map too small panic - knocked confidence a bit. Seems ZFS really nails the kernel’s memory demands.

Happily “the vm_kern.c.2 patch” (it’s well known!) sorted things. I stressed ZFS-backed IO massively without any further wobbles.

Now I can micro-quota all my jail(8)s with obsession!

FAM, g++, escalation

sw No Comments »

The full context for this is just too shonky so it’s omitted here. FAM is a file monitoring system from SGI that some Linux distros link their courier-imapd against (the SGI OSS pages for it needs some love, it’s seemingly abandoned). The ‘drop-in’ FAM replacement, gamin, doesn’t provide enough FAMness to fly:

Nov 7 14:03:45 localhost imapd: Failed to connect to socket /tmp/fam--
Nov 7 14:03:45 localhost imapd: Failed to create cache file: maildirwatch (lemon@example.com)
Nov 7 14:03:45 localhost imapd: Error: Input/output error

So we’re left with either rebuilding Courier to not link against it (this is a non-starter, no SRPMs available for this version and I can’t wholesale replace it owing to “control panel” sillyness), or installing FAM itself. For which there are no RPMs, and the source RPMs break owing to a g++ change that occurred ages ago.


/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../include/c++/4.1.1/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the header for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated.
../include/BTree.h:240: error: expected constructor, destructor, or type conversion before ‘BTree’
../include/BTree.h:352: error: expected constructor, destructor, or type conversion before ‘BTree’
../include/BTree.h:408: error: expected constructor, destructor, or type conversion before ‘BTree’
../include/BTree.h:503: error: expected constructor, destructor, or type conversion before ‘BTree’
../include/BTree.h:561: error: expected constructor, destructor, or type conversion before ‘BTree’
../include/BTree.h:591: error: expected constructor, destructor, or type conversion before ‘BTree’
make[2]: *** [Client.lo] Error 1

Struggling to remember C++ resulted in this patch:

--- fam-2.6.10.orig/fam/SmallTable.h    2003-04-15 05:21:43.000000000 +0100
+++ fam-2.6.10/fam/SmallTable.h 2007-11-07 13:50:14.000000000 +0000
@@ -98,7 +98,7 @@
 }

 template <class Tkey, class Tvalue>
-SmallTable<Tkey, Tvalue>::Closure
+typename SmallTable<Tkey, Tvalue>::Closure
 SmallTable<Tkey, Tvalue>::position(const Tkey& key) const
 {
     unsigned l = 0, r = n;
Only in fam-2.6.10/: fam-2.6.10.tar.gz
diff -ur fam-2.6.10.orig/include/BTree.h fam-2.6.10/include/BTree.h
--- fam-2.6.10.orig/include/BTree.h     2003-04-15 05:21:19.000000000 +0100
+++ fam-2.6.10/include/BTree.h  2007-11-07 13:55:15.000000000 +0000
@@ -236,7 +236,7 @@
 //  to the right and returns them.

 template <class Key, class Value>
-BTree<Key, Value>::Closure
+typename BTree<Key, Value>::Closure
 BTree<Key, Value>::Node::remove(unsigned j)
 {
     Key k = key[j];
@@ -348,7 +348,7 @@
 }

 template <class Key, class Value>
-BTree<Key, Value>::Closure
+typename BTree<Key, Value>::Closure
 BTree<Key, Value>::Node::next(const Key& pred) const
 {
     if (!this)
@@ -404,7 +404,7 @@
 //  nodes as necessary on the way back.

 template <class Key, class Value>
-BTree<Key, Value>::Closure
+typename BTree<Key, Value>::Closure
 BTree<Key, Value>::insert(Node *p, const Key& key, const Value& value)
 {
     if (!p) return Closure(key, value, NULL);
@@ -499,7 +499,7 @@
 //  Returns UNDER if node p is too small afterward, OK otherwise.

 template <class Key, class Value>
-BTree<Key, Value>::Status
+typename BTree<Key, Value>::Status
 BTree<Key, Value>::underflow(Node *p, unsigned i)
 {
     assert(p);
@@ -557,7 +557,7 @@

 template <class Key, class Value>
-BTree<Key, Value>::Closure
+typename BTree<Key, Value>::Closure
 BTree<Key, Value>::remove_rightmost(Node *p)
 {
     int i = p->n;
@@ -587,7 +587,7 @@
 //  back up.

 template <class Key, class Value>
-BTree<Key, Value>::Status
+typename BTree<Key, Value>::Status
 BTree<Key, Value>::remove(Node *p, const Key& key)
 {
     if (!p)
diff -ur fam-2.6.10.orig/libfam/Client.c++ fam-2.6.10/libfam/Client.c++
— fam-2.6.10.orig/libfam/Client.c++   2003-04-15 05:21:25.000000000 +0100
+++ fam-2.6.10/libfam/Client.c++        2007-11-07 13:24:28.000000000 +0000
@@ -34,7 +34,7 @@
 #include <syslog.h>
 #include <errno.h>

-#include <iostream.h>
+#include <iostream>

 #include "fam.h"
 #include "Client.h"

Well, that was fun.

No, I’m building JDK *elsewhere*

sw, vague No Comments »

Lousy licensing click throughs:

[root@two /usr/ports-work/distfiles ] 0 # curl –referer http://www.eyesbeyond.com/freebsddom/java/JDK15JRLConfirm.html -v -d”patchset=6″ -d “accept=ACCEPT” -O http://www.eyesbeyond.com/freebsddom/java/download_patchset15_jrl.cgi

FreeBSD, ruby 1.8.2, libpthreads

vague No Comments »

Anecdotally people recommend not using libpthread with Ruby on FreeBSD. I’ve duly always told the port to not use it, but ldd has always shown that it’s linked. autoconf insists on configuring the build with it, despite the --disable-pthread flag.

My long time response to this was *shrug* - Ruby seems fine. Until a weird production problem, unrepeatable on stage, where certain Rails stacks (those running in development mode to expose some aspect of the Globalize plugin to translators) crashed badly, with SIGBUS or SIGILL.

I came across this script:

$ ruby -e 'def d(x); p x; d x+1; end; d 0'

which exposes the problem perfectly. With a pthread‘d Ruby it dumps core, with a no-thread Ruby it gracefully raises stack level too deep (SystemStackError)

More here

Update:

I discussed this on the FreeBSD ports list, discussion here.

Seems like the problem is on its way out.

krb5.conf and KDC protocol

sw No Comments »

FreeBSD lets you do this:

[realms]
FOO.FOOCORP.CO.UK = {
kdc = tcp/kdc.foo.foocorp.co.uk
}

Linux doesn’t let you specify the protocol, and will bork in a typically Kerberosly weird way should you try.

Debian / Ubuntu Exim wedging?

sw No Comments »

Is it doing TLS?

It’s likely running out of entropy. Debian package Exim linked against GNU’s TLS library, rather than the more common OpenSSL. It’ll suck /dev/random dry very quickly.

Lousy under-the-gun hack:
root@shangrila:/dev# rm random && mknod -m 664 /dev/random c 1 9
root@shangrila:/dev# ls -l /dev/*random
crw-rw-r-- 1 root root 1, 9 Aug 7 17:39 /dev/random
crw-rw-rw- 1 root root 1, 9 Aug 7 13:42 /dev/urandom
root@shangrila:/dev#

This is bad for all kinds of reasons… (644 is what the manual says set it to, hmm.). Better ways exist.

Debian jib

mysqldump’s –skip-opt

sw No Comments »

--skip-opt is a useful option to mysqldump - amongst other things it disables the extended INSERT syntax producing an INSERT per table row. That’s good for examing individual rows in the dump.

However, it also disables --create-options. This flag prevents any MySQL-specific schema stuff appearing in the dump. Unfortunately (for me, during a live deploy) is that this includes auto_increment:

$ mysqldump --no-data foo_livedb globalize_translations
-- MySQL dump 10.9
--
-- Host: localhost Database: foo_livedb
-- ------------------------------------------------------
-- Server version 4.1.18-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `globalize_translations`
--

DROP TABLE IF EXISTS `globalize_translations`;
CREATE TABLE `globalize_translations` (
`id` int(11) NOT NULL auto_increment,
`type` varchar(255) default NULL,
`tr_key` varchar(255) default NULL,
`table_name` varchar(255) default NULL,
`item_id` int(11) default NULL,
`facet` varchar(255) default NULL,
`language_id` int(11) default NULL,
`pluralization_index` int(11) default NULL,
`text` text,
PRIMARY KEY (`id`),
KEY `index_globalize_translations_on_tr_key_and_language_id` (`tr_key`,`language_id`),
KEY `globalize_translation_table_item_lang` (`table_name`,`item_id`,`language_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

$ mysqldump --no-data --skip-opt foo_livedb globalize_translations
-- MySQL dump 10.9
--
-- Host: localhost Database: foo_livedb
-- ------------------------------------------------------
-- Server version 4.1.18-log
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `globalize_translations`
--

CREATE TABLE `globalize_translations` (
`id` int(11) NOT NULL,
`type` varchar(255) default NULL,
`tr_key` varchar(255) default NULL,
`table_name` varchar(255) default NULL,
`item_id` int(11) default NULL,
`facet` varchar(255) default NULL,
`language_id` int(11) default NULL,
`pluralization_index` int(11) default NULL,
`text` text,
PRIMARY KEY (`id`),
KEY `index_globalize_translations_on_tr_key_and_language_id` (`tr_key`,`language_id`),
KEY `globalize_translation_table_item_lang` (`table_name`,`item_id`,`language_id`)
);

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in