Skip to main content

Building pdksh on HP-UX/Itanium

| @renice@hachyderm.io

pdksh 5.2.14 on HP-UX 11.23 Itanium: If you grab the source for pdksh and try to compile it on Itanium HP-UX, it will tend to dump core with SIGBUS. SIGBUS is a signal sent to processes when they access unaligned memory, usually in C unions or structs. pdksh has a union in it that ends up unaligned on Itanium, which is very particular about such things. HP-UX is also fussy.

Go into the source tree and open up "alloc.c" in your favorite editor. Search for "union Cell", which is the union declaration that is causing the trouble. Change the last member "double djunk; /* alignement */" to "long double djunk; /* alignemnt */." On Itanic, long double is 128 bits and double is 64 bits. Pushing the union out to 128 bits makes it align right all the time, even though it does eat up a bit more memory now.

I also have a patch at work that logs all commands run by root to syslog with the username of the owner of the terminal device. It's a fancy way to avoid typing "sudo" in front of everything while still logging every command for auditing purposes. Unfortunately, I probably can't post that patch.