The Trunk: Monticello-jr.726.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Monticello-jr.726.mcz

commits-2
Nicolas Cellier uploaded a new version of Monticello to project The Trunk:
http://source.squeak.org/trunk/Monticello-jr.726.mcz

==================== Summary ====================

Name: Monticello-jr.726
Author: jr
Time: 28 June 2020, 10:07:19.980052 pm
UUID: e8c6b590-8826-0144-a535-13cfa140b5dd
Ancestors: Monticello-mt.725

Fix wrong traitCompositions in packages loaded from source.st

As of Collections-ul.900, ReadStream>>match: does not alter the Stream position if the search sequence was not found. Failure to find the search sequence is indicated via the return value, but it was not checked in classDefinitionFrom:.

The error could trigger load failures after loading Monticello-jr.720, in which the trait composition became relevant beyond just creating the class.

The error did not surface for .mcz version files that contain a correct snapshot.bin file, which allows to forego the reading of the source.st file.

There are versions out there without the snapshot.bin file. INIFile-jf.3.mcz as served by Squeaksource is such a version at the moment.

=============== Diff against Monticello-mt.725 ===============

Item was changed:
  ----- Method: MCStReader>>classDefinitionFrom: (in category 'converting') -----
  classDefinitionFrom: aPseudoClass
+ | tokens definitionStream hasTraitComposition traitCompositionString lastIndex hasClassTraitComposition classTraitCompositionString typeOfSubclass className |
- | tokens traitCompositionString lastIndex classTraitCompositionString typeOfSubclass className |
  tokens := Scanner new scanTokens: aPseudoClass definition.
