Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

<lilo> Fairlight: udp is the light margarine of tcp/ip transport protocols :) -- Seen on #Linux


devel / comp.lang.forth / Re: Problem with serial.fs in gforth

SubjectAuthor
* Problem with serial.fs in gforthJos Ven
`* Re: Problem with serial.fs in gforthAnton Ertl
 `* Re: Problem with serial.fs in gforthJos Ven
  `* Re: Problem with serial.fs in gforthAnton Ertl
   `- Re: Problem with serial.fs in gforthJos Ven

1
Problem with serial.fs in gforth

<8aecf6a3-907f-43ae-8d20-6de573d51e25n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=14915&group=comp.lang.forth#14915

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:2c4:: with SMTP id a4mr8913340qtx.92.1633872482024;
Sun, 10 Oct 2021 06:28:02 -0700 (PDT)
X-Received: by 2002:ac8:6147:: with SMTP id d7mr8944047qtm.38.1633872481855;
Sun, 10 Oct 2021 06:28:01 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 10 Oct 2021 06:28:01 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=213.10.199.198; posting-account=nkqetwkAAACepkf86cwWAMB6YF6pRh3F
NNTP-Posting-Host: 213.10.199.198
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8aecf6a3-907f-43ae-8d20-6de573d51e25n@googlegroups.com>
Subject: Problem with serial.fs in gforth
From: jos...@planet.nl (Jos Ven)
Injection-Date: Sun, 10 Oct 2021 13:28:02 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 42
 by: Jos Ven - Sun, 10 Oct 2021 13:28 UTC

Under Gforth running on debian 8 on a RPI I ran into the following a
problem for check-read in gforth-0.7.9_20210930/unix/serial.fs

It is defined as:
: check-read ( port -- n ) 0 { w^ io-result }
fileno FIONREAD io-result ioctl ?ior io-result l@ ;

term dbg check-read \ To see the problem
\ term is a value that contains the port I got from open-serial.

Nesting debugger ready!
[ 1 ] 15109056
B681AF28 B67B9630 #0 -> [ 2 ] 15109056 00000
B681AF30 B67BB5C0 >l -> [ 1 ] 15109056
B681AF34 B67BB560 lp- -> [ 1 ] 15109056
B681AF38 B67FEAD8 fileno -> [ 1 ] 00018
B681AF3C B681AD90 FIONREAD -> [ 2 ] 00018 21531
B681AF40 B67BB530 laddr# 4 -> [ 3 ] 00018 21531 3060211700
B681AF48 B6809320 ioctl -> [ 0 ]
B681AF4C B67FF490 ?ior ->
*the terminal*:36:10: error: Stack underflow
term dbg >>>check-read<<<
Backtrace:
/usr/local/share/gforth/0.7.9_20210930/unix/libc.fs:127:8: 0 $B67FF49C =
/usr/local/share/gforth/0.7.9_20210930/unix/serial.fs:137:37: 1 $B681AF50 ?ior
/usr/local/share/gforth/0.7.9_20210930/except.fs:83:2: 2 $B67CD904 execute [catch frame]
/usr/local/share/gforth/0.7.9_20210930/debug.fs:207:28: 3 $B67EDE34 catch
/usr/local/share/gforth/0.7.9_20210930/debug.fs:222:27: 4 $B67EDF50 (debug)

The following also puzzles me a bit:
When I use:
: term-read ( -- addr u ) pad dup 255 term read-file throw ;
then at throw it returns: error: Resource temporarily unavailable

When I change term-read into:
: term-read ( -- addr u ) pad dup 255 term read-file drop ;

then the buffer at pad has been correctly filled.

I hope it can be solved.
Thanks in advance,
Jos

Re: Problem with serial.fs in gforth

<2021Oct10.160627@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=14916&group=comp.lang.forth#14916

  copy link   Newsgroups: comp.lang.forth
Path: rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Problem with serial.fs in gforth
Date: Sun, 10 Oct 2021 14:06:27 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 56
Message-ID: <2021Oct10.160627@mips.complang.tuwien.ac.at>
References: <8aecf6a3-907f-43ae-8d20-6de573d51e25n@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="f06da14bfcd4830f1222b43733ca27aa";
logging-data="11288"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mz0mJ884z9XOjMeJ1haX5"
Cancel-Lock: sha1:gW+j+I4c2KDmT4SshlHf0bTccYc=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sun, 10 Oct 2021 14:06 UTC

