From Newsgroup: comp.lang.forth
Nick P <
nick.268@gmail.com> writes:
It came up with the suggestion of opening a terminal in the files
directory and running the multiline:
sudo docker run -it \
-v "$PWD":/usr/src/myapp \
-w /usr/src/myapp \
forthy42/gforth gforth fac1.fs -e bye
which didn't give me any errors but closed Forth immediately. Losing the
'-e bye' from the end kept it open, and I was able to use the colon >definitions in the fac1.fs file at the command line.
Container technologies like Docker try to isolate the stuff inside the container from the outside, in order to protect the outside from
whatever may go wild inside the container. But these days it is
questionable how well that promise holds up for technologies like
Docker that rely on the OS kernel being secure; VMs make the same
promise, with a higher overhead, and I have read suggestions that
their promise has a better chance of holding up.
You probably do not want this kind of isolation when running Gforth,
but if you use Docker, you get it and have to tell it where to drop
the isolation.
Reading through the man page of docker, the -v option means that your
working directory ($PWD) becomes visible as /usr/src/myapp inside the
container with read and write permissions, and the -w option means
that /usr/src/myapp becomes the working directory inside the
container. So with this command line, you can let gforth access files
in your working directory, but not elsewhere. You may need a changed
-v option or additional -v options if you want to make more
directories visible to Gforth, and adjust -w accordingly.
So I seem to be able to run an arbitrary file now, but having pre-read >through "Starting Forth" and "Forth Programmers Handbook" before setting
out on learning Forth properly, it's clear that may not suffice.
My guess is that these options may be enough for working through these
books.
So am I correct in thinking it's a Docker issue and I should try to >understand that?
If you want to do more things with Gforth, like letting Gforth scripts
process files in other directories than your working directory, you
probably should look more closely at the docker options.
Alternatives:
1) Use Ubuntu's gforth package. A disadvantage is that this is gforth
0.7.3, and misses some conveniences of the current development
version.
2) Build Gforth from the tarball; see <
https://gforth.org/> for
instructions.
- 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:
https://forth-standard.org/
EuroForth 2026 CFP:
http://www.euroforth.org/ef26/cfp.html
--- Synchronet 3.22a-Linux NewsLink 1.2