Heater
Posts: 12976
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Sun Jun 16, 2019 11:20 pm

Airr,

I think I found the problem(s)...

1) Ever since I discovered ScriptBasic I have never managed to a get git clone of the sb-dev repo to work

$ git clone https://sandbox.allbasic.info:8181/scriptbasic/sb-dev

Gave me an error about "Permission denied" See here back in May: viewtopic.php?t=238001&start=550#p1469616

Or in recent days complain the repo did not exist! I have mentioned it a few times in recent days.

2) As a result I would select the "cleanup" branch on the repo web page and download the zip file it offered.

That of course is not a git repository so there is no possibility to do a "git pull" etc

3) That zip file does not contain the latest code revisions when you download it, as one might expect.

As a result that sb.sh file did not get copied by mkdist as per your updates today.



Ah, you ask, how come "git pull" reported "up to date" for me?

Well, in my befuddlement over ScriptBasic's tortuous and confusing build/install process I forgot that I was doing all this work inside by own fibo challenge repository. It was reporting that my repo was up to date!

Anyway...

On the off chance, I just tried to git clone the sb-dev repo again.

Blow me down it worked this time!

And sure enough the latest code in the cleanup branch does indeed copy that sb.sh file over.

All is well.

User avatar
John_Spikowski
Posts: 1311
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Sun Jun 16, 2019 11:29 pm

Be aware cleanup and MASTER have been switch. What we have been building from in the past (cleanup repo) is now the MASTER.

The cleanup contains the original ScriptBasic distribution which includes test scripts and ancient garbage.

The extensions repo is modules that aren't generic enough or mainstream or incomplete to be included in the core distribution. GMP2 is a good example of a core contribution.

Airr
Posts: 20
Joined: Sun Jun 16, 2019 5:17 pm

Re: ScriptBasic

Sun Jun 16, 2019 11:44 pm

@Heater:

I've updated the sb.sh script with the one I've been using. My bad, I didn't upload that one.

Please give it a try and let me know if sourcing from anywhere works for you now.

AIR.

Airr
Posts: 20
Joined: Sun Jun 16, 2019 5:17 pm

Re: ScriptBasic

Sun Jun 16, 2019 11:48 pm

ScriptBasic wrote:
Sun Jun 16, 2019 11:29 pm
Be aware cleanup and MASTER have been switch. What we have been building from in the past (cleanup repo) is now the MASTER.

The cleanup contains the original ScriptBasic distribution which includes test scripts and ancient garbage.

The extensions repo is modules that aren't generic enough or mainstream or incomplete to be included in the core distribution. GMP2 is a good example of a core contribution.
Actually, the "cleanup" branch has been merged into "master", so please use the master branch going forward.

cleanup branch was used to get rid of most of the cruft.

AIR.

Heater
Posts: 12976
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Sun Jun 16, 2019 11:52 pm

Airr,

I'm already there.

I read that the cleanup branch is merged to master so I thought I'd try it.

Sure enough it did not work.

Ten minutes later I see in the git log that you have fixed it: "Updated to allow sourcing from anywhere in filesystem"

Heater
Posts: 12976
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Sun Jun 16, 2019 11:58 pm

Airr,

There is still something broken about sb.sh.

If I log out and log back in again I have no scriba on my PATH. Then sb.sh fails with an error.

However if I run it again, sometimes more than once, it eventually works. Like so:

Code: Select all

$ scriba
-bash: scriba: command not found
$ source sb/sb.sh
readlink: invalid option -- 'b'
Try 'readlink --help' for more information.
-bash: scriba: command not found
$ scriba
-bash: scriba: command not found
$ source sb/sb.sh
readlink: invalid option -- 'b'
Try 'readlink --help' for more information.
-bash: scriba: command not found
$ scriba
-bash: scriba: command not found
$ source sb/sb.sh
readlink: invalid option -- 'b'
Try 'readlink --help' for more information.
-bash: scriba: command not found
$ scriba
-bash: scriba: command not found
$ source sb/sb.sh
readlink: invalid option -- 'b'
Try 'readlink --help' for more information.
-bash: scriba: command not found
$ scriba
-bash: scriba: command not found
$ source sb/sb.sh
readlink: invalid option -- 'b'
Try 'readlink --help' for more information.
-bash: scriba: command not found
$ source sb/sb.sh
$ scriba
Usage: basic [options] program.bas
...
Very weird!

