Since kernel 2.6.? pts numbers are allocated sequncially instead of first free. This way it is easy for pts numbers to go as high as 1000 and up. This makes a short pts names (e.g. "pts/1000") 8 chars long. In syslogin_preform_logout() function of openssh (loginrec.c) a variable of length 8 is allocated to hold ut_line value and thus long pts lines get truncated resulting in "login() returned error result" errors and /var/run/utmp filled with stale records. It appears that in openssh-3.8.1_p1-r1 this bug is fixed. Unfortunately it is marked unstable. Additionally, many users may be still using openssh-3.7.1_p2-r2. The patch that I will attach is one-liner that fixes this issue and applies to both openssh-3.8_p1 and openssh-3.7.1 which both have ebuilds currently marked as stable. As an alternative, any of openssh-3.8.1 could be marked as stable (if it is).
Created attachment 33312 [details, diff] line name buffer size fix This is the patch described earlier. It ports the fix to line size buffer available in 3.8.1p1 to 3.8p1 and 3.7.1p2.
Most arches is marked stable for >=3.8.1.
Now they are, of course.