+ definitionStream := ReadStream on: aPseudoClass definition.
+ hasTraitComposition := definitionStream match: 'uses:'.
+ traitCompositionString := hasTraitComposition ifTrue: [(definitionStream upToAll: 'instanceVariableNames:') withBlanksTrimmed] ifFalse: ['{}'].
+ definitionStream := ReadStream on: aPseudoClass metaClass definition asString.
+ hasClassTraitComposition := definitionStream match: 'uses:'.
+ classTraitCompositionString := hasClassTraitComposition ifTrue: [(definitionStream upToAll: 'instanceVariableNames:') withBlanksTrimmed] ifFalse: ['{}'].
- traitCompositionString := ((ReadStream on: aPseudoClass definition)
- match: 'uses:';
- upToAll: 'instanceVariableNames:') withBlanksTrimmed.
- classTraitCompositionString := ((ReadStream on: aPseudoClass metaClass definition asString)
- match: 'uses:';
- upToAll: 'instanceVariableNames:') withBlanksTrimmed.
- traitCompositionString isEmpty ifTrue: [traitCompositionString := '{}'].
- classTraitCompositionString isEmpty ifTrue: [classTraitCompositionString := '{}'].
  lastIndex := tokens size.
 
  className := tokens at: 3.
  typeOfSubclass := self typeOfSubclass: (tokens at: 2).
  "Compiled code classes are special cases of the #bytes class type"
  (#bytes == typeOfSubclass and: [self compiledCodeClassNames includes: className])
  ifTrue: [typeOfSubclass := #compiledMethod].
 
  ^ MCClassDefinition
  name: className
  superclassName: (tokens at: 1)
  traitComposition: traitCompositionString
  classTraitComposition: classTraitCompositionString
  category: (tokens at: lastIndex)
  instVarNames: ((tokens at: lastIndex - 6) findTokens: ' ')
  classVarNames: ((tokens at: lastIndex - 4) findTokens: ' ')
  poolDictionaryNames: ((tokens at: lastIndex - 2) findTokens: ' ')
  classInstVarNames: (self classInstVarNamesFor: aPseudoClass)
  type: typeOfSubclass
  comment: (self commentFor: aPseudoClass)
  commentStamp: (self commentStampFor: aPseudoClass)!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Monticello-jr.726.mcz

Levente Uzonyi
Hi Nicolas,

I haven't reviewed this change, but the original bug related to
ReadStream >> #match: has been fixed a while ago.


Levente

On Mon, 12 Apr 2021, [hidden email] wrote:

> Nicolas Cellier uploaded a new version of Monticello to project The Trunk:
> http://source.squeak.org/trunk/Monticello-jr.726.mcz
>
> ==================== Summary ====================
>
> Name: Monticello-jr.726
> Author: jr
> Time: 28 June 2020, 10:07:19.980052 pm
> UUID: e8c6b590-8826-0144-a535-13cfa140b5dd
> Ancestors: Monticello-mt.725
>
> Fix wrong traitCompositions in packages loaded from source.st
>
> As of Collections-ul.900, ReadStream>>match: does not alter the Stream position if the search sequence was not found. Failure to find the search sequence is indicated via the return value, but it was not checked in classDefinitionFrom:.
>
> The error could trigger load failures after loading Monticello-jr.720, in which the trait composition became relevant beyond just creating the class.
>
> The error did not surface for .mcz version files that contain a correct snapshot.bin file, which allows to forego the reading of the source.st file.
>
> There are versions out there without the snapshot.bin file. INIFile-jf.3.mcz as served by Squeaksource is such a version at the moment.
>
> =============== Diff against Monticello-mt.725 ===============
>
> Item was changed:
>  ----- Method: MCStReader>>classDefinitionFrom: (in category 'converting') -----
>  classDefinitionFrom: aPseudoClass
> + | tokens definitionStream hasTraitComposition traitCompositionString lastIndex hasClassTraitComposition classTraitCompositionString typeOfSubclass className |
> - | tokens traitCompositionString lastIndex classTraitCompositionString typeOfSubclass className |
>   tokens := Scanner new scanTokens: aPseudoClass definition.
> + definitionStream := ReadStream on: aPseudoClass definition.
> + hasTraitComposition := definitionStream match: 'uses:'.
> + traitCompositionString := hasTraitComposition ifTrue: [(definitionStream upToAll: 'instanceVariableNames:') withBlanksTrimmed] ifFalse: ['{}'].
> + definitionStream := ReadStream on: aPseudoClass metaClass definition asString.
> + hasClassTraitComposition := definitionStream match: 'uses:'.
> + classTraitCompositionString := hasClassTraitComposition ifTrue: [(definitionStream upToAll: 'instanceVariableNames:') withBlanksTrimmed] ifFalse: ['{}'].
> - traitCompositionString := ((ReadStream on: aPseudoClass definition)
> - match: 'uses:';
> - upToAll: 'instanceVariableNames:') withBlanksTrimmed.
> - classTraitCompositionString := ((ReadStream on: aPseudoClass metaClass definition asString)
> - match: 'uses:';
> - upToAll: 'instanceVariableNames:') withBlanksTrimmed.
> - traitCompositionString isEmpty ifTrue: [traitCompositionString := '{}'].
> - classTraitCompositionString isEmpty ifTrue: [classTraitCompositionString := '{}'].
>   lastIndex := tokens size.
>
>   className := tokens at: 3.
>   typeOfSubclass := self typeOfSubclass: (tokens at: 2).
>   "Compiled code classes are special cases of the #bytes class type"
>   (#bytes == typeOfSubclass and: [self compiledCodeClassNames includes: className])
>   ifTrue: [typeOfSubclass := #compiledMethod].
>
>   ^ MCClassDefinition
>   name: className
>   superclassName: (tokens at: 1)
>   traitComposition: traitCompositionString
>   classTraitComposition: classTraitCompositionString
>   category: (tokens at: lastIndex)
>   instVarNames: ((tokens at: lastIndex - 6) findTokens: ' ')
>   classVarNames: ((tokens at: lastIndex - 4) findTokens: ' ')
>   poolDictionaryNames: ((tokens at: lastIndex - 2) findTokens: ' ')
>   classInstVarNames: (self classInstVarNamesFor: aPseudoClass)
>   type: typeOfSubclass
>   comment: (self commentFor: aPseudoClass)
>   commentStamp: (self commentStampFor: aPseudoClass)!

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Monticello-jr.726.mcz

Nicolas Cellier
Hi Levente,
thanks, I think that we can revert this specific change.
There are too many contributions rotting in the inbox, this one was
relatively new, less than a year old ;)

Le mar. 13 avr. 2021 à 00:29, Levente Uzonyi <[hidden email]> a écrit :

>
> Hi Nicolas,
>
> I haven't reviewed this change, but the original bug related to
> ReadStream >> #match: has been fixed a while ago.
>
>
> Levente
>
> On Mon, 12 Apr 2021, [hidden email] wrote:
>
> > Nicolas Cellier uploaded a new version of Monticello to project The Trunk:
> > http://source.squeak.org/trunk/Monticello-jr.726.mcz
> >
> > ==================== Summary ====================
> >
> > Name: Monticello-jr.726
> > Author: jr
> > Time: 28 June 2020, 10:07:19.980052 pm
> > UUID: e8c6b590-8826-0144-a535-13cfa140b5dd
> > Ancestors: Monticello-mt.725
> >
> > Fix wrong traitCompositions in packages loaded from source.st
> >
> > As of Collections-ul.900, ReadStream>>match: does not alter the Stream position if the search sequence was not found. Failure to find the search sequence is indicated via the return value, but it was not checked in classDefinitionFrom:.
> >
> > The error could trigger load failures after loading Monticello-jr.720, in which the trait composition became relevant beyond just creating the class.
> >
> > The error did not surface for .mcz version files that contain a correct snapshot.bin file, which allows to forego the reading of the source.st file.
> >
> > There are versions out there without the snapshot.bin file. INIFile-jf.3.mcz as served by Squeaksource is such a version at the moment.
> >
> > =============== Diff against Monticello-mt.725 ===============
> >
> > Item was changed:
> >  ----- Method: MCStReader>>classDefinitionFrom: (in category 'converting') -----
> >  classDefinitionFrom: aPseudoClass
> > +     | tokens definitionStream hasTraitComposition traitCompositionString lastIndex hasClassTraitComposition classTraitCompositionString typeOfSubclass className |
> > -     | tokens traitCompositionString lastIndex classTraitCompositionString typeOfSubclass className |
> >       tokens := Scanner new scanTokens: aPseudoClass definition.
> > +     definitionStream := ReadStream on: aPseudoClass definition.
> > +     hasTraitComposition := definitionStream match: 'uses:'.
> > +     traitCompositionString := hasTraitComposition ifTrue: [(definitionStream upToAll: 'instanceVariableNames:') withBlanksTrimmed] ifFalse: ['{}'].
> > +     definitionStream := ReadStream on: aPseudoClass metaClass definition asString.
> > +     hasClassTraitComposition := definitionStream match: 'uses:'.
> > +     classTraitCompositionString := hasClassTraitComposition ifTrue: [(definitionStream upToAll: 'instanceVariableNames:') withBlanksTrimmed] ifFalse: ['{}'].
> > -     traitCompositionString := ((ReadStream on: aPseudoClass definition)
> > -             match: 'uses:';
> > -             upToAll: 'instanceVariableNames:') withBlanksTrimmed.
> > -     classTraitCompositionString := ((ReadStream on: aPseudoClass metaClass definition asString)
> > -             match: 'uses:';
> > -             upToAll: 'instanceVariableNames:') withBlanksTrimmed.
> > -     traitCompositionString isEmpty ifTrue: [traitCompositionString := '{}'].
> > -     classTraitCompositionString isEmpty ifTrue: [classTraitCompositionString := '{}'].
> >       lastIndex := tokens size.
> >
> >       className := tokens at: 3.
> >       typeOfSubclass := self typeOfSubclass: (tokens at: 2).
> >       "Compiled code classes are special cases of the #bytes class type"
> >       (#bytes == typeOfSubclass and: [self compiledCodeClassNames includes: className])
> >               ifTrue: [typeOfSubclass := #compiledMethod].
> >
> >       ^ MCClassDefinition
> >               name: className
> >               superclassName: (tokens at: 1)
> >               traitComposition: traitCompositionString
> >               classTraitComposition: classTraitCompositionString
> >               category: (tokens at: lastIndex)
> >               instVarNames: ((tokens at: lastIndex - 6) findTokens: ' ')
> >               classVarNames: ((tokens at: lastIndex - 4) findTokens: ' ')
> >               poolDictionaryNames: ((tokens at: lastIndex - 2) findTokens: ' ')
> >               classInstVarNames: (self classInstVarNamesFor: aPseudoClass)
> >               type: typeOfSubclass
> >               comment: (self commentFor: aPseudoClass)
> >               commentStamp: (self commentStampFor: aPseudoClass)!
>