There was an apparent buffer overrun error in ps_tty_short_name that could easily have accounted for the kind of lossage you saw (though I haven't tried your test programs). I've just checked in a fix (see libps/ChangeLog). Please let me know if that fixes your problem. Or rather, if it doesn't fix your problem, then report your problem anew and use the debian BTS. Thanks, Roland