computers

You are currently browsing the archive for the computers category.

The other day I wanted to know when I had done something in my shell history, I asked on irc, and dre^ answered -> fc -d for zsh

Now I find myself looking at fc -l -d even when I don’t really need timestamps :-)

% fc -l -d
[snip]
  356  14:56  vim sem.c
  357  18:09  gmake
  358  18:10  vim buffer.c

It is possible to get similar behavior with bash:

$ HISTTIMEFORMAT="%T " history 3
 1386  09:36:54 grep -rl afio .
 1387  09:37:55 vim ChangeLog
 1388  12:56:57 HISTTIMEFORMAT="%T " history 3

Where HISTTIMEFORMAT uses an strftime string.

Yet another useless bit of knowledge!

I released libtool 2.2.6b today. Yes, I have already taken flak for the stupid version numbering. I apologize.

The release has only 2 real patches from 2.2.6, both for libltdl. See the announcement for slightly more detail.

Some users may be stuck using an older libltdl for whatever reason, for those users the same changes are provided by this untested patch.

[Update 2009-11-21]
The change to libltdl to not search in the current working directory for modules when lt_dlopen() is called without an absolute path breaks at least mpg123. This patch should work around the problem until the mpg123 folks fix it.

[Update 2009-12-02]
This release was to fix the now published CVE-2009-3736. If you have not already updated, doing so soon is advisable.

Yesterday tjcarter was complaining in #fink about offlineimap not working on Snow Leopard, so last night I thought I’d take a look.

Indeed, it doesn’t work, and the reason is that ‘import locale’ is being called on a thread, which loads _locale.so, which requires that the CoreFoundation framework also be loaded. A simple reproducer in python is:

import os, sys
import threading
class Foo(threading.Thread):
	def __init__(self):
		threading.Thread.__init__(self)
	def run(self):
		import locale

t = Foo()
t.start()

The CoreFoundation framework must be loaded on the “main” thread, its initialization expects that, if it is loaded on some other thread, then it causes the application to exit rather abruptly. You can reproduce the same thing easily in C with:

#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

void* do_open(void* unused) {
        void * handle = dlopen("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", RTLD_GLOBAL);
        if (! handle) fprintf(stderr,"ERROR: %s\n",dlerror());
        pthread_exit(NULL);
}

int main() {
        pthread_t t;
        pthread_attr_t a;
        if (pthread_attr_init(&a)) exit(1);
        if (pthread_create(&t,&a,do_open,NULL)) exit(2);
        pthread_attr_destroy(&a);
        sleep(5);
        return 0;
}

The failure can be avoided/worked around by ensuring that CoreFoundation is loaded on the main thread. For offlineimap, a simple way to do this is to put ‘import locale’ in the main script before init.startup is run. This will load _locale.so and thus CoreFoundation. CoreFoundation will run its initializers, and all will be well.

I am pretty sure that I have seen it documented somewhere that Apple’s frameworks must be loaded on the main thread, but I don’t seem to be able to find that documentation this morning (perhaps I just need more coffee?). In any case, loading any libraries that you need at application startup before you go spinning off threads is, in my opinion, a reasonable solution.

I released odcctools today, no changes for the last month or so, so I thought I had better put something out there.

http://svn.macosforge.org/repository/odcctools/release/odcctools-20090808.tar.bz2

Cover of the book Mac for Linux GeeksI was the Technical Reviewer for the book Mac for Linux Geeks, from Apress, Inc. by Tony Steidler-Dennison. It was my first time to be a Technical Reviewer, it was interesting, but not something I plan on repeating, it simply took up too much time, with not enough pay. Getting paid by the page is not a good thing.

This is not a book review, I don’t think that I would be a good reviewer, being biased, as I am. Please find reviews elsewhere – although a quick look at amazon shows none there yet, unfortunately.

[EDIT June 22nd 2009] Found a review here http://hants.lug.org.uk/cgi-bin/wiki.pl?BookReviews/MacForLinuxGeeks. It’s the only one I could find.

I got a commit bit for the gcc subversion repository yesterday, and exercised it for the first time today with this commit. Even though the number of patches that we have for gcc is very small, doing the commit beats heck out of begging on the mailing list for someone to commit for us :-)

Only a little late – it has been promised to arrive in the next couple of weeks for 4 years now, Gary released libtool-2.2 today. Thanks Gary!

« Older entries