User avatar
John_Spikowski
Posts: 1311
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon Jun 17, 2019 12:08 am

You can add the contents of sb.sh to your .bashrc or cd to the directory where sb.sh is and run

source sb.sh

I believe sb.sh is home directory specific.

Airr
Posts: 20
Joined: Sun Jun 16, 2019 5:17 pm

Re: ScriptBasic

Mon Jun 17, 2019 12:15 am

That error IS weird. I'm not seeing that here.

When you source the script, the modifications to the path are only valid for that terminal session. So if you open another terminal session, those modifications won't be in effect. Same thing when you end the original terminal session, either directly or through logging out.

If you want it more or less permanent, then you'll need to source the file from within your .bashrc/.profile file.

AIR.

Heater
Posts: 12976
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 12:18 am

I'm only using one terminal session at a time.

I exit and open a terminal again just to make sure I'm starting from a clean slate.

It is weird.

Always fails on the first run.

Always works on the second run! (Provided I do nothing else in between)

Airr
Posts: 20
Joined: Sun Jun 16, 2019 5:17 pm

Re: ScriptBasic

Mon Jun 17, 2019 12:30 am

I'll try and replicate what you're experiencing, and will get back to you....

AIR.

Airr
Posts: 20
Joined: Sun Jun 16, 2019 5:17 pm

Re: ScriptBasic

Mon Jun 17, 2019 12:38 am

@Heater

Can you edit the sb.sh file, and change the $WORKDIR section to:

Code: Select all

if (( sourced == 0 ));then
    WORKDIR="$(dirname -- "$(readlink -f -- "$0")")"
else
    WORKDIR=$(dirname -- $(readlink -f -- ${BASH_SOURCE[0]}))
fi
Let me know if this clears up the issue, and I'll push a commit with the change. Thanks!

AIR.

Heater
Posts: 12976
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 6:17 am

Airr,

That change got rid of the error message I was seeing on first run of sb.sh. It still does not work the first time though.

Code: Select all

$ scriba
-bash: scriba: command not found
$ source sb/sb.sh
-bash: /home/heater/bin/scriba: No such file or directory
$ scriba
-bash: scriba: command not found
$ source sb/sb.sh
-bash: /home/heater/bin/scriba: No such file or directory
$ scriba
-bash: scriba: command not found
$ source sb/sb.sh
-bash: /home/heater/bin/scriba: No such file or directory
$ source sb/sb.sh
$ scriba
Usage: basic [options] program.bas

options: -o file_name
...
...

Heater
Posts: 12976
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 6:32 am

Airr,

Adding $PATH/ in front of the two calls to scriba in sb.sh fixes it.

Code: Select all

$ scriba
-bash: scriba: command not found
$ source sb/sb.sh
$ scriba
Usage: basic [options] program.bas

options: -o file_name

$ cat sb/sb.sh
#!/bin/bash

# check if script is being run
# or if it's being sourced.
(return 2>/dev/null) && sourced=1 || sourced=0

if (( sourced == 0 ));then
    WORKDIR="$(dirname -- "$(readlink -f -- "$0")")"
else
    WORKDIR=$(dirname -- $(readlink -f -- ${BASH_SOURCE[0]}))
fi

export PATH="${WORKDIR}"/bin:$PATH

TEXT_CONF=$(mktemp)
BINARY_CONF=$(mktemp)
CONFIG="dll \".so\"
module \"${WORKDIR}/module/\"
include \"${WORKDIR}/include/\"
maxstep 0
maxlocalstep 0
maxlevel 29666
maxmem 0
"
echo "$CONFIG" > "${TEXT_CONF}"
$PATH/scriba -f ${BINARY_CONF} -k ${TEXT_CONF} 2>/dev/null
export SCRIBACONF="${BINARY_CONF}"

