[squeak-dev] The Trunk: System-dtl.1062.mcz
David T. Lewis
lewis at mail.msen.com
Mon May 6 22:44:01 UTC 2019
On Sun, May 05, 2019 at 08:01:08PM -0700, John Pfersich via Squeak-dev wrote:
> Is that #! or #!!
It is #! in the code. I think the diffs to the mailing list are probably
made with Smalltalk fileOut chunk format, in which ! is a special character
that needs to be escaped as !!.
> For encrypted mail use jgpfersich at protonmail.com
> Get a free account at ProtonMail.com
> Web: www.objectnets.net and www.objectnets.org
> > On May 5, 2019, at 19:55, commits at source.squeak.org wrote:
> > David T. Lewis uploaded a new version of System to project The Trunk:
> > http://source.squeak.org/trunk/System-dtl.1062.mcz
> > ==================== Summary ====================
> > Name: System-dtl.1062
> > Author: dtl
> > Time: 5 May 2019, 10:54:56.642077 pm
> > UUID: c527ef41-51fb-4e49-b00a-90a9a09a935d
> > Ancestors: System-cmm.1061
> > If CodeLoader is loading a script that begins with a Unix shebang line, then skip over line one of the script. This accomodates the case of an executable Unix shell script that starts a Squeak image, then feeds itself to Squeak as a start script. For example, an executable script file might contain this:
> > #!/usr/local/bin/squeak --
> > Transcript show: 'Hello, world'; cr.
> > =============== Diff against System-cmm.1061 ===============
> > Item was added:
> > + ----- Method: CodeLoader>>allButShebangLine: (in category 'private') -----
> > + allButShebangLine: contentsString
> > + "If tontentsString begins with '#!!' then assume that it contains a Unix
> > + shebang line should be skipped prior to evaluating the contents."
> > +
> > + (contentsString beginsWith: '#!!')
> > + ifTrue: [contentsString lineIndicesDo: [:line :end :endOfLine |
> > + ^ contentsString allButFirst: endOfLine ]]
> > + ifFalse: [^ contentsString]
> > +
> > + " CodeLoader new allButShebangLine:
> > + '#!!/usr/llocal/bin/squeak --
> > + Transcript cr; show: ''Hello world!!''
> > + ' "!
> > Item was changed:
> > ----- Method: CodeLoader>>installSourceFile: (in category 'installing') -----
> > installSourceFile: aStream
> > "Install the previously loaded source file"
> > | contents trusted |
> > aStream ifNil:[^self error:'No content to install'].
> > trusted := SecurityManager default positionToSecureContentsOf: aStream.
> > trusted ifFalse:[(SecurityManager default enterRestrictedMode)
> > ifFalse:[ aStream close.
> > ^ self error:'Insecure content encountered']].
> > + contents := self allButShebangLine: aStream upToEnd unzipped asString.
> > - contents := aStream upToEnd unzipped asString.
> > (aStream respondsTo: #close) ifTrue:[aStream close].
> > ^contents readStream fileIn!
More information about the Squeak-dev