Re: [Pharo-dev] MCMczWriter>>#flush breaks

2018-03-14 Thread Guillermo Polito
There is a fix in here:

https://github.com/pharo-project/pharo/pull/1091

On Wed, Mar 14, 2018 at 10:53 AM, Sven Van Caekenberghe 
wrote:

> Guille,
>
> > On 13 Mar 2018, at 20:30, Sven Van Caekenberghe  wrote:
> >
> >
> >
> >> On 13 Mar 2018, at 20:22, Guillermo Polito 
> wrote:
> >>
> >>
> >>
> >> On Tue, Mar 13, 2018 at 8:08 PM, Sven Van Caekenberghe 
> wrote:
> >> Hi,
> >>
> >> I was trying to merge in Zinc changes from the latest Pharo 7 back to
> the MC Zinc repos. It seems like MCMczWriter>>#flush breaks [1]. I can save
> to the package cache but not to an Http repo, nor copy to it.
> >>
> >> Guile, has this been tested, or do you no longer use the old MC ?
> >>
> >> I do not use old MC since some time already...
> >>
> >> I'll take a look at this tomorrow morning. But if this is broken it
> means it was not covered by tests :/
> >
> > Guille (I got your name wrong before, sorry about that),
> >
> > Thanks. Yes there are probably no tests, too bad.
> >
> > I am guessing, the following is wrong, after your changes:
> >
> > MCHttpRepository>>#entityStreamContents: aBlock
> >   "Generate output in a buffer because we need the length"
> >
> >   | stream |
> >   stream := RWBinaryOrTextStream on: String new.
> >   aBlock value: stream.
> >   stream reset.
> >   ^ (ZnStreamingEntity type: ZnMimeType applicationOctetStream)
> >   stream: stream;
> >   contentLength: stream size;
> >   yourself
> >
> > there probably should be no String there.
>
> I changed
>
>   stream := RWBinaryOrTextStream on: String new.
>
> to
>
>   stream := RWBinaryOrTextStream on: ByteArray new.
>
> and now I can commit MC again. Not sure if that is the best fix, the idea
> is probably to phase out RWBinaryOrTextStream. It would probably also work
> to just write to a ByteArray new writeStream then take the bytes/contents
> and wrap a read stream around them ...
>
> >> Sven
> >>
> >> [1]
> >> ByteString(Object)>>error:
> >> ByteString(Object)>>errorImproperStore
> >> ByteString>>at:put:
> >> ZipWriteStream(WriteStream)>>nextPut:
> >> [ :ch | self nextPut: ch ] in 
> >> ZipWriteStream(DeflateStream)>>next:putAll:startingAt:
> in Block: [ :ch | self nextPut: ch ]
> >> ByteArray(SequenceableCollection)>>do:
> >> ZipWriteStream(DeflateStream)>>next:putAll:startingAt:
> >> ZipWriteStream(DeflateStream)>>nextPutAll:
> >> ZipStringMember(ZipArchiveMember)>>compressDataTo:
> >> ZipStringMember(ZipArchiveMember)>>writeDataTo:
> >> ZipStringMember(ZipArchiveMember)>>writeTo:
> >> [ :member |
> >> member writeTo: stream.
> >> member endRead ] in ZipArchive>>writeTo: in Block: [ :member | ...
> >> OrderedCollection>>do:
> >> ZipArchive>>writeTo:
> >> MCMczWriter>>flush
> >> MCMczWriter class>>fileOut:on:
> >> MCVersion>>fileOutOn:
> >> [ :s | aVersion fileOutOn: s ] in MCHttpRepository(
> MCFileBasedRepository)>>basicStoreVersion: in Block: [ :s | aVersion
> fileOutOn: s ]
> >> MCHttpRepository>>entityStreamContents:
> >> MCHttpRepository>>writeStreamForFileNamed:replace:do:
> >> MCHttpRepository(MCFileBasedRepository)>>writeStreamForFileNamed:do:
> >> MCHttpRepository(MCFileBasedRepository)>>basicStoreVersion:
> >> MCHttpRepository(MCRepository)>>storeVersion:
> >> MCHttpRepository(MCFileBasedRepository)>>storeVersion:
> >> [ super storeVersion: aVersion ] in MCHttpRepository>>storeVersion: in
> Block: [ super storeVersion: aVersion ]
> >> BlockClosure>>on:do:
> >> MCHttpRepository>>retryOnCredentialRequest:
> >> MCHttpRepository>>storeVersion:
> >> MCWorkingCopyBrowser>>storeVersion:in:
> >> [ self
> >>storeVersion: newVersion in: aRepository;
> >>storeDependencies: newVersion in: aRepository ] in [ [ self
> >>storeVersion: newVersion in: aRepository;
> >>storeDependencies: newVersion in: aRepository ]
> >>ensure: [ (MCVersionInspector new version: newVersion) show ] ]
> in MCWorkingCopyBrowser>>basicSaveVersionIn: in Block: [ self...
> >>
> >>
> >>
> >>
> >>
> >> --
> >>
> >> Guille Polito
> >> Research Engineer
> >>
> >> Centre de Recherche en Informatique, Signal et Automatique de Lille
> >> CRIStAL - UMR 9189
> >> French National Center for Scientific Research - http://www.cnrs.fr
> >>
> >> Web: http://guillep.github.io
> >> Phone: +33 06 52 70 66 13
>
>
>


-- 



Guille Polito

Research Engineer

Centre de Recherche en Informatique, Signal et Automatique de Lille

CRIStAL - UMR 9189

French National Center for Scientific Research - *http://www.cnrs.fr
*


*Web:* *http://guillep.github.io* 

*Phone: *+33 06 52 70 66 13


Re: [Pharo-dev] MCMczWriter>>#flush breaks

2018-03-14 Thread Sven Van Caekenberghe
Guille,

> On 13 Mar 2018, at 20:30, Sven Van Caekenberghe  wrote:
> 
> 
> 
>> On 13 Mar 2018, at 20:22, Guillermo Polito  wrote:
>> 
>> 
>> 
>> On Tue, Mar 13, 2018 at 8:08 PM, Sven Van Caekenberghe  wrote:
>> Hi,
>> 
>> I was trying to merge in Zinc changes from the latest Pharo 7 back to the MC 
>> Zinc repos. It seems like MCMczWriter>>#flush breaks [1]. I can save to the 
>> package cache but not to an Http repo, nor copy to it. 
>> 
>> Guile, has this been tested, or do you no longer use the old MC ?
>> 
>> I do not use old MC since some time already...
>> 
>> I'll take a look at this tomorrow morning. But if this is broken it means it 
>> was not covered by tests :/
> 
> Guille (I got your name wrong before, sorry about that),
> 
> Thanks. Yes there are probably no tests, too bad.
> 
> I am guessing, the following is wrong, after your changes:
> 
> MCHttpRepository>>#entityStreamContents: aBlock
>   "Generate output in a buffer because we need the length"
>   
>   | stream |
>   stream := RWBinaryOrTextStream on: String new.
>   aBlock value: stream.
>   stream reset.
>   ^ (ZnStreamingEntity type: ZnMimeType applicationOctetStream)
>   stream: stream;
>   contentLength: stream size;
>   yourself
> 
> there probably should be no String there.

I changed

  stream := RWBinaryOrTextStream on: String new.

to

  stream := RWBinaryOrTextStream on: ByteArray new.

and now I can commit MC again. Not sure if that is the best fix, the idea is 
probably to phase out RWBinaryOrTextStream. It would probably also work to just 
write to a ByteArray new writeStream then take the bytes/contents and wrap a 
read stream around them ...

>> Sven
>> 
>> [1]
>> ByteString(Object)>>error:
>> ByteString(Object)>>errorImproperStore
>> ByteString>>at:put:
>> ZipWriteStream(WriteStream)>>nextPut:
>> [ :ch | self nextPut: ch ] in 
>> ZipWriteStream(DeflateStream)>>next:putAll:startingAt: in Block: [ :ch | 
>> self nextPut: ch ]
>> ByteArray(SequenceableCollection)>>do:
>> ZipWriteStream(DeflateStream)>>next:putAll:startingAt:
>> ZipWriteStream(DeflateStream)>>nextPutAll:
>> ZipStringMember(ZipArchiveMember)>>compressDataTo:
>> ZipStringMember(ZipArchiveMember)>>writeDataTo:
>> ZipStringMember(ZipArchiveMember)>>writeTo:
>> [ :member |
>> member writeTo: stream.
>> member endRead ] in ZipArchive>>writeTo: in Block: [ :member | ...
>> OrderedCollection>>do:
>> ZipArchive>>writeTo:
>> MCMczWriter>>flush
>> MCMczWriter class>>fileOut:on:
>> MCVersion>>fileOutOn:
>> [ :s | aVersion fileOutOn: s ] in 
>> MCHttpRepository(MCFileBasedRepository)>>basicStoreVersion: in Block: [ :s | 
>> aVersion fileOutOn: s ]
>> MCHttpRepository>>entityStreamContents:
>> MCHttpRepository>>writeStreamForFileNamed:replace:do:
>> MCHttpRepository(MCFileBasedRepository)>>writeStreamForFileNamed:do:
>> MCHttpRepository(MCFileBasedRepository)>>basicStoreVersion:
>> MCHttpRepository(MCRepository)>>storeVersion:
>> MCHttpRepository(MCFileBasedRepository)>>storeVersion:
>> [ super storeVersion: aVersion ] in MCHttpRepository>>storeVersion: in 
>> Block: [ super storeVersion: aVersion ]
>> BlockClosure>>on:do:
>> MCHttpRepository>>retryOnCredentialRequest:
>> MCHttpRepository>>storeVersion:
>> MCWorkingCopyBrowser>>storeVersion:in:
>> [ self
>>storeVersion: newVersion in: aRepository;
>>storeDependencies: newVersion in: aRepository ] in [ [ self
>>storeVersion: newVersion in: aRepository;
>>storeDependencies: newVersion in: aRepository ]
>>ensure: [ (MCVersionInspector new version: newVersion) show ] ] in 
>> MCWorkingCopyBrowser>>basicSaveVersionIn: in Block: [ self...
>> 
>> 
>> 
>> 
>> 
>> -- 
>> 
>> Guille Polito
>> Research Engineer
>> 
>> Centre de Recherche en Informatique, Signal et Automatique de Lille
>> CRIStAL - UMR 9189
>> French National Center for Scientific Research - http://www.cnrs.fr
>> 
>> Web: http://guillep.github.io
>> Phone: +33 06 52 70 66 13




Re: [Pharo-dev] MCMczWriter>>#flush breaks

2018-03-13 Thread Sven Van Caekenberghe


> On 13 Mar 2018, at 20:22, Guillermo Polito  wrote:
> 
> 
> 
> On Tue, Mar 13, 2018 at 8:08 PM, Sven Van Caekenberghe  wrote:
> Hi,
> 
> I was trying to merge in Zinc changes from the latest Pharo 7 back to the MC 
> Zinc repos. It seems like MCMczWriter>>#flush breaks [1]. I can save to the 
> package cache but not to an Http repo, nor copy to it. 
> 
> Guile, has this been tested, or do you no longer use the old MC ?
> 
> I do not use old MC since some time already...
> 
> I'll take a look at this tomorrow morning. But if this is broken it means it 
> was not covered by tests :/

Guille (I got your name wrong before, sorry about that),

Thanks. Yes there are probably no tests, too bad.

I am guessing, the following is wrong, after your changes:

MCHttpRepository>>#entityStreamContents: aBlock
"Generate output in a buffer because we need the length"

| stream |
stream := RWBinaryOrTextStream on: String new.
aBlock value: stream.
stream reset.
^ (ZnStreamingEntity type: ZnMimeType applicationOctetStream)
stream: stream;
contentLength: stream size;
yourself

there probably should be no String there.

> Sven
> 
> [1]
> ByteString(Object)>>error:
> ByteString(Object)>>errorImproperStore
> ByteString>>at:put:
> ZipWriteStream(WriteStream)>>nextPut:
> [ :ch | self nextPut: ch ] in 
> ZipWriteStream(DeflateStream)>>next:putAll:startingAt: in Block: [ :ch | self 
> nextPut: ch ]
> ByteArray(SequenceableCollection)>>do:
> ZipWriteStream(DeflateStream)>>next:putAll:startingAt:
> ZipWriteStream(DeflateStream)>>nextPutAll:
> ZipStringMember(ZipArchiveMember)>>compressDataTo:
> ZipStringMember(ZipArchiveMember)>>writeDataTo:
> ZipStringMember(ZipArchiveMember)>>writeTo:
> [ :member |
> member writeTo: stream.
> member endRead ] in ZipArchive>>writeTo: in Block: [ :member | ...
> OrderedCollection>>do:
> ZipArchive>>writeTo:
> MCMczWriter>>flush
> MCMczWriter class>>fileOut:on:
> MCVersion>>fileOutOn:
> [ :s | aVersion fileOutOn: s ] in 
> MCHttpRepository(MCFileBasedRepository)>>basicStoreVersion: in Block: [ :s | 
> aVersion fileOutOn: s ]
> MCHttpRepository>>entityStreamContents:
> MCHttpRepository>>writeStreamForFileNamed:replace:do:
> MCHttpRepository(MCFileBasedRepository)>>writeStreamForFileNamed:do:
> MCHttpRepository(MCFileBasedRepository)>>basicStoreVersion:
> MCHttpRepository(MCRepository)>>storeVersion:
> MCHttpRepository(MCFileBasedRepository)>>storeVersion:
> [ super storeVersion: aVersion ] in MCHttpRepository>>storeVersion: in Block: 
> [ super storeVersion: aVersion ]
> BlockClosure>>on:do:
> MCHttpRepository>>retryOnCredentialRequest:
> MCHttpRepository>>storeVersion:
> MCWorkingCopyBrowser>>storeVersion:in:
> [ self
> storeVersion: newVersion in: aRepository;
> storeDependencies: newVersion in: aRepository ] in [ [ self
> storeVersion: newVersion in: aRepository;
> storeDependencies: newVersion in: aRepository ]
> ensure: [ (MCVersionInspector new version: newVersion) show ] ] in 
> MCWorkingCopyBrowser>>basicSaveVersionIn: in Block: [ self...
> 
> 
> 
> 
> 
> -- 
>
> Guille Polito
> Research Engineer
> 
> Centre de Recherche en Informatique, Signal et Automatique de Lille
> CRIStAL - UMR 9189
> French National Center for Scientific Research - http://www.cnrs.fr
> 
> Web: http://guillep.github.io
> Phone: +33 06 52 70 66 13




Re: [Pharo-dev] MCMczWriter>>#flush breaks

2018-03-13 Thread Guillermo Polito
On Tue, Mar 13, 2018 at 8:08 PM, Sven Van Caekenberghe  wrote:

> Hi,
>
> I was trying to merge in Zinc changes from the latest Pharo 7 back to the
> MC Zinc repos. It seems like MCMczWriter>>#flush breaks [1]. I can save to
> the package cache but not to an Http repo, nor copy to it.


> Guile, has this been tested, or do you no longer use the old MC ?
>

I do not use old MC since some time already...

I'll take a look at this tomorrow morning. But if this is broken it means
it was not covered by tests :/


>
> Sven
>
> [1]
> ByteString(Object)>>error:
> ByteString(Object)>>errorImproperStore
> ByteString>>at:put:
> ZipWriteStream(WriteStream)>>nextPut:
> [ :ch | self nextPut: ch ] in 
> ZipWriteStream(DeflateStream)>>next:putAll:startingAt:
> in Block: [ :ch | self nextPut: ch ]
> ByteArray(SequenceableCollection)>>do:
> ZipWriteStream(DeflateStream)>>next:putAll:startingAt:
> ZipWriteStream(DeflateStream)>>nextPutAll:
> ZipStringMember(ZipArchiveMember)>>compressDataTo:
> ZipStringMember(ZipArchiveMember)>>writeDataTo:
> ZipStringMember(ZipArchiveMember)>>writeTo:
> [ :member |
> member writeTo: stream.
> member endRead ] in ZipArchive>>writeTo: in Block: [ :member | ...
> OrderedCollection>>do:
> ZipArchive>>writeTo:
> MCMczWriter>>flush
> MCMczWriter class>>fileOut:on:
> MCVersion>>fileOutOn:
> [ :s | aVersion fileOutOn: s ] in MCHttpRepository(
> MCFileBasedRepository)>>basicStoreVersion: in Block: [ :s | aVersion
> fileOutOn: s ]
> MCHttpRepository>>entityStreamContents:
> MCHttpRepository>>writeStreamForFileNamed:replace:do:
> MCHttpRepository(MCFileBasedRepository)>>writeStreamForFileNamed:do:
> MCHttpRepository(MCFileBasedRepository)>>basicStoreVersion:
> MCHttpRepository(MCRepository)>>storeVersion:
> MCHttpRepository(MCFileBasedRepository)>>storeVersion:
> [ super storeVersion: aVersion ] in MCHttpRepository>>storeVersion: in
> Block: [ super storeVersion: aVersion ]
> BlockClosure>>on:do:
> MCHttpRepository>>retryOnCredentialRequest:
> MCHttpRepository>>storeVersion:
> MCWorkingCopyBrowser>>storeVersion:in:
> [ self
> storeVersion: newVersion in: aRepository;
> storeDependencies: newVersion in: aRepository ] in [ [ self
> storeVersion: newVersion in: aRepository;
> storeDependencies: newVersion in: aRepository ]
> ensure: [ (MCVersionInspector new version: newVersion) show ] ] in
> MCWorkingCopyBrowser>>basicSaveVersionIn: in Block: [ self...
>
>
>


-- 



Guille Polito

Research Engineer

Centre de Recherche en Informatique, Signal et Automatique de Lille

CRIStAL - UMR 9189

French National Center for Scientific Research - *http://www.cnrs.fr
*


*Web:* *http://guillep.github.io* 

*Phone: *+33 06 52 70 66 13