if (( sourced == 0 )); then
    $PATH/scriba [email protected]
    [[ -e "${TEXT_CONF}" ]] && rm "${TEXT_CONF}"
    [[ -e "${BINARY_CONF}" ]] && rm "${BINARY_CONF}"
fi

Heater
Posts: 12976
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 6:39 am

Airr,

Perhaps not. It still fails if I try to run run scriba before using sb.sh, then use sb.h. Like so:

Code: Select all

$ scriba
-bash: scriba: command not found
$ source sb/sb.sh
-bash: /home/heater/bin:/home/heater/mgc/embedded/codebench/bin:/usr/local/bin:/home/heater/.nvm/versions/node/v12.4.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program: No such file or directory
$ scriba
-bash: scriba: command not found
$ scriba
-bash: scriba: command not found
$ source sb/sb.sh
-bash: /home/heater/bin:/home/heater/bin:/home/heater/mgc/embedded/codebench/bin:/usr/local/bin:/home/heater/.nvm/versions/node/v12.4.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program: No such file or directory
$ scriba
-bash: scriba: command not found
$ scriba
-bash: scriba: command not found
$ source sb/sb.sh
-bash: /home/heater/bin:/home/heater/bin:/home/heater/bin:/home/heater/mgc/embedded/codebench/bin:/usr/local/bin:/home/heater/.nvm/versions/node/v12.4.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program: No such file or directory
$ scriba
-bash: scriba: command not found
$ source sb/sb.sh
-bash: /home/heater/bin:/home/heater/bin:/home/heater/bin:/home/heater/bin:/home/heater/mgc/embedded/codebench/bin:/usr/local/bin:/home/heater/.nvm/versions/node/v12.4.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program: No such file or directory
$ source sb/sb.sh
$ scriba
Usage: basic [options] program.bas

options: -o file_name
...

User avatar
John_Spikowski
Posts: 1311
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon Jun 17, 2019 7:29 am

Until AIR gets back to you, I would put scriba in /usr/bin. You would still need to source sb.sh to establish the module and include paths.

Heater
Posts: 12976
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 7:33 am

I could. But this needs fixing. Having it not work is a reminder to nag about it :)

User avatar
rpdom
Posts: 14768
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: ScriptBasic

Mon Jun 17, 2019 7:56 am

ScriptBasic wrote:
Mon Jun 17, 2019 7:29 am
Until AIR gets back to you, I would put scriba in /usr/bin. You would still need to source sb.sh to establish the module and include paths.
I would put it in /usr/local/bin to keep it separate from standard software installed from .deb files. It will still be in the default PATH, so will run correctly.

Or, if you just want to run it for one user, put it in ~/bin

Heater
Posts: 12976
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 8:38 am

Personally I'd like to have it installed to /opt as per the Linux Standard Base (LSB) and Filesystem Hierarchy Standard (FHS)

Then it can live beside all the other tools I collect in there:

Code: Select all

$ ls /opt/
riscv32i  riscv32ic  riscv32im  riscv32imc  scriba  squeak
$
Yes, I need root privs to make /opt/scriba and make it accessible as a user but that is it. Any install scripts can then run without root proves and install into there.

That keeps everything nicely out of my OS directories.

As far as I can tell that idea has gone a bit out of fashion recently. Only to be replaced with the more bloated ways to do much the same thing like AppImage, Snaps and Docker containers.

User avatar
rpdom
Posts: 14768
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: ScriptBasic

Mon Jun 17, 2019 8:48 am

Heater wrote:
Mon Jun 17, 2019 8:38 am
Personally I'd like to have it installed to /opt as per the Linux Standard Base (LSB) and Filesystem Hierarchy Standard (FHS)

That keeps everything nicely out of my OS directories.

As far as I can tell that idea has gone a bit out of fashion recently. Only to be replaced with the more bloated ways to do much the same thing like AppImage, Snaps and Docker containers.
I don't know about Applmage or Snap, but that isn't the idea of Docker containers. I use them a bit on some of my servers. The idea is that any app running in a container has no access to resources outside the container, unless it is specifically granted. One advantage is that if somehow someone manages to gain root access to, say, a webserver in one container, they are limited what is available in that environment and have no access to the host system or any other containers.

