I tried your script, running 100 times with jot. I get passes
for small line lengths, and failures above 2*BUFSIZ.
I am building and testing with Ubuntu 24.04 on x86_64 hardware.
Here's a backtrace of one failure:
Incorporating new mail into inbox...
*** bit out of range 0 - FD_SETSIZE on fd_set ***: terminated
Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at
./nptl/pthread_kill.c:44
warning: 44 ./nptl/pthread_kill.c: No such file or directory
(gdb) bt
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)
at ./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=<optimized out>) at
./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at
./nptl/pthread_kill.c:89
#3 0x00007ffff744526e in __GI_raise (sig=sig@entry=6) at
../sysdeps/posix/raise.c:26
#4 0x00007ffff74288ff in __GI_abort () at ./stdlib/abort.c:79
#5 0x00007ffff74297b6 in __libc_message_impl (fmt=fmt@entry=0x7ffff75ce765
"*** %s ***: terminated\n") at ../sysdeps/posix/libc_fatal.c:132
#6 0x00007ffff7536c19 in __GI___fortify_fail (msg=msg@entry=0x7ffff75d3988
"bit out of range 0 - FD_SETSIZE on fd_set") at ./debug/fortify_fail.c:24
#7 0x00007ffff7536715 in __GI___fdelt_chk (d=<optimized out>) at
./debug/fdelt_chk.c:26
#8 0x000055555556aef6 in netsec_fillread (nsc=nsc@entry=0x5555555e2e00,
errstr=errstr@entry=0x7fffffff9d00) at sbr/netsec.c:545
#9 0x000055555556b2bc in netsec_read (nsc=0x5555555e2e00,
buffer=buffer@entry=0x7fffffff9d20 "uvwxyz.. Abcdefghijklmnopqrstuvwxyz..
Abcdefghijklmnopqrstuvwxyz.. Abcdefghijklmnopqrstuvwxyz..
Abcdefghijklmnopqrstuvwxyz.. Abcdefghijklmnopqrstuvwxyz..
Abcdefghijklmnopqrstuvwxyz.. Abcdefghijklmnopq"..., size=size@entry=8192,
errstr=errstr@entry=0x7fffffff9d00) at sbr/netsec.c:395
#10 0x000055555556060e in traverse (action=action@entry=0x55555555cd71
<pop_action>, closure=closure@entry=0x7fffffffbec0,
fmt=fmt@entry=0x55555557b4c1 "RETR %d")
at uip/popsbr.c:592
#11 0x0000555555560e2d in pop_retr (msgno=msgno@entry=1,
action=action@entry=0x55555555cd71 <pop_action>,
closure=closure@entry=0x7fffffffbec0) at uip/popsbr.c:560
#12 0x000055555555db7d in main (argc=<optimized out>, argv=<optimized out>) at
uip/inc.c:576