CfsFileDescriptor touch:time: Not working in 8.0.2

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

CfsFileDescriptor touch:time: Not working in 8.0.2

Postby mpeters » Thu Jun 10, 2010 7:02 am

When I run the following code in Windows It returns an error
It worked in 7.0

| date array stream time fname |
fname := 'c:\test1'.
stream := CfsWriteFileStream openEmpty: fname.
stream nextPutAll: 'test1'.
stream close.
time := Time new
hours: 16
minutes: 30
seconds: 0.
date := Date new
year: 2005
month: 1
day: 2.
array := Array with: date with: time.
CfsFileDescriptor touch: fname time: array.

I tracked it down to this method in CfsFileDescriptor class
platformFunctionUtime: path times: mode

<c: int32 Utime safepointer safepointer>
^self primitiveFailed

I tried replacing esvm40.dll with the version from va70 and reran the code and it worked ( I know this isn't a solution).
Must be something wrong with the primitive.
Mark Petersen
mpeters
 
Posts: 6
Joined: Thu Jun 10, 2010 6:25 am

Re: CfsFileDescriptor touch:time: Not working in 8.0.2

Postby koschate » Thu Jun 10, 2010 10:18 am

mpeters wrote:When I run the following code in Windows It returns an error

What error do you get? What version of Windows, what service pack? I tried it on my system (Windows XP, SP3), and, while I don't get an error, it also doesn't change the timestamp of the file.

On the other hand, if I try it with 7.5.2, it makes my image crash. On the whole, I'd have to say I prefer the 8.0.2 behavior!
koschate
[|]
 
Posts: 102
Joined: Thu Feb 01, 2007 7:24 am

Re: CfsFileDescriptor touch:time: Not working in 8.0.2

Postby mpeters » Thu Jun 10, 2010 11:22 am

the method returns a CfsError EIO (5) I/O error [0]
I've tried Windows XP SP3 and Windows 2000 SP4 and get the same error.
If you do a touch: without the time: parameter, it does set the file timestamp to the current time.
Mark Petersen
mpeters
 
Posts: 6
Joined: Thu Jun 10, 2010 6:25 am

Re: CfsFileDescriptor touch:time: Not working in 8.0.2

Postby koschate » Thu Jun 10, 2010 11:41 am

mpeters wrote:If you do a touch: without the time: parameter, it does set the file timestamp to the current time.

I get the same behavior. I did a little bit of playing and got the touch:time: working. Try this:
Code: Select all
CfsFileDescriptor class>>#tm: aDateAndTimeArray
   "Construct a utimbuf from @aDateAndTimeArray."

   | time |

   ^(OSUInt32 new: 4)
      at: 0 put: (time := (CfsOSTmPtr fromDateAndTime: aDateAndTimeArray) mktime);
      at: 2 put: time;
      yourself
koschate
[|]
 
Posts: 102
Joined: Thu Feb 01, 2007 7:24 am

Re: CfsFileDescriptor touch:time: Not working in 8.0.2

Postby mpeters » Thu Jun 10, 2010 2:52 pm

It worked, thanks for the quick response.
Mark Petersen
mpeters
 
Posts: 6
Joined: Thu Jun 10, 2010 6:25 am

Re: CfsFileDescriptor touch:time: Not working in 8.0.2

Postby koschate » Fri Jun 11, 2010 6:14 am

Glad to help. I'm sure we'll see an official fix in VA 8.0.3, assuming John hasn't fried his brains on tequila in Cancun. :)
koschate
[|]
 
Posts: 102
Joined: Thu Feb 01, 2007 7:24 am


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: No registered users and 1 guest