[squeak-dev] Running Squeak fro ma unix shell script file with #! squeak...

Chris Cunnington brasspen at gmail.com
Mon May 6 00:40:35 UTC 2019

Back in the day Avi would attach a file.st <http://file.st/> script to a loading image. That’s where the Smalltalk would go. 
And if you need more arguments, the man page makes it clear you can add them after the file name. 
(SmalltalkImage getSystemAttribute: is very useful). 
You’d use a Bash script to start it. Like this: 

	/usr/local/lib/squeak/3.10-4/squeak -vm-display-null -vm-sound-null $image file.st& 

So, you’d use two files: one to start an image; and, one with your Smalltalk code. I’d be very surprised if this didn’t still work. 
Lukas used to load blank images into his Jenkins/Hudson server the same way. He’d have a different file.st <http://file.st/> for different applications loading into a generic image. 
Unless you have some actual need to put everything in one file, then I’d suggest you use this tried and true way. You can choose where you want the output to end up. 
You’re trying to do something I’ve never seen work. 

Steel Panther - The Burden Of Being Wonderful

> On May 5, 2019, at 8:22 PM, tim Rowledge <tim at rowledge.org> wrote:
>> On 2019-05-05, at 2:32 PM, David T. Lewis <lewis at mail.msen.com> wrote:
>>> Wait, you've actually got it running squeak and trying to load something? How? It doesn't get as far as Squeak on my Pi.
>> I'm actually having a hard time dredging this out of deep backing store
>> from my grey matter, but a couple of things do still work (just in Squeak,
>> not in the grey matter).
>> Following the tip from Chris Cunnington, I read the squeak man page. That
>> covers the idea of the self-executing script, which should work fine once
>> we fix the deprecation issue and re-teach the script loader to skip over
>> the first line of a script file that begins with '#!'.
> Hmm, well we have some interesting problems here. Like *which* man page does one pay attention to, and does it even faintly reflect reality?
> For example, on a Pi running the Debian derived Raspbian OS, `man squeak` produces something quite different to the version on squeakvm,org, but the version on github/opensmalltalk appears at first glance to be the same and 9 years untouched. The -help info from a recent Cog vm is quite different in its list of options. I also stumbled over some very out of date info on the swiki about running squeak on Debian.
> On my Pi, attempting to run a file like this - 
> --------------------
> #!/usr/bin/squeak --
> | t  f |
> t:= [f := 4784969 fastDoublingFib asString] timeToRun.
> FileStream stdout
> 	nextPutAll: 'fib(4784969) = '; 
> 	nextPutAll: f; 
> 	cr; 
> 	nextPutAll: 'time = '; 
> 	nextPutAll: t asString; 
> 	nextPutAll: ' mS'; 
> 	cr
> --------------------
> Results in
> ++++++++++++++++++++ 
> ./ReallyFastFib.st 
> FileStrenextPutAll: 'fib(4784gFib asString] timeToRun.
> Usage: /usr/lib/squeak/5.0-201610101924/squeak [<option>...] [<imageName> [<argument>...]]
>       /usr/lib/squeak/5.0-201610101924/squeak [<option>...] -- [<argument>...]
> ALSA <option>s:
>  -nomixer              disable mixer (volume) 
> ...{snip lots of hrelp option info}
> +++++++++++++++++++++
> The strangely garbled line of Smalltalk is particularly amusing.
> I have tried various combinations, including naming the image file explicitly, passing things off to another shell script that names the image file and so on. No luck so far. Actually manually running `squeak my.image ReallyFastFib.st` works as one would currently expect, getting to where the code loader barfs over the #!.
> Evidently we have some serious drift that needs sorting out, as well as actual functional problems. And I suppose one should wave a flag and point out that the way squeak is 'supported' in Debian repositories is horrible and years outdated and perhaps worse, appears to carefully mangle the vm code. It's been that way for ages. If anyone has contacts in the appropriate places perhaps we could get it sorted out?
>> The other thing that still works is taking an image file and prepending
>> it with 512 characters of gunk before the actual image, in which the first
>> part of those 512 characters is a shebang line.
> I remember that; I might have even used in the deep past. I'm amazed it would still work.
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Nostalgia:  The good old days multiplied by a bad memory...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190505/8e5cd840/attachment.html>

More information about the Squeak-dev mailing list