Heater
Posts: 12976
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 10:33 am

Yeah, I know. I have used Docker to distribute my programs to remote Pi via https://www.balena.io/. Back when it was resin.io.

https://www.balena.io/

It worked very well.

hippy
Posts: 5613
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Mon Jun 17, 2019 12:04 pm

Airr wrote:
Sun Jun 16, 2019 11:48 pm
the "cleanup" branch has been merged into "master", so please use the master branch going forward.
Thanks for the update. Building on my Pi from the sb-dev-master.zip seems to have worked using the same process I used to build from the sb-dev-cleanup.zip, with just one issue -

Code: Select all

MODULE sdbg:     dll OK   lib OK   bas FAIL
With the sb-dev-cleanup build that had been -

Code: Select all

MODULE sdbg:     dll OK   lib OK   bas OK
I noticed Heater's non-Pi build has the same "bas FAIL".

I would also suggest updating the documentation at -

https://raspberrybasic.org/forum/index. ... .msg8#msg8

to describe what to do to get the installed ScriptBasic updated to that which was newly built. For me, on a Pi, that needs to be -

Code: Select all

sudo apt remove scriptbasic-2.1-linux-armhf
sudo apt install ./PACKAGES/scriptbasic-2.1-linux-armhf.deb
But, as things have changed, shouldn't the ScriptBasic version or package version have been bumped so the update automatically happens ?

There doesn't seem any way to tell whether what is installed was built from the sb-dev-master or the sb-dev-cleanup branch or came from somewhere else, whether it is the actual latest or isn't.
Last edited by hippy on Mon Jun 17, 2019 12:18 pm, edited 1 time in total.

Heater
Posts: 12976
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 12:15 pm

I would suggest adding documentation to the front page of the script-basic repository. The README.

It need not be long winded. In fact better not. Just a list of prerequisites and the commands required to clone it build it and run it. For Debian at least.

User avatar
RichardRussell
Posts: 572
Joined: Thu Jun 21, 2012 10:48 am

Re: ScriptBasic

Mon Jun 17, 2019 1:00 pm

I know IDEs are not everybody's cup of tea (and an IDE is probably entirely unsuited to a 'scripting' language anyway) but I must say that having an IDE in charge of the 'environment', as in the case of BBC BASIC, seems to avoid a lot of this complication.

Heater
Posts: 12976
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 1:40 pm

That is assuming that getting the IDE installed is problem free.

In my experience of many and varied IDEs that is far from the case.

hippy
Posts: 5613
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Mon Jun 17, 2019 1:47 pm

I think it would be just as problematic with an IDE.

Beyond the ongoing problem of ScriptBasic documentation, information and support being all over the place, with much of what there is outdated and no longer applicable, the main issue is getting ScriptBasic installed, up and running. There is no "sudo apt-get install" route, and currently no traditional "git clone" option for building it from sources. Plus all the "circles of hell" associated with that when it doesn't build as expected.

Once installed it does seem to work and do 'what it says on the can'. And the 'download the .deb, run apt install' path is pretty painless which is what most users would likely be doing.

I actually prefer it not having an IDE as I mostly use my Pi's via Telnet/SSH and at the command line. Though I wouldn't complain if there were an IDE and that would help Desktop users.

The problem I have with ScriptBasic is ScriptBasic; particularly the less than useful, obtuse and even misleading, error messages. If a program fails to work it can be time consuming and difficult to resolve.

Those are mostly usability issues which will afflict users. The developer related issues aren't really any worse than they are with anything else, though developers can never entirely escape those user issues.

But, if one desires to be only a user, but wants to develop extensions, there's no choice but to become a developer to some degree, and then there's no escaping developer related issues which crop up. I have to say though that it's been far less painful for me than trying to build other stuff has been. And, at the proverbial end of the day, it is working. Which is more than can be said for some things I have attempted.

Return to “Other programming languages”