Jos Ven <josv@planet.nl> writes:
>
>Under Gforth running on debian 8 on a RPI I ran into the following a
>problem for check-read in gforth-0.7.9_20210930/unix/serial.fs
>
>It is defined as:
>: check-read ( port -- n ) 0 { w^ io-result }
> fileno FIONREAD io-result ioctl ?ior io-result l@ ;
>
>term dbg check-read \ To see the problem
>\ term is a value that contains the port I got from open-serial.
>
>Nesting debugger ready!
>[ 1 ] 15109056
>B681AF28 B67B9630 #0 -> [ 2 ] 15109056 00000
>B681AF30 B67BB5C0 >l -> [ 1 ] 15109056
>B681AF34 B67BB560 lp- -> [ 1 ] 15109056
>B681AF38 B67FEAD8 fileno -> [ 1 ] 00018
>B681AF3C B681AD90 FIONREAD -> [ 2 ] 00018 21531
>B681AF40 B67BB530 laddr# 4 -> [ 3 ] 00018 21531 3060211700
>B681AF48 B6809320 ioctl -> [ 0 ]

This is wrong. ioctl should take 3 cells and return 1. And it does
on my AMD64 system.

Thanks for the bug report, we will investigate it.

>The following also puzzles me a bit:
>When I use:
>: term-read ( -- addr u ) pad dup 255 term read-file throw ;
>then at throw it returns: error: Resource temporarily unavailable
>
>When I change term-read into:
>: term-read ( -- addr u ) pad dup 255 term read-file drop ;
>
>then the buffer at pad has been correctly filled.

But probably not to 255 characters, right?

READ-FILE returns the ior corresponding to the Unix condition EAGAIN
in this case. Given the widely-used practice of putting THROW after
READ-FILE, it might be better to return ior=0 in that case.

However, looking at the specification of READ-FILE, returning the
actual length and ior=0 indicates that the end of file has been
reached. OTOH, that has been written for reading from a file rather
than from a terminal.

What do people think? Should READ-FILE return ior=0 in this case?

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2021: https://euro.theforth.net/2021

Re: Problem with serial.fs in gforth

<42882940-620c-4ef8-af15-a1707c26e54an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=14918&group=comp.lang.forth#14918

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:518d:: with SMTP id kl13mr17265663qvb.14.1633879350045;
Sun, 10 Oct 2021 08:22:30 -0700 (PDT)
X-Received: by 2002:ac8:19:: with SMTP id a25mr9890366qtg.360.1633879349860;
Sun, 10 Oct 2021 08:22:29 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 10 Oct 2021 08:22:29 -0700 (PDT)
In-Reply-To: <2021Oct10.160627@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=213.10.199.198; posting-account=nkqetwkAAACepkf86cwWAMB6YF6pRh3F
NNTP-Posting-Host: 213.10.199.198
References: <8aecf6a3-907f-43ae-8d20-6de573d51e25n@googlegroups.com> <2021Oct10.160627@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <42882940-620c-4ef8-af15-a1707c26e54an@googlegroups.com>
Subject: Re: Problem with serial.fs in gforth
From: jos...@planet.nl (Jos Ven)
Injection-Date: Sun, 10 Oct 2021 15:22:30 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 63
 by: Jos Ven - Sun, 10 Oct 2021 15:22 UTC

