9front - general discussion about 9front
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: 9front@9front.org
Cc: nabijaczleweli@nabijaczleweli.xyz
Subject: Re: [9front] seq: fix infinite loop
Date: Tue, 17 Aug 2021 22:49:19 -0400	[thread overview]
Message-ID: <AEF141A53A6C5FE0A043FC4DCFB0D525@eigenstate.org> (raw)
In-Reply-To: <CADmmOS-wcgtcQ+=c01NvssHO3=06zbQjU6NzLt_K0eOX4OQe=w@mail.gmail.com>

Quoth Sean Hinchee <henesy.dev@gmail.com>:
> наб 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.



      parent reply	other threads:[~2021-08-18  9:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-15 22:02 Sean Hinchee
2021-08-16 21:45 ` Amavect
2021-08-18 22:53   ` Eckard Brauer
2021-08-16 22:24 ` [9front] " Anthony Martin
2021-08-16 23:38   ` ori
2021-08-17  2:15     ` hiro
2021-08-21  1:30   ` Amavect
2021-08-18  2:49 ` ori [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AEF141A53A6C5FE0A043FC4DCFB0D525@eigenstate.org \
    --to=ori@eigenstate.org \
    --cc=9front@9front.org \
    --cc=nabijaczleweli@nabijaczleweli.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).