<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi David,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">   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?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 25, 2022 at 11:00 AM <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">David T. Lewis uploaded a new version of System to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/System-dtl.1374.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/trunk/System-dtl.1374.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: System-dtl.1374<br>
Author: dtl<br>
Time: 25 November 2022, 2:00:24.392665 pm<br>
UUID: f4b3b5ed-db5c-445a-be6b-3f29ea6552e3<br>
Ancestors: System-dtl.1373<br>
<br>
Support use of ChangeLogStream for changes log maintained within the image.<br>
<br>
=============== Diff against System-dtl.1373 ===============<br>
<br>
Item was changed:<br>
  ----- Method: SmalltalkImage>>openSourcesAndChanges:forImage: (in category 'image, changes names') -----<br>
  openSourcesAndChanges: changesName forImage: imageName <br>
        "Open the changes and sources files and install them in SourceFiles. Inform the user of problems regarding write permissions or CR/CRLF mixups."<br>
        "Note: SourcesName and imageName are full paths; changesName is a  <br>
        local name."<br>
        | sources changes msg wmsg |<br>
        msg := 'Squeak cannot locate {1}.<br>
<br>
  Please check that the file is named properly and is in the same directory as this image.'.<br>
        wmsg := 'Squeak cannot write to {1}.<br>
<br>
  Please check that you have write permission for this file.<br>
<br>
  You won''t be able to save this image correctly until you fix this.'.<br>
<br>
        sources := Smalltalk openSources.<br>
        sources ifNotNil: [sources setConverterForCode].<br>
+       changes := SourceFileArray cachedChanges<br>
+               ifNil: [Smalltalk openChanges: changesName forImage: imageName].<br>
-       changes := Smalltalk openChanges: changesName forImage: imageName.<br>
        changes ifNotNil: [changes setConverterForCode].<br>
- <br>
        ((sources == nil or: [sources atEnd])<br>
                        and: [Preferences valueOfFlag: #warnIfNoSourcesFile])<br>
                ifTrue: [Smalltalk platformName = 'Mac OS'<br>
                                ifTrue: [msg := msg , '<br>
  Make sure the sources file is not an Alias.'].<br>
  self inform: (msg format: { 'the sources file named ' , self sourcesName })].<br>
<br>
        (changes == nil<br>
                        and: [Preferences valueOfFlag: #warnIfNoChangesFile])<br>
                ifTrue: [self inform: (msg format: { 'the changes file named ' , changesName })].<br>
<br>
        ((Preferences valueOfFlag: #warnIfNoChangesFile) and: [changes notNil])<br>
                ifTrue: [changes isReadOnly<br>
                                ifTrue: [self inform: (wmsg format: { 'the changes file named ' , changesName })].<br>
<br>
                        ((changes next: 200)<br>
                                        includesSubstring: String crlf)<br>
                                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 <br>
  <b>do not convert text files</b> and unpack the system again.' translated format: { changesName }) asTextFromHtml]].<br>
<br>
        SourceFiles := Array with: sources with: changes!<br>
<br>
Item was changed:<br>
  ----- Method: SmalltalkImage>>saveAs: (in category 'sources, changes log') -----<br>
  saveAs: newName<br>
        "Save the image  under that new name."<br>
        newName ifNil:[^ self].<br>
+ <br>
+       (SourceFileArray internalizeChanges or: (SourceFiles at: 2) isNil) ifFalse:<br>
-       (SourceFiles at: 2) ifNotNil:<br>
                [self closeSourceFiles; "so copying the changes file will always work"<br>
                         saveChangesInFileNamed: (self fullNameForChangesNamed: newName)].<br>
        self saveImageInFileNamed: (self fullNameForImageNamed: newName)!<br>
<br>
Item was changed:<br>
  ----- Method: SmalltalkImage>>saveAsNewVersion (in category 'sources, changes log') -----<br>
  saveAsNewVersion<br>
        "Save the image/changes using the next available version number."<br>
        "Smalltalk saveAsNewVersion"<br>
<br>
        | newName changesName aName anIndex |<br>
        aName := FileDirectory baseNameFor: (FileDirectory default localNameFor: self imageName).<br>
        anIndex := aName lastIndexOf: FileDirectory dot asCharacter ifAbsent: [nil].<br>
        (anIndex notNil and: [(aName copyFrom: anIndex + 1 to: aName size) isAllDigits])<br>
                ifTrue:<br>
                        [aName := aName copyFrom: 1 to: anIndex - 1].<br>
<br>
        newName := FileDirectory default nextNameFor: aName extension: FileDirectory imageSuffix.<br>
        changesName := self fullNameForChangesNamed: newName.<br>
<br>
+       (SourceFileArray internalizeChanges or: (SourceFiles at: 2) isNil) ifFalse: [<br>
+               "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"<br>
+               (FileDirectory default fileOrDirectoryExists: changesName)<br>
+                       ifTrue:<br>
+                               [^ self inform:<br>
-       "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"<br>
-       (FileDirectory default fileOrDirectoryExists: changesName)<br>
-               ifTrue:<br>
-                       [^ self inform:<br>
  'There is already .changes file of the desired name,<br>
  ', newName, '<br>
  curiously already present, even though there is<br>
  no corresponding .image file.   Please remedy<br>
  manually and then repeat your request.'].<br>
<br>
+               self closeSourceFiles; "so copying the changes file will always work"<br>
+                       saveChangesInFileNamed: (self fullNameForChangesNamed: newName)<br>
+       ].<br>
-       (SourceFiles at: 2) ifNotNil:<br>
-               [self closeSourceFiles; "so copying the changes file will always work"<br>
-                       saveChangesInFileNamed: (self fullNameForChangesNamed: newName)].<br>
        self saveImageInFileNamed: (self fullNameForImageNamed: newName)<br>
<br>
<br>
  !<br>
<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>