Op zondag 10 oktober 2021 om 16:20:57 UTC+2 schreef Anton Ertl:
> Jos Ven <jo...nl> writes:
> >
> >Under Gforth running on debian 8 on a RPI I ran into the following a
> >problem for check-read in gforth-0.7.9_20210930/unix/serial.fs
> >
> >It is defined as:
> >: check-read ( port -- n ) 0 { w^ io-result }
> > fileno FIONREAD io-result ioctl ?ior io-result l@ ;
> >
> >term dbg check-read \ To see the problem
> >\ term is a value that contains the port I got from open-serial.
> >
> >Nesting debugger ready!
> >[ 1 ] 15109056
> >B681AF28 B67B9630 #0 -> [ 2 ] 15109056 00000
> >B681AF30 B67BB5C0 >l -> [ 1 ] 15109056
> >B681AF34 B67BB560 lp- -> [ 1 ] 15109056
> >B681AF38 B67FEAD8 fileno -> [ 1 ] 00018
> >B681AF3C B681AD90 FIONREAD -> [ 2 ] 00018 21531
> >B681AF40 B67BB530 laddr# 4 -> [ 3 ] 00018 21531 3060211700
> >B681AF48 B6809320 ioctl -> [ 0 ]
> This is wrong. ioctl should take 3 cells and return 1. And it does
> on my AMD64 system.
>
> Thanks for the bug report, we will investigate it.
> >The following also puzzles me a bit:
> >When I use:
> >: term-read ( -- addr u ) pad dup 255 term read-file throw ;
> >then at throw it returns: error: Resource temporarily unavailable
> >
> >When I change term-read into:
> >: term-read ( -- addr u ) pad dup 255 term read-file drop ;
> >
> >then the buffer at pad has been correctly filled.
> But probably not to 255 characters, right?
>
> READ-FILE returns the ior corresponding to the Unix condition EAGAIN
> in this case. Given the widely-used practice of putting THROW after
> READ-FILE, it might be better to return ior=0 in that case.
>
> However, looking at the specification of READ-FILE, returning the
> actual length and ior=0 indicates that the end of file has been
> reached. OTOH, that has been written for reading from a file rather
> than from a terminal.
>
> What do people think? Should READ-FILE return ior=0 in this case?
>
> - anton
> --
> M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
> comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
> New standard: http://www.forth200x.org/forth200x.html
> EuroForth 2021: https://euro.theforth.net/2021

Sorry can't test for 255 characters.
The longest string that the connected
hardware returns is only 33 characters long.

> Should READ-FILE return ior=0 in this case?
That would be logical.

Thanks for the investigation.
Kind regards, Jos

Re: Problem with serial.fs in gforth

<2021Oct10.230940@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=14920&group=comp.lang.forth#14920

  copy link   Newsgroups: comp.lang.forth
Path: rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Problem with serial.fs in gforth
Date: Sun, 10 Oct 2021 21:09:40 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 52
Message-ID: <2021Oct10.230940@mips.complang.tuwien.ac.at>
References: <8aecf6a3-907f-43ae-8d20-6de573d51e25n@googlegroups.com> <2021Oct10.160627@mips.complang.tuwien.ac.at> <42882940-620c-4ef8-af15-a1707c26e54an@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="f06da14bfcd4830f1222b43733ca27aa";
logging-data="3272"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18pBTMStP4kESwMX2TNvH27"
Cancel-Lock: sha1:/ldNd3Yu+MmynQIJEQPcbR/dDgQ=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sun, 10 Oct 2021 21:09 UTC

Jos Ven <josv@planet.nl> writes:
>Op zondag 10 oktober 2021 om 16:20:57 UTC+2 schreef Anton Ertl:
>> Jos Ven <jo...nl> writes:
>> >
>> >Under Gforth running on debian 8 on a RPI I ran into the following a
>> >problem for check-read in gforth-0.7.9_20210930/unix/serial.fs
>> >
>> >It is defined as:
>> >: check-read ( port -- n ) 0 { w^ io-result }
>> > fileno FIONREAD io-result ioctl ?ior io-result l@ ;
>> >
>> >term dbg check-read \ To see the problem
>> >\ term is a value that contains the port I got from open-serial.
>> >
>> >Nesting debugger ready!
>> >[ 1 ] 15109056
>> >B681AF28 B67B9630 #0 -> [ 2 ] 15109056 00000
>> >B681AF30 B67BB5C0 >l -> [ 1 ] 15109056
>> >B681AF34 B67BB560 lp- -> [ 1 ] 15109056
>> >B681AF38 B67FEAD8 fileno -> [ 1 ] 00018
>> >B681AF3C B681AD90 FIONREAD -> [ 2 ] 00018 21531
>> >B681AF40 B67BB530 laddr# 4 -> [ 3 ] 00018 21531 3060211700
>> >B681AF48 B6809320 ioctl -> [ 0 ]
>> This is wrong. ioctl should take 3 cells and return 1. And it does
>> on my AMD64 system.

We cannot reproduce this bug, even on a Raspi.

>Sorry can't test for 255 characters.

No problem.

>> Should READ-FILE return ior=0 in this case?
>That would be logical.

