Subject: DZ driver syntax error, top(1) long usernames bug (#494) Index: src/sys/pdpuba/dz.c, src/ucb/top/top.c Description: 1) patch 493 introduced a syntax error in the DZ11 driver 2) long usernames cause corruption of the displayed info in top(1) Repeat-By: 1) build a kernel with the DZ drive configured: cc -O -DKERNEL -DKNARF -DUCB_METER -DINET -DUCB_CLIST -I. -I../h -S ../pdpuba/dz.c ../pdpuba/dz.c:377: Expression syntax ../pdpuba/dz.c:377: Statement syntax ../pdpuba/dz.c:379: Expression syntax ../pdpuba/dz.c:379: Statement syntax 2) Run top(1) on a system with usernames longer than 7 characters. The displayed tables will be corrupted. Fix: Thanks to frank@wortner.com for spotting the missing ')' characters in dz.c top(1) change forwarded by bqt@softjar.se Cut where indicated and save to a file (/tmp/494.patch). Then: cd / patch -p0 < /tmp/494.patch cd /usr/src/ucb/top make install make clean If you have a DZ configured in the kernel then you'll now be able to compile the kernel without syntax errors ;) This and previous updates to 2.11BSD are available at the following locations: ftp://ftp.dfupdate.se/pub/pdp11/2.11BSD https://www.tuhs.org/Archive/Distributions/UCB/2.11BSD/Patches/ ftp://ftp.2bsd.com/2.11BSD http://www.2bsd.com/2.11BSD/ ---------------------------cut here-------------------- *** ./usr/src/sys/pdpuba/dz.c.old Tue Aug 12 18:39:14 2025 --- ./usr/src/sys/pdpuba/dz.c Wed Aug 13 06:07:16 2025 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)dz.c 1.6 (2.11BSD) 2025/8/11 */ /* --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)dz.c 1.7 (2.11BSD) 2025/8/13 */ /* *************** *** 373,381 **** return; } lpr = (dz_speeds[tp->t_ispeed]<<8) | (unit & 07); ! if ((tp->t_flags & (EVENP|ODDP) == ODDP) lpr |= PENABLE|OPAR; ! else if ((tp->t_flags & (EVENP|ODDP) == EVENP) lpr |= PENABLE; if ((tp->t_flags & (RAW|LITOUT|PASS8)) || !(lpr & PENABLE)) lpr |= BITS8; --- 373,381 ---- return; } lpr = (dz_speeds[tp->t_ispeed]<<8) | (unit & 07); ! if ((tp->t_flags & (EVENP|ODDP)) == ODDP) lpr |= PENABLE|OPAR; ! else if ((tp->t_flags & (EVENP|ODDP)) == EVENP) lpr |= PENABLE; if ((tp->t_flags & (RAW|LITOUT|PASS8)) || !(lpr & PENABLE)) lpr |= BITS8; *** ./usr/src/ucb/top/top.c.old Fri Mar 28 20:15:08 2025 --- ./usr/src/ucb/top/top.c Wed Aug 13 06:13:49 2025 *************** *** 26,31 **** --- 26,32 ---- * 07 26/8/2022 Truncate hostname by first period or 7 char. bqt * 08 20/9/2024 Change /vmunix to /unix sms * 09 28/3/2025 Exit gracefully when out of memory martin + * 10 06/5/2025 Handle long user names gracefully hbe */ /* * Using RAW removes the need for signal processing, but adds a requirement *************** *** 392,397 **** --- 393,402 ---- return(-1); untab[idx].uid = uid; strcpy(untab[idx].uname, pw->pw_name); + if(strlen(untab[idx].uname) > 8) { + untab[idx].uname[7] = '+'; + untab[idx].uname[8] = 0; + } return(1); } *************** *** 885,894 **** { printw("%5d ", p->p_pid); if(a->o_uname != NULL) ! printw("%-7s", a->o_uname); else ! printw("%7d", p->p_uid); ! printw("%5d", p->p_pri); printw("%4d", p->p_nice); printw("%5.1fK", (ctob(a->o_tsize))/1024.0); printw("%5.1fK", (ctob(p->p_dsize))/1024.0); --- 890,899 ---- { printw("%5d ", p->p_pid); if(a->o_uname != NULL) ! printw("%-8s", a->o_uname); else ! printw("%8d", p->p_uid); ! printw("%4d", p->p_pri); printw("%4d", p->p_nice); printw("%5.1fK", (ctob(a->o_tsize))/1024.0); printw("%5.1fK", (ctob(p->p_dsize))/1024.0); *** ./VERSION.old Tue Aug 12 16:34:26 2025 --- ./VERSION Wed Aug 13 06:18:06 2025 *************** *** 1,5 **** ! Current Patch Level: 492 ! Date: August 12, 2025 2.11 BSD ============ --- 1,5 ---- ! Current Patch Level: 494 ! Date: August 13, 2025 2.11 BSD ============