Metacello / metacello

Metacello is a package management system for Smalltalk
MIT License
87 stars 43 forks source link

Wrong repository spec is not detected, HTTP 404 not caught #477

Closed j4yk closed 6 years ago

j4yk commented 6 years ago

Today I tried to load a branch of a Squeak project of mine via Metacello without first pushing that branch. Stupid me. So my Metacello new repository: 'http://github.com/...' pointed to a non-existent branch. When downloading the zipball in MetacelloSqueakPlatform>>#downloadZipArchive:to:, a 404 response is received, but it is not checked whether the request was actually successful. The response is unconditionally streamed to the target file, which gives me a zip file containing the text "404: Not Found". Of course, this cannot be understood by ZipArchive later on in that method, so archive readFrom: fileStream yields a "file too short" error.

This error is subsequently caught in MetacelloCommonMCSpecLoader>>#retryingResolvePackageSpecReferences:gofer:, so eventually you get a debugger complaining "baseline could not be resolved". Thus, the actual problem (the wrong repository url) is quite obfuscated (until you restart, properly step through, inspect the stack when the error is repeated and look at the proper variables -- or until you look at the downloaded zip file with your favorite text editor).

dalehenrich commented 6 years ago

Okay ... the GemStone code base raises an error indicating that the zip download failed and pointer to the possible problem, however as you point out the Squeak implementation uses WebClient to download the zip file and I'm not familiar enough with WebClient to supply a better solution.

dalehenrich commented 6 years ago

@krono would you be able to implement a solution?

krono commented 6 years ago

thanks