WEBlog -- Wouter's Eclectic Blog

Fri, 16 Sep 2011

Dear lazyweb,

Is there a syscall to ask the system whether a file is sparse in a particular region? I.e., if I say dd if=/dev/zero of=./foo seek=10 count=10, then I should get a "yes" for the first half of the file, but a "no" for the second half.

Case in point: I need to write a test for the newly-implemented NBD_CMD_TRIM which uses fallocate with the FALLOC_FL_PUNCH_HOLE option to sparsify a file.

kthxbye,

Fri, 04 Mar 2011

Dear lazyweb,

I'm a complete font n00b. How does one install Type1 fonts as part of a Debian package in such a way that:

PMW, which I'm packaging for Debian, includes Type1 postscript fonts that it absolutely cannot live without; and while it's possible to create a .ps file from pmw that includes those fonts, by default it does not, so it's generally useful to put those fonts somewhere that ghostscript can find them. Only I know squat about how ghostscript finds fonts, and just adding a symlink /usr/share/fonts/type1/gsfonts/pmw -> ../../../pmw/psfonts (as was suggested to me on IRC) does not seem to do the trick.

Thanks,

Thu, 20 May 2010

Dear lazyweb,

Can I instruct inkscape somehow that I do not want antialiasing to be used when I ask it to export a bitmap? Reason being that for what I'm trying to do, I need to limit the amount of colors used, and anti-aliasing adds quite a number of values that I don't want to be added.

Thanks,

Mon, 19 Apr 2010

Re: Kerberos and LDAP

Petter Reinholdsen asks about Kerberos and LDAP.

While I'm not sure about an implementation that does just the ACLs in LDAP, there are several implementations that support having the kerberos principals stored in LDAP (i.e., heimdal has supported it for ages, and MIT Kerberos implements it since fairly recently, too). This allows not only for easy replication of the principals to a secondary KDC; it also allows for using LDAP ACLs to decide who gets to create and maintain users.

In addition, there's supposed to be an OpenLDAP overlay that allows for updating the Samba and/or heimdal hashes in an LDAP directory when the OpenLDAP 'change password' extended operation is used, thereby making it somewhat easier to keep passwords in sync.

I should note that I've never tried any of the above, though.

Fri, 04 Dec 2009

Dear lazyweb,

Following my disagreement with sony, I managed to convince my brother that swapping my PS3 for his is a good idea, so now I have a PS3 running Debian, and the fun can start.

Of course the reason why I wanted this machine in the first place was to hack for it, so that's what I'm trying to do now. If only a split-brain processor was something that automake would understand...

How do I make automake understand that it needs to do this?

spu-gcc -o foo-spu foo-spu.c
embedspu foo_spu foo-spu foo-spu.o
gcc -c -o foo-ppu.o foo-ppu.c
gcc -o foo foo-ppu.o foo-spu.o

I tried a Makefile.am like this:

bin_PROGRAMS = foo
foo_SOURCES = foo-ppu.c foo-spu.c
%-spu.obj: %-spu.c
	$(SPUGCC) $(SPUCCFLAGS) -o $@ $^
%-spu.o: %-spu.obj
	embedspu $(subst .,_,$<) $^ $@

... but that doesn't work, since automake inserts a more specific foo-spu.o target that uses $(CC). It only works if I then manually run 'make foo-spu.obj', before running 'make foo'. Obviously we don't want that.

Any help would be greatly appreciated.

Update: understood why some bits didn't work, and clarified here what the real problem was.

Wed, 18 Nov 2009

Dear lazyweb,

Which part of acpid is it that sends XF86Display key events to my X server? It's broken: when I suspend and then resume, it keeps sending those events over and over in an infinite loop; and since the script that I've hooked to that event takes an order of magnitude longer to run than the interval between said events, I'll just say that I find this highly annoying. I'm quite sure it's actually acpid that's sending them out, since the fix for this problem seems to be to call sudo /etc/init.d/acpid restart...

Occasionally, I don't think the ACPI daemon should be sending out these events at all (it seems to do so whenever I open or close my laptop's lid), but that's a different story...

Fri, 18 Sep 2009

Dear lazyweb,

Since a day or two, I've got myself a nice new monitor. It's positively huge, which makes it useful even alone.

There is, however, one little problem. When I call xrandr --output LVDS --right-of VGA, my laptop's display is situated at the top right of the monitor. This is not what I'm after; I'd much rather have it at the bottom right of the monitor, since

Hints as to how one should fix this are more than welcome.

Wed, 18 Mar 2009

Dear lazyweb,

Having used a powerbook as my primary machine for about four years, I'm not very up-to-date on Intel-specific hardware, such as ACPI, these days.

When at conferences or similar, I often see people who've configured their laptops so that acpid would start an alarm when the battery's almost flat. Now that I have an HP laptop again, which does ACPI, I'd like to do the same; but I can't seem to figure out how this is configured.

That is to say, when my laptop's battery is flat, it just switches off. No alarm. Needless to say, this is is rather annoying, and searching through the 56 files in /etc/acpi hasn't resulted in success so far.

Any hints would be greatly appreciated.

Mon, 22 Dec 2008

Shopping for a new laptop

So my current Apple PowerBook is now 4 years old, and starting to show its age. Some parts of it have been replaced (keyboard, hard disk, bottom cover, and battery), and now it's starting to have issues again. It's not breaking down completely just yet, but seen its age, I might as well start looking for something new rather than having it fixed.

I bought this PowerBook because I wanted a laptop that did not have an Intel or AMD processor at its core, which at the time meant either apple or tadpole; since, however, tadpole is only for the rich and famous (seriously—well, perhaps being famous is not a requirement), and apple now also only has intel-based laptops, I guess I'm stuck with intel stuff. Besides, a 1.2Ghz SPARC is slower than my current 1.3Ghz PowerPC.

So, dear lazyweb, I'd appreciate any suggestions about good laptops. What 'good' means, in my eyes, is the following:

I guess the above list is quite long, and realize that my ideal laptop might just not exist; but hey, it never hurts to try, right?

If it does not come preloaded with Windows, that's a plus; but OTOH, wiping a hard disk is not hard.

I should also note that I'm not really interested in the low-price laptops that are available everywhere these days. Those usually have much lower performance, too small a screen, and other cutbacks that make the laptop be less than interesting for me. This is for work, not play.

Tue, 25 Mar 2008

Dear lazyweb,

In an effort to improve the performance of nbd-server, I wrote a patch to make it use some common sendfile() implementations (specifically, Linux- and FreeBSD-style sendfile calls). Unfortunately, however, when I test the Linux version (I haven't done tests with the FreeBSD version yet), the server outputs some garbage in fron of the actual data that it needs to send; as a result, obviously the client can't make heads or tails of it, and the connection is dropped.

However, when I run it inside gdb, everything is fine. When I call strace over the server, I don't see any obvious errors. I tried using the DODBG version of the server (see the code for details), but that didn't help me.

At this point, I'm pretty clueless as to what is going on. If anyone were to give me some hints or pointers, I would be eternally grateful.