Summary: | bc(1) runs in endless loop | ||
---|---|---|---|
Product: | Base System | Reporter: | Wolfram Schneider <wosch> |
Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
Status: | Closed FIXED | ||
Severity: | Affects Only Me | CC: | jfc, se |
Priority: | --- | ||
Version: | 15.0-CURRENT | ||
Hardware: | Any | ||
OS: | Any |
Description
Wolfram Schneider
2024-09-18 16:50:25 UTC
I see this on stable/13, stable14 and current, both amd64 and arm. /usr/bin/bc --version bc 7.0.1 (In reply to Wolfram Schneider from comment #1) the previous version is not affected (as on freefall right now) /usr/bin/bc --version bc 6.7.6 There is no obvious change to bc that would be responsible, but commit 8e022d3cdea10ee1039a632f670c27fd93f65625 changed the way yacc-generated programs process input. I was looking in the wrong place for bc when I commented on the change history. Source directory usr.bin/bc is not the one that is installed. (That one also behaves oddly in response to ^D, probably due to the "error QUIT" rule in the grammar not causing it to quit.) Here is what truss says when I type ^D to an older bc, version 5.2.2 or 6.7.6: 28787: ioctl(0,TIOCSETAW,0x75c7d3a5b264) = 0 (0x0) 28787: read(0,"\^D",1) = 1 (0x1) 28787: fstat(1,{ mode=crw--w---- ,inode=96,size=0,blksize=4096 }) = 0 (0x0) 28787: ioctl(1,TIOCGETA,0x4c2f87f0125c) = 0 (0x0) 28787: write(1,"^D",2) = 2 (0x2) 28787: ioctl(0,TIOCSETAW,0x75c7d3a5b238) = 0 (0x0) 28787: write(1,"\n",1) = 1 (0x1) 28787: ioctl(0,TIOCSETAF,0x75c7d3a5b20c) = 0 (0x0) 28787: exit(0x0) All is well despite the odd behavior of a literal ^D being read. If I have 7.0.1 then it does not quit and truss says 37822: ioctl(0,TIOCSETAW,0x88d4efe5b264) = 0 (0x0) 37822: read(0,"\^D",1) = 1 (0x1) 37822: fstat(1,{ mode=crw------- ,inode=45,size=0,blksize=4096 }) = 0 (0x0) 37822: ioctl(1,TIOCGETA,0x7ddad4152e7c) = 0 (0x0) 37822: write(1,"^D",2) = 2 (0x2) 37822: ioctl(0,TIOCSETAW,0x88d4efe5b238) = 0 (0x0) 37822: sigprocmask(SIG_BLOCK,{ SIGWINCH },{ }) = 0 (0x0) 37822: ioctl(0,TIOCGWINSZ,0x7ddad4153100) = 0 (0x0) 37822: sigprocmask(SIG_SETMASK,{ },0x0) = 0 (0x0) 37822: ioctl(0,TIOCGETA,0x88d4efe5b290) = 0 (0x0) 37822: ioctl(0,TIOCSETAW,0x88d4efe5b264) The problem is fixed in bc 7.0.2 |