Hi all. So I finally got bored of ps not displaying command args when "-e" is present. Yes, ps(1) is broken: compare end of lines in output of "ps -ww" and "ps -eww". And IIRC it behaves this way long enough, but I always thought that it's me not missing something in ps(1) manual. Bad zhuk@.
This is not a ps(1) bug, though: the simple diff below "fixes" it. Yep, calling kvm_getargv(3) before kvm_getenv(3) makes everyone happy again. I've tried to dive into libkvm but went out of oxygen. The only problem I found was misuse of reallocarray(), to be addressed in another letter. So, does any libkvm hacker have any clues where to look for this argv-envp bug? I'm not sure that I'll find the root issue myself fast enough (in less than half a year). -- WBR, Vadim Zhukov Index: print.c ======================================================= RCS file: /cvs/src/bin/ps/print.c,v retrieving revision 1.69 diff -u -p -r1.69 print.c --- print.c 8 Sep 2016 15:11:29 -0000 1.69 +++ print.c 1 May 2018 18:29:52 -0000 @@ -118,6 +118,7 @@ command(const struct kinfo_proc *kp, VAR left = INT_MAX; if (needenv && kd != NULL) { + argv = kvm_getargv(kd, kp, termwidth); argv = kvm_getenvv(kd, kp, termwidth); if ((p = argv) != NULL) { while (*p) {