[squeak-dev] Metacello load error 'File is too short' in Squeak6.0alpha latest update: #17402 ?

H. Hirzel hannes.hirzel at gmail.com
Thu Sep 28 09:45:14 UTC 2017


Hello

Following the Metacello installation instructions [1] the following
step A runs fine but the step  B afterwards gives an error message
'File too short'    [2], marked with '"ERROR FILE TOO SHORT'

"A: Get the Metacello configuration (for Squeak users)"
Installer gemsource
    project: 'metacello';
    addPackage: 'ConfigurationOfMetacello';
    install.


"B: Bootstrap Metacello Preview, using mcz files (#'previewBootstrap'
symbolic version"
((Smalltalk at: #ConfigurationOfMetacello) project
  version: #'previewBootstrap') load.


Any suggestion how to fix this?

Kind regards
Hannes


[1] https://github.com/dalehenrich/metacello-work

[2] ZipArchive class findEndOfCentralDirectoryFrom: stream
	"Seek in the given stream to the end, then read backwards until we find the
	signature of the central directory record. Leave the file positioned right
	before the signature.

	Answers the file position of the EOCD, or 0 if not found."

	| data fileLength seekOffset pos maxOffset |
	stream setToEnd.
	fileLength := stream position.
	"If the file length is less than 18 for the EOCD length plus 4 for
the signature, we have a problem"
	fileLength < 22 ifTrue: [^ self error: 'file is too short'].
"ERROR FILE TOO SHORT"
	
	seekOffset := 0.
	pos := 0.
	data := ByteArray new: 4100.
	maxOffset := 40960 min: fileLength.	"limit search range to 40K"

	[
		seekOffset := (seekOffset + 4096) min: fileLength.
		stream position: fileLength - seekOffset.
		data := stream next: (4100 min: seekOffset) into: data startingAt: 1.
		pos := self lastIndexOfPKSignature: EndOfCentralDirectorySignature in: data.
		pos = 0 and: [seekOffset < maxOffset]
	] whileTrue.

	^ pos > 0
		ifTrue: [ | newPos | stream position: (newPos := (stream position +
pos - seekOffset - 1)). newPos]
		ifFalse: [0]


More information about the Squeak-dev mailing list