From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 6756 invoked from network); 18 Aug 2021 09:01:58 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 18 Aug 2021 09:01:58 -0000 Received: from mimir.eigenstate.org ([206.124.132.107]) by 1ess; Tue Aug 17 22:49:41 -0400 2021 Received: from abbatoir.myfiosgateway.com (pool-74-108-56-225.nycmny.fios.verizon.net [74.108.56.225]) by mimir.eigenstate.org (OpenSMTPD) with ESMTPSA id 19bdb0dd (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO); Tue, 17 Aug 2021 19:49:21 -0700 (PDT) Message-ID: To: 9front@9front.org CC: nabijaczleweli@nabijaczleweli.xyz Date: Tue, 17 Aug 2021 22:49:19 -0400 From: ori@eigenstate.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: open-source standard replication session storage markup rails Subject: Re: [9front] seq: fix infinite loop Reply-To: 9front@9front.org Precedence: bulk Quoth Sean Hinchee : > наб on twitter, then over e-mail (CC'd) pointed out that seq(1) in > 9front with some very large inputs > > For example: > > ; seq 2e16 20000000000000002 > > would loop forever. > > After patch application, seq with the above example would print > '2e+16' once and then exit. > Another question: does seq even need to do floating point? Can we change it to simply do integers? Surprisingly, it seems like we don't even use seq much in our base system. If I had to guess at how often it was used, I'd have been off by an order of magnitude at least. % cd /rc/bin && g seq `{walk -f .} ./ape/libpng-config:46: --static revise subsequent outputs for static linking ./homespool:9: echo creating seqno file ./homespool:10: touch $home/spool/ctrl/seqno ./homespool:12: chmod 222 $home/spool/ctrl/seqno ./nietzsche:3: n=`{seq 1 638 | fortune /fd/0} ./newt:90: case ,*; seq 1 `{echo $* | sed 's/,//g'} ./newt:91: case *,; seq `{echo $* | sed 's/,//g'} $posts($#posts) ./newt:92: case *,*; seq `{echo $* | sed 's/,/ /g'} ./newt:167: posts=`{seq 1 $#rposts} ./newt:231: r=`{seq $r(1) `{echo $r(1)^+10|bc}} ./newt:233: r=`{seq $r(1) $posts($#posts)} Out of the places that I see 'seq', four are accidentally picked up, and the remainder would not be affected by this. While we're here: % seq -f '%s' 10 seq 4704701: suicide: sys: trap: general protection violation pc=0x20331f I wonder if it'd be worth scanning for unknown format verbs and barfing on them, or whether that's too much complexity.