jecisc / Bazard

0 stars 0 forks source link

SourceFileArray calls #flush but the method is not implemented #116

Closed jecisc closed 5 years ago

jecisc commented 5 years ago

Migrated case from Manuscript.

Original case: https://pharo.fogbugz.com/f/cases/21865 Status: Work Needed Project: Usability Original Author: CyrilFerlicot Date: 10 May 2018 1:44:01 pm

Description:

In the latest Pharo 7, on windows when I open two times an image and try to load a Metacello project in the second I get this error:

Instance of ZnBufferedReadStream did not understand #flush

ZnBufferedReadStream(Object)>>doesNotUnderstand: #flush ZnCharacterReadStream(ZnEncodedStream)>>flush SourceFile>>flush ByteSymbol(Symbol)>>cull: SourceFile(ProtoObject)>>ifNotNil: SourceFileArray>>flushChangesFile [ flushChanges := true. self flushChangesFile. self emptyReadStreamsQueue ] in SourceFileArray>>deferFlushDuring: in Block: [ flushChanges := true.... BlockClosure>>ensure: SourceFileArray>>deferFlushDuring: MCPackageLoader>>basicLoad [ self basicLoad ] in MCPackageLoader>>loadWithNameLike: in Block: [ self basicLoad ] BlockClosure>>ensure: MCPackageLoader>>useChangeSetNamed:during: MCPackageLoader>>useNewChangeSetNamedLike:during: MCPackageLoader>>loadWithNameLike: MCVersionLoader>>basicLoadWithNameLike:

jecisc commented 5 years ago

Reply: Author: Sven Van Caekenberghe Date: 10 May 2018 1:59:49 pm

Message:

How do you flush a READ stream ? What would that even do ?

jecisc commented 5 years ago

Reply: Author: CyrilFerlicot Date: 10 May 2018 2:05:15 pm

Message:

I guess the problem is that on windows a file can be open only one time.

Maybe the first image have a read/write stream and the second only a read stream and the code do not expect this scenario?

jecisc commented 5 years ago

Reply: Author: Sven Van Caekenberghe Date: 10 May 2018 2:37:30 pm

Message:

It is not that we could not add it (since #flush is already on ZnEncodedStream it could be added on ZnBufferedReadStream, but still, what would it do, exactly ?

You say 'Windows cannot open a file twice', so #flush would close it ??

jecisc commented 5 years ago

Reply: Author: CyrilFerlicot Date: 10 May 2018 2:43:59 pm

Message:

I'm not sure it's a Zinc streams problem.

I opened two times an image.

The first one probably opened the changes file with a ZnCharacterReadWriteStream.

The second one must have tried to open it like this too but failed because the file is already open in a write mode. So it must have open it with a ZnCharacterReadStream.

But the users of SourceFile must not have imagined this case and assume it's a writable stream which can be flushed.

jecisc commented 5 years ago

Reply: Author: Marcus Denker Date: 14 May 2018 9:06:19 am

Message:

I wish we could really get rid of the .sources and .changes... lots of complexity there