SeasideSt / Seaside

The framework for developing sophisticated web applications in Smalltalk.
MIT License
519 stars 71 forks source link

MNU: ByteArray>>isByteString #1217

Closed jecisc closed 4 years ago

jecisc commented 4 years ago

Hi,

I have a bug with the latest Seaside on MDL (https://mdl.ferlicot.fr). This bug was not present in January but is now present.

The icon in the header does not appear anymore. When I try to explicitly load it in the browser, I get an error MNU ByteArray>>isByteString.

The code to display the icon is:

 html image
    style: 'width: 40px; height: 40px;';
    url: (MDLDemoLibrary urlOf: 'logoSvg').

The code of the logo can be seen here: https://raw.githubusercontent.com/DuneSt/MaterialDesignLite/development/src/Material-Design-Lite-Utils/MDLLibrary.class.st

But it is a byte array created by the file library when I imported the file.

I added a method #isByteString on ByteArray with an halt to get a stacktrace and here is the result:

SmallInteger(Object)>>haltOnce
ByteArray>>isByteString
GRPharoUtf8CodecStream>>nextPutAll:
WABufferedResponse(WAResponse)>>nextPutAll:
WABufferedResponse(WAResponse)>>document:
WABufferedResponse(WAResponse)>>document:mimeType:
[ :response | 
response
    cacheFor: self cacheDuration;
    document: (self documentOf: selector) mimeType: (self mimetypeOf: selector) ] in MDLDemoLibrary(WAFileLibrary)>>handle: in Block: [ :response | ...
WARequestContext>>respond:
MDLDemoLibrary(WAFileLibrary)>>handle:
MDLDemoLibrary class(WAAbstractFileLibrary class)>>handle:
WAFileHandler>>responseForContext:
WAFileHandler>>handleFiltered:
[ self filter handleFiltered: aRequestContext ] in WAFileHandler(WARequestHandler)>>handle: in Block: [ self filter handleFiltered: aRequestContext ]
[ activeProcess psValueAt: index put: anObject.
aBlock value ] in WACurrentRequestContext(DynamicVariable)>>value:during: in Block: [ activeProcess psValueAt: index put: anObject....
BlockClosure>>ensure:
WACurrentRequestContext(DynamicVariable)>>value:during:
WACurrentRequestContext class(DynamicVariable class)>>value:during:
WACurrentRequestContext class(GRDynamicVariable class)>>use:during:
[ WACurrentRequestContext use: self during: aBlock ] in WARequestContext>>push:during: in Block: [ WACurrentRequestContext use: self during: aBlock...etc...
BlockClosure>>ensure:
WARequestContext>>push:during:
WAFileHandler(WARequestHandler)>>handle:
WADispatcher>>handleFiltered:named:
WADispatcher>>handleFiltered:
[ self filter handleFiltered: aRequestContext ] in WADispatcher(WARequestHandler)>>handle: in Block: [ self filter handleFiltered: aRequestContext ]
[ activeProcess psValueAt: index put: anObject.
aBlock value ] in WACurrentRequestContext(DynamicVariable)>>value:during: in Block: [ activeProcess psValueAt: index put: anObject....
BlockClosure>>ensure:
WACurrentRequestContext(DynamicVariable)>>value:during:
WACurrentRequestContext class(DynamicVariable class)>>value:during:
WACurrentRequestContext class(GRDynamicVariable class)>>use:during:

The bug happens in Pharo 7 and 8 64bits.

Here is the dependency on Seaside been loaded:

seaside3: spec
    spec
        baseline: 'Seaside3'
        with: [ spec
                loads: #('Core' 'JQuery' 'Zinc');
                repository: 'github://SeasideSt/Seaside:v3.4.x/repository' ]
Image
-----
/Users/cyrilferlicot/Downloads/38/OnWeb.image
Pharo8.0.0
Build information: Pharo-8.0.0+build.1140.sha.5e328f2d7e8ed65fbddfb761624df5a19d0400f7 (64 Bit)
Unnamed

Virtual Machine
---------------
/Users/cyrilferlicot/Downloads/38/pharo-mac-vm/Pharo.app/Contents/MacOS/Pharo
CoInterpreter * VMMaker-CompatibleUserName.1580983506 uuid: 7aff73cb-5a2e-5002-a356-37de4e762a49 Feb 12 2020
StackToRegisterMappingCogit * VMMaker-CompatibleUserName.1580983506 uuid: 7aff73cb-5a2e-5002-a356-37de4e762a49 Feb 12 2020
VM: 202002121007 https://github.com/pharo-project/opensmalltalk-vm.git Date: Wed Feb 12 11:07:12 2020 CommitHash: 2bd9e39 Plugins: 202002121007 https://github.com/pharo-project/opensmalltalk-vm.git

Mac OS X built on Feb 12 2020 10:23:42 UTC Compiler: 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)
VMMaker versionString VM: 202002121007 https://github.com/pharo-project/opensmalltalk-vm.git Date: Wed Feb 12 11:07:12 2020 CommitHash: 2bd9e39 Plugins: 202002121007 https://github.com/pharo-project/opensmalltalk-vm.git
CoInterpreter * VMMaker-CompatibleUserName.1580983506 uuid: 7aff73cb-5a2e-5002-a356-37de4e762a49 Feb 12 2020
StackToRegisterMappingCogit * VMMaker-CompatibleUserName.1580983506 uuid: 7aff73cb-5a2e-5002-a356-37de4e762a49 Feb 12 2020
jbrichau commented 4 years ago

@jecisc could be related to changes done to Grease (https://github.com/SeasideSt/Grease/pull/106) to switch to the new filestream api in Pharo. Can you check which version of Grease is loaded? If 1.6.0 is loaded: can you verify by reverting to Grease 1.5.x ?

It would be great to have a small codesample that reproduces the bug so we can put it in a test.

jecisc commented 4 years ago

The grease version loaded is the v1.5.1 because seside depends v3.4.2 on the v1.5.x.

I did some try. If I depend on Seaside v3.3.4 it works. On v3.4.0 it seems to fail.

v3.3.4 brings Grease v1.4.3 and v3.4.0 brings Grease v1.4.3 also. So the problem seems to come from Seaside and not from Grease.

jecisc commented 4 years ago

I found the problem. It's linked to commit 9c33a56473841c0c6318a91873c30eda13491f76

Now SVG is marked as non binary. Thus, SVG files imported before this change are not in the right format for Seaside.

I can fix the problem by exporting my SVG files and importing them again.

jbrichau commented 4 years ago

So, there has been some change that an svg mimetype was seen as binary before, which is wrong... I cannot dive into it right now, but seems related.

jecisc commented 4 years ago

Related to my last message: Because of the problem I don't know if we should fix something. If you think the same, you can close my issue.

jbrichau commented 4 years ago

ha... @jecisc you should read the 'breaking changes' when upgrading: https://github.com/SeasideSt/Seaside/releases/tag/v3.4.0 :p