pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/57056: spim and xspim run in an endless loop due to a bug in CPU/scanner.l



>Number:         57056
>Category:       pkg
>Synopsis:       spim and xspim run in an endless loop due to a bug in CPU/scanner.l
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 13 23:55:00 +0000 2022
>Originator:     .:VMS:.
>Release:        9.3 current Thu Oct 13 23:40:26 UTC 2022
>Organization:
hahahah
>Environment:
NetBSD localhost 9.3 NetBSD 9.3 (GENERIC) #0: Thu Aug  4 15:30:37 UTC 2022  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64

>Description:
spim and xspim run an endless loop because a bug related with flex.

It seems to use flex to parse assembly instructions, as it's a mips assembly interpreter, you give it asm code and it executes it.

The bug is at file CPU/scanner.l at line 319

#if (YY_FLEX_MAJOR_VERSION==2 && YY_FLEX_MINOR_VERSION==5 && YY_FLEX_SUBMINOR_VERSION>=33)
  /* flex 2.5.33 flipped the polarity of this flag (sigh) */
  yy_init = 0;                                                                                                     
#else
  yy_init = 1;    


This is the bug

it seems flex versions prior to that one needed that variable to be 1 instead of 0, the thing is the NetBSD flex's version does not match with this #if directive so yy_init is set to 1 when it should be a 0.

in my case I've just typed 'make' to download the source code and removed this stuff and just put 'yy_init = 0;'

this solves the problem and now xspim seems to work and I assume spim will do too.

I have no idea on how to make a patch file so I can't help more than that.

Anyways that's the source of the bug and it's avoided by just setting yy_init to 0.

Note that it's mlelstv who spotted the bug as I would have no idea if not :D so thank him instead, I'm just sending the pr so the mantainer can fix that.


>How-To-Repeat:
install spim and run spim or xspim, it won't work.

>Fix:
set yy_init to 0 or fix that #if directive to match that flex version and possible future ones 


Home | Main Index | Thread Index | Old Index