David T. Lewis uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-dtl.1064.mcz ==================== Summary ==================== Name: System-dtl.1064 Author: dtl Time: 13 May 2019, 7:06:32.400119 pm UUID: 66a39f74-a4b5-41d0-8e02-c0d01632080d Ancestors: System-pre.1063 Use Url rather than deprecated URI in ProjectLauncher>>startUpAfterLogin. This prevents command line startup scripts from failing due to a deprecation warning. Also fix a comment typo. =============== Diff against System-pre.1063 =============== Item was changed: ----- Method: CodeLoader>>allButShebangLine: (in category 'private') ----- allButShebangLine: contentsString + "If contentsString begins with '#!!' then assume that it contains a Unix - "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: ProjectLauncher>>startUpAfterLogin (in category 'running') ----- startUpAfterLogin | scriptName loader isUrl | self setupFlaps. Preferences readDocumentAtStartup ifTrue: [scriptName := Smalltalk documentPath ifNil: ['']. scriptName := scriptName convertFromSystemString. scriptName isEmpty ifFalse: ["figure out if script name is a URL by itself" isUrl := (scriptName asLowercase beginsWith: 'http://') or: [(scriptName asLowercase beginsWith: 'file://') or: [scriptName asLowercase beginsWith: 'ftp://']]. isUrl ifFalse: [| encodedPath pathTokens | "Allow for ../dir/scriptName arguments" pathTokens := scriptName splitBy: FileDirectory slash. pathTokens := pathTokens collect: [:s | s encodeForHTTP]. encodedPath := pathTokens reduce: [:acc :each | acc , FileDirectory slash , each]. + scriptName := (FileDirectory default asUrl newFromRelativeText: encodedPath) asString]]] - scriptName := (FileDirectory default uri resolveRelativeURI: encodedPath) asString]]] ifFalse: [scriptName := '']. scriptName isEmptyOrNil ifTrue: [^ Preferences eToyFriendly ifTrue: [self currentWorld addGlobalFlaps]]. loader := CodeLoader new. loader loadSourceFiles: (Array with: scriptName). (scriptName asLowercase endsWith: '.pr') ifTrue: [self installProjectFrom: loader] ifFalse: [loader installSourceFiles]! |
Hi everyone,
this breaks loading scripts on some platforms as Url>>#newFromRelativeText: is not a replacement for URI>>#resolveRelativeURI:. The old one can deal with absolute URLs, the new one just concatenates the two Urls. Now the question is where to fix this. The relative in the name is misleading so maybe we need another method. Bests, Patrick >David T. Lewis uploaded a new version of System to project The Trunk: >http://source.squeak.org/trunk/System-dtl.1064.mcz > >==================== Summary ==================== > >Name: System-dtl.1064 >Author: dtl >Time: 13 May 2019, 7:06:32.400119 pm >UUID: 66a39f74-a4b5-41d0-8e02-c0d01632080d >Ancestors: System-pre.1063 > >Use Url rather than deprecated URI in ProjectLauncher>>startUpAfterLogin. >This prevents command line startup scripts from failing due to a deprecation warning. >Also fix a comment typo. > >=============== Diff against System-pre.1063 =============== > >Item was changed: > ----- Method: CodeLoader>>allButShebangLine: (in category 'private') ----- > allButShebangLine: contentsString >+ "If contentsString begins with '#!!' then assume that it contains a Unix >- "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: ProjectLauncher>>startUpAfterLogin (in category 'running') ----- > startUpAfterLogin > | scriptName loader isUrl | > self setupFlaps. > Preferences readDocumentAtStartup > ifTrue: [scriptName := Smalltalk documentPath > ifNil: ['']. > scriptName := scriptName convertFromSystemString. > scriptName isEmpty > ifFalse: ["figure out if script name is a URL by itself" > isUrl := (scriptName asLowercase beginsWith: 'http://') > or: [(scriptName asLowercase beginsWith: 'file://') > or: [scriptName asLowercase beginsWith: 'ftp://']]. > isUrl > ifFalse: [| encodedPath pathTokens | > "Allow for ../dir/scriptName arguments" > pathTokens := scriptName splitBy: FileDirectory slash. > pathTokens := pathTokens > collect: [:s | s encodeForHTTP]. > encodedPath := pathTokens > reduce: [:acc :each | acc , FileDirectory slash , each]. >+ scriptName := (FileDirectory default asUrl newFromRelativeText: encodedPath) asString]]] >- scriptName := (FileDirectory default uri resolveRelativeURI: encodedPath) asString]]] > ifFalse: [scriptName := '']. > scriptName isEmptyOrNil > ifTrue: [^ Preferences eToyFriendly > ifTrue: [self currentWorld addGlobalFlaps]]. > loader := CodeLoader new. > loader > loadSourceFiles: (Array with: scriptName). > (scriptName asLowercase endsWith: '.pr') > ifTrue: [self installProjectFrom: loader] > ifFalse: [loader installSourceFiles]! > > |
In reply to this post by commits-2
Yes we probably do need another method in that case. And maybe some
unit tests to document it. Should I revert the change, or is it ok to leave it in trunk for the time being? It if is causing problems (e.g. for students or for people doing presentations) then I would want to revert. Dave On Tue, May 14, 2019 at 12:27:25PM +0200, [hidden email] wrote: > Hi everyone, > > this breaks loading scripts on some platforms as Url>>#newFromRelativeText: is not a replacement for URI>>#resolveRelativeURI:. The old one can deal with absolute URLs, the new one just concatenates the two Urls. Now the question is where to fix this. The relative in the name is misleading so maybe we need another method. > > Bests, > Patrick > > >David T. Lewis uploaded a new version of System to project The Trunk: > >http://source.squeak.org/trunk/System-dtl.1064.mcz > > > >==================== Summary ==================== > > > >Name: System-dtl.1064 > >Author: dtl > >Time: 13 May 2019, 7:06:32.400119 pm > >UUID: 66a39f74-a4b5-41d0-8e02-c0d01632080d > >Ancestors: System-pre.1063 > > > >Use Url rather than deprecated URI in ProjectLauncher>>startUpAfterLogin. > >This prevents command line startup scripts from failing due to a deprecation warning. > >Also fix a comment typo. > > > >=============== Diff against System-pre.1063 =============== > > > >Item was changed: > > ----- Method: CodeLoader>>allButShebangLine: (in category 'private') ----- > > allButShebangLine: contentsString > >+ "If contentsString begins with '#!!' then assume that it contains a Unix > >- "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: ProjectLauncher>>startUpAfterLogin (in category 'running') ----- > > startUpAfterLogin > > | scriptName loader isUrl | > > self setupFlaps. > > Preferences readDocumentAtStartup > > ifTrue: [scriptName := Smalltalk documentPath > > ifNil: ['']. > > scriptName := scriptName convertFromSystemString. > > scriptName isEmpty > > ifFalse: ["figure out if script name is a URL by itself" > > isUrl := (scriptName asLowercase beginsWith: 'http://') > > or: [(scriptName asLowercase beginsWith: 'file://') > > or: [scriptName asLowercase beginsWith: 'ftp://']]. > > isUrl > > ifFalse: [| encodedPath pathTokens | > > "Allow for ../dir/scriptName arguments" > > pathTokens := scriptName splitBy: FileDirectory slash. > > pathTokens := pathTokens > > collect: [:s | s encodeForHTTP]. > > encodedPath := pathTokens > > reduce: [:acc :each | acc , FileDirectory slash , each]. > >+ scriptName := (FileDirectory default asUrl newFromRelativeText: encodedPath) asString]]] > >- scriptName := (FileDirectory default uri resolveRelativeURI: encodedPath) asString]]] > > ifFalse: [scriptName := '']. > > scriptName isEmptyOrNil > > ifTrue: [^ Preferences eToyFriendly > > ifTrue: [self currentWorld addGlobalFlaps]]. > > loader := CodeLoader new. > > loader > > loadSourceFiles: (Array with: scriptName). > > (scriptName asLowercase endsWith: '.pr') > > ifTrue: [self installProjectFrom: loader] > > ifFalse: [loader installSourceFiles]! > > > > > |
System-fn.1066 [1] partially reverts this change to unblock trunk builds until we come up with a better solution. Cheers, Fabio On Tue, May 14, 2019 at 1:45 PM David T. Lewis <[hidden email]> wrote: Yes we probably do need another method in that case. And maybe some |
Free forum by Nabble | Edit this page |