We have now decided to take the other direction, so that one can still
determine whether you are at the end-of-file or just have temporarily
run out of input:

The patch
<http://git.savannah.gnu.org/cgit/gforth.git/commit/?id=bb6f962bda1fc382348fcf575e716ccdbd82c641> adds:

* a constant EAGAIN-THROW#

* and a word THROW-SERIAL ( throw-code -- ) which ignores EAGAIN-THROW#.

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2021: https://euro.theforth.net/2021

Re: Problem with serial.fs in gforth

<176a99f0-cb79-434e-bfe7-d3382fa296d8n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=14923&group=comp.lang.forth#14923

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:209:: with SMTP id b9mr11443202qtx.28.1633907745325;
Sun, 10 Oct 2021 16:15:45 -0700 (PDT)
X-Received: by 2002:a37:4656:: with SMTP id t83mr12191485qka.207.1633907745119;
Sun, 10 Oct 2021 16:15:45 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 10 Oct 2021 16:15:44 -0700 (PDT)
In-Reply-To: <2021Oct10.230940@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=213.10.199.198; posting-account=nkqetwkAAACepkf86cwWAMB6YF6pRh3F
NNTP-Posting-Host: 213.10.199.198
References: <8aecf6a3-907f-43ae-8d20-6de573d51e25n@googlegroups.com>
<2021Oct10.160627@mips.complang.tuwien.ac.at> <42882940-620c-4ef8-af15-a1707c26e54an@googlegroups.com>
<2021Oct10.230940@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <176a99f0-cb79-434e-bfe7-d3382fa296d8n@googlegroups.com>
Subject: Re: Problem with serial.fs in gforth
From: jos...@planet.nl (Jos Ven)
Injection-Date: Sun, 10 Oct 2021 23:15:45 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 49
 by: Jos Ven - Sun, 10 Oct 2021 23:15 UTC

Op zondag 10 oktober 2021 om 23:32:44 UTC+2 schreef Anton Ertl:
> Jos Ven <jo...nl> writes:
> >Op zondag 10 oktober 2021 om 16:20:57 UTC+2 schreef Anton Ertl:
> >> Jos Ven <jo...nl> writes:
> >> >
> >> >Under Gforth running on debian 8 on a RPI I ran into the following a
> >> >problem for check-read in gforth-0.7.9_20210930/unix/serial.fs
> >> >
> >> >It is defined as:
> >> >: check-read ( port -- n ) 0 { w^ io-result }
> >> > fileno FIONREAD io-result ioctl ?ior io-result l@ ;
> >> >
> >> >term dbg check-read \ To see the problem
> >> >\ term is a value that contains the port I got from open-serial.
> >> >
> >> >Nesting debugger ready!
> >> >[ 1 ] 15109056
> >> >B681AF28 B67B9630 #0 -> [ 2 ] 15109056 00000
> >> >B681AF30 B67BB5C0 >l -> [ 1 ] 15109056
> >> >B681AF34 B67BB560 lp- -> [ 1 ] 15109056
> >> >B681AF38 B67FEAD8 fileno -> [ 1 ] 00018
> >> >B681AF3C B681AD90 FIONREAD -> [ 2 ] 00018 21531
> >> >B681AF40 B67BB530 laddr# 4 -> [ 3 ] 00018 21531 3060211700
> >> >B681AF48 B6809320 ioctl -> [ 0 ]
> >> This is wrong. ioctl should take 3 cells and return 1. And it does
> >> on my AMD64 system.
> We cannot reproduce this bug, even on a Raspi.
> >Sorry can't test for 255 characters.
> No problem.
> >> Should READ-FILE return ior=0 in this case?
> >That would be logical.
> We have now decided to take the other direction, so that one can still
> determine whether you are at the end-of-file or just have temporarily
> run out of input:
>
> The patch
> <http://git.savannah.gnu.org/cgit/gforth.git/commit/?id=bb6f962bda1fc382348fcf575e716ccdbd82c641> adds:
>
> * a constant EAGAIN-THROW#
>
> * and a word THROW-SERIAL ( throw-code -- ) which ignores EAGAIN-THROW#.
> - anton
> --
> M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
> comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
> New standard: http://www.forth200x.org/forth200x.html
> EuroForth 2021: https://euro.theforth.net/2021

OK, Thanks for the efforts.
Kind regards, Jos

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor