[squeak-dev] The Trunk: System-ct.1333.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Apr 1 11:08:08 UTC 2022


Christoph Thiede uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ct.1333.mcz

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

Name: System-ct.1333
Author: ct
Time: 1 April 2022, 1:08:01.825996 pm
UUID: f206069e-de00-fb40-b100-69e1871c1490
Ancestors: System-ul.1332

Merges robust-forceChangesToDisk.1.cs:

	Increases the robustness of Smalltalk forceChangesToDisk. When this method is interrupted, make sure to maintain the invariant that the source file is always opened and set to the right position. In the course of this, also makes StandardFileStream>>#open:forWrite: more robust. Adds a smoke/regression test.
	
	For context: Interrupting Smalltalk forceChangesToDisk is not a fictional scenario. In combination with a slow file system access, I could reproduce this many times when running StringTest>>#testPercentEncodingJa with a too small timeout.

For more infromation, see: http://lists.squeakfoundation.org/pipermail/squeak-dev/2022-March/219577.html

=============== Diff against System-ul.1332 ===============

Item was changed:
  ----- Method: SmalltalkImage>>forceChangesToDisk (in category 'sources, changes log') -----
  forceChangesToDisk
  	"Ensure that the changes file has been fully written to disk by closing and re-opening it. This makes the system more robust in the face of a power failure or hard-reboot."
  
  	| changesFile |
  	changesFile := SourceFiles at: 2.
  	(changesFile isKindOf: FileStream) ifTrue: [
  		changesFile flush.
+ 		SecurityManager default hasFileAccess
+ 			ifTrue: [
+ 				[changesFile close.
+ 				changesFile open: changesFile name forWrite: true.
+ 				changesFile setToEnd]
+ 					ifCurtailed: [
+ 						"Ensure that the changes file is always reopened correctly."
+ 						changesFile closed ifFalse: [changesFile close].
+ 						changesFile open: changesFile name forWrite: true.
+ 						changesFile setToEnd]]
+ 			ifFalse: [changesFile setToEnd]].!
- 		SecurityManager default hasFileAccess ifTrue:[
- 			changesFile close.
- 			changesFile open: changesFile name forWrite: true].
- 		changesFile setToEnd.
- 	].
- !



More information about the Squeak-dev mailing list