FileCopyPlugin 32bit-64bit updates with unit test

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

FileCopyPlugin 32bit-64bit updates with unit test

David T. Lewis
 
This is a set of support code patches that make FileCopyPlugin work on
32/64 bit images and 32/64 bit unix VMs, plus a unit test for verification.

FileCopyPluginTest-dtl.cs provides a unit test to verify operation of
the FileCopyPlugin. Interestingly, the FileCopyPlugin has never worked
correctly on Unix because it answered a primitiveFail after a successful
copy operation. That means that the primitive code was doing the copy,
and the fallback code would re-do it afterward.

The support code changes are in the following files:

- For all platforms (unix and Mac OS are impacted):
    platforms/Cross/plugins/FileCopyPlugin/FileCopyPlugin.h

- For Unix:
    platforms/unix/plugins/FileCopyPlugin/sqUnixFileCopyPlugin.c
    platforms/unix/vm/sqUnixCharConv.c
    platforms/unix/vm/sqPlatformSpecific.h

- Mac OS platform code will need an update also, but I did not try to do
  this (it should be simple, but I cannot test the result).

- Win32 and RiscOS do not appear to be impacted.

Dave


FileCopyPluginTest-dtl.2.cs (1K) Download Attachment
Cross-plugins-FileCopyPlugin-FileCopyPlugin.h.diff (428 bytes) Download Attachment
unix-plugins-FileCopyPlugin-sqUnixFileCopyPlugin.c.diff (608 bytes) Download Attachment
unix-vm-sqPlatformSpecific.h.diff (187 bytes) Download Attachment
unix-vm-sqUnixCharConv.c.diff (321 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FileCopyPlugin 32bit-64bit updates with unit test

ccrraaiigg
 

      Thanks!


-C

--
Craig Latta
improvisational musical informaticist
www.netjam.org
Smalltalkers do: [:it | All with: Class, (And love: it)]

Reply | Threaded
Open this post in threaded view
|

Re: FileCopyPlugin 32bit-64bit updates with unit test

johnmci
In reply to this post by David T. Lewis
 
For os-x carbon we attempted to implement the filecopy plugin many  
years back but had serious issues with Apple's
failure to provide an operating system api that let you copy a file  
between locations and actually preserve all the
meta-data for the file, date/time, permissions, ACL, os-9 attributes,  
endless list. Plus rules were slightly different when
dealing with AppleShare Servers, and then basically gave it up as a  
lost cause.

However I guess I'll consider revisiting this because Apple has  
provide an API to move objects in a file system in 10.4 or later.
We actually use this via FFI in Sophie to import data into Sophie, and  
to copy data between books on Save As operation.
For example it preserves the OS-9 file type which indicates the file  
'Foo' is a MPEG movie without having to say the file is 'Foo.mpeg'
Then later when we hand 'Foo' to some audio/video apis they know what  
to do by reading the ancient OS-9 file type.


On Nov 18, 2007, at 4:18 PM, David T. Lewis wrote:

> This is a set of support code patches that make FileCopyPlugin work on
> 32/64 bit images and 32/64 bit unix VMs, plus a unit test for  
> verification.
>
> FileCopyPluginTest-dtl.cs provides a unit test to verify operation of
> the FileCopyPlugin. Interestingly, the FileCopyPlugin has never worked
> correctly on Unix because it answered a primitiveFail after a  
> successful
> copy operation. That means that the primitive code was doing the copy,
> and the fallback code would re-do it afterward.
>
> The support code changes are in the following files:
>
> - For all platforms (unix and Mac OS are impacted):
>    platforms/Cross/plugins/FileCopyPlugin/FileCopyPlugin.h
>
> - For Unix:
>    platforms/unix/plugins/FileCopyPlugin/sqUnixFileCopyPlugin.c
>    platforms/unix/vm/sqUnixCharConv.c
>    platforms/unix/vm/sqPlatformSpecific.h
>
> - Mac OS platform code will need an update also, but I did not try  
> to do
>  this (it should be simple, but I cannot test the result).
>
> - Win32 and RiscOS do not appear to be impacted.
>
> Dave
>
> <FileCopyPluginTest-dtl.2.cs><Cross-plugins-FileCopyPlugin-
> FileCopyPlugin.h.diff><unix-plugins-FileCopyPlugin-
> sqUnixFileCopyPlugin.c.diff><unix-vm-sqPlatformSpecific.h.diff><unix-
> vm-sqUnixCharConv.c.diff>

--
=
=
=
========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
=
=
=
========================================================================


Reply | Threaded
Open this post in threaded view
|

Re: FileCopyPlugin 32bit-64bit updates with unit test

keith1y
 
John M McIntosh wrote:
>
> For os-x carbon we attempted to implement the filecopy plugin many
> years back but had serious issues with Apple's
> failure to provide an operating system api that let you copy a file
> between locations and actually preserve all the
 Do we have any API for creating or manipulating Symbolic links?


thanks

Keith
Reply | Threaded
Open this post in threaded view
|

Re: FileCopyPlugin 32bit-64bit updates with unit test

johnmci

Well the api for file copying that Apple provides now actually invokes  
the same logic that the Finder uses.

If you want Symbolic links manipulation without using this api you  
need to either do it via FFI, or code up a shell command and feed to the
OSProcess plugin, or cheat and use AppleScript to invoke a bash shell  
command

I'll note when dealing with file names, you need to be careful. If you  
are using the standard VM it returns names in MacRoman which depending  
on the image
you use might convert to Latin1.  Most commercial like products  
(seaside/sophie/scratch?/plopp) use UTF8, this is controlled by a  
setting in the info.plist.

However the UTF8 you get from the VM  is UTF8 normalized  
(precomposed) , but the HFS+ file level apis require UTF8 de-
normalized (decomposed)

Thus having a file/directory string in UTF8 precomposed form begs the  
question, for the API or shell script what are the expectations for  
precomposed/decomposed here?
Unless you use the right test data, you could have misleading results.

Ps note we painfully added unicode file dialog get/put logic for  
Windows to Sophie over the weekend, so that you could open, or save  
books like π.spb
Then discovered on XP it whines about the file name contains an  
illegal character when you attempt to compress/zip the book file.


On Nov 18, 2007, at 11:47 PM, Keith Hodges wrote:

> John M McIntosh wrote:
>>
>> For os-x carbon we attempted to implement the filecopy plugin many
>> years back but had serious issues with Apple's
>> failure to provide an operating system api that let you copy a file
>> between locations and actually preserve all the
> Do we have any API for creating or manipulating Symbolic links?
>
>
> thanks
>
> Keith

--
=
=
=
========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
=
=
=
========================================================================


Reply | Threaded
Open this post in threaded view
|

Re: FileCopyPlugin 32bit-64bit updates with unit test

timrowledge
 
I should point out that I originally hacked up the filecopyplugin as a  
deliberatley "oh my god this has to go" bit of code years ago because  
we had to be able to move source files around during the VMMaker  
process due to lack of sensible link handling. I didn't want something  
beautifully thought out to last the centuries, I wnated something to  
do the job today and get replaced tomorrow with decent code.

Unfortunately the file handing code in squeak is still just as awful  
as it ever was.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Useful random insult:- His page was intentionally left blank.