[squeak-dev] The Trunk: System-dtl.1374.mcz

Eliot Miranda eliot.miranda at gmail.com
Fri Nov 25 19:28:58 UTC 2022


Hi David,

   this seems backwards to me.  It seems to me that one would want to cache
the sources but keep the changes gfile for crash recovery.  Sicne the
changes file should mbe empty at the start of a release this would mean
that all sources were cached.  What am I getting wrong?  And how does your
scheme do crash recovery, if at all?

On Fri, Nov 25, 2022 at 11:00 AM <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.1374.mcz
>
> ==================== Summary ====================
>
> Name: System-dtl.1374
> Author: dtl
> Time: 25 November 2022, 2:00:24.392665 pm
> UUID: f4b3b5ed-db5c-445a-be6b-3f29ea6552e3
> Ancestors: System-dtl.1373
>
> Support use of ChangeLogStream for changes log maintained within the image.
>
> =============== Diff against System-dtl.1373 ===============
>
> Item was changed:
>   ----- Method: SmalltalkImage>>openSourcesAndChanges:forImage: (in
> category 'image, changes names') -----
>   openSourcesAndChanges: changesName forImage: imageName
>         "Open the changes and sources files and install them in
> SourceFiles. Inform the user of problems regarding write permissions or
> CR/CRLF mixups."
>         "Note: SourcesName and imageName are full paths; changesName is a
>         local name."
>         | sources changes msg wmsg |
>         msg := 'Squeak cannot locate {1}.
>
>   Please check that the file is named properly and is in the same
> directory as this image.'.
>         wmsg := 'Squeak cannot write to {1}.
>
>   Please check that you have write permission for this file.
>
>   You won''t be able to save this image correctly until you fix this.'.
>
>         sources := Smalltalk openSources.
>         sources ifNotNil: [sources setConverterForCode].
> +       changes := SourceFileArray cachedChanges
> +               ifNil: [Smalltalk openChanges: changesName forImage:
> imageName].
> -       changes := Smalltalk openChanges: changesName forImage: imageName.
>         changes ifNotNil: [changes setConverterForCode].
> -
>         ((sources == nil or: [sources atEnd])
>                         and: [Preferences valueOfFlag:
> #warnIfNoSourcesFile])
>                 ifTrue: [Smalltalk platformName = 'Mac OS'
>                                 ifTrue: [msg := msg , '
>   Make sure the sources file is not an Alias.'].
>   self inform: (msg format: { 'the sources file named ' , self sourcesName
> })].
>
>         (changes == nil
>                         and: [Preferences valueOfFlag:
> #warnIfNoChangesFile])
>                 ifTrue: [self inform: (msg format: { 'the changes file
> named ' , changesName })].
>
>         ((Preferences valueOfFlag: #warnIfNoChangesFile) and: [changes
> notNil])
>                 ifTrue: [changes isReadOnly
>                                 ifTrue: [self inform: (wmsg format: { 'the
> changes file named ' , changesName })].
>
>                         ((changes next: 200)
>                                         includesSubstring: String crlf)
>                                 ifTrue: [self inform: ('The changes file
> named <b>{1}</b> has been injured by an unpacking utility. Line endings
> were changed from Cr to CrLf.<br><br>Please set the preferences in your
> decompressing program to
>   <b>do not convert text files</b> and unpack the system again.'
> translated format: { changesName }) asTextFromHtml]].
>
>         SourceFiles := Array with: sources with: changes!
>
> Item was changed:
>   ----- Method: SmalltalkImage>>saveAs: (in category 'sources, changes
> log') -----
>   saveAs: newName
>         "Save the image  under that new name."
>         newName ifNil:[^ self].
> +
> +       (SourceFileArray internalizeChanges or: (SourceFiles at: 2) isNil)
> ifFalse:
> -       (SourceFiles at: 2) ifNotNil:
>                 [self closeSourceFiles; "so copying the changes file will
> always work"
>                          saveChangesInFileNamed: (self
> fullNameForChangesNamed: newName)].
>         self saveImageInFileNamed: (self fullNameForImageNamed: newName)!
>
> Item was changed:
>   ----- Method: SmalltalkImage>>saveAsNewVersion (in category 'sources,
> changes log') -----
>   saveAsNewVersion
>         "Save the image/changes using the next available version number."
>         "Smalltalk saveAsNewVersion"
>
>         | newName changesName aName anIndex |
>         aName := FileDirectory baseNameFor: (FileDirectory default
> localNameFor: self imageName).
>         anIndex := aName lastIndexOf: FileDirectory dot asCharacter
> ifAbsent: [nil].
>         (anIndex notNil and: [(aName copyFrom: anIndex + 1 to: aName size)
> isAllDigits])
>                 ifTrue:
>                         [aName := aName copyFrom: 1 to: anIndex - 1].
>
>         newName := FileDirectory default nextNameFor: aName extension:
> FileDirectory imageSuffix.
>         changesName := self fullNameForChangesNamed: newName.
>
> +       (SourceFileArray internalizeChanges or: (SourceFiles at: 2) isNil)
> ifFalse: [
> +               "Check to see if there is a .changes file that would cause
> a problem if we saved a new .image file with the new version number"
> +               (FileDirectory default fileOrDirectoryExists: changesName)
> +                       ifTrue:
> +                               [^ self inform:
> -       "Check to see if there is a .changes file that would cause a
> problem if we saved a new .image file with the new version number"
> -       (FileDirectory default fileOrDirectoryExists: changesName)
> -               ifTrue:
> -                       [^ self inform:
>   'There is already .changes file of the desired name,
>   ', newName, '
>   curiously already present, even though there is
>   no corresponding .image file.   Please remedy
>   manually and then repeat your request.'].
>
> +               self closeSourceFiles; "so copying the changes file will
> always work"
> +                       saveChangesInFileNamed: (self
> fullNameForChangesNamed: newName)
> +       ].
> -       (SourceFiles at: 2) ifNotNil:
> -               [self closeSourceFiles; "so copying the changes file will
> always work"
> -                       saveChangesInFileNamed: (self
> fullNameForChangesNamed: newName)].
>         self saveImageInFileNamed: (self fullNameForImageNamed: newName)
>
>
>   !
>
>
>

-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20221125/bd993463/attachment.html>


More information about the Squeak-dev mailing list