Page 1 of 1 1
Topic Options
#77419 - 2001-04-03 05:47 AM KIX2001-MAJOR: timings problem between flushing output and setting file attributes
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

During the migration of our scripts to Kix2001 beta 1 we
discover a timings problem.
What are we doing:


  • setfileattr(file,128)
  • del file
  • writeprofilestring(file,.....)
  • setfileattr(file,7) which means: file will get ReadOnly, Hidden & System
    attributes.

Result (see line 290): The system cannot find the file specified.

remarks:


  • remove line 268 means the file becomes the RO,H,S attributes
    before the new information of writeprofilestring has put
    to the file.
  • we discover this problem by using our local C-drive as destination
    location. normally we are writting those information to user's
    home directory.

Script code which is a part of our script logon.kix 2.00, which
has been check with kixstrip.exe. We were using the options
/debug /block_check /show_errors:

code:

?"- 248-" ; --------------------------------------------------------------------------
?"- 249-" ; - get last user logon information -
?"- 250-" ; --------------------------------------------------------------------------
?"- 251-"
?"- 252-" $last_logon_message="Last logon by '"+$fullname+"' at "+LCASE(@day)+" "+@mdayno+"-"+LCASE(substr(@month,1,3))+"-"+@year+" "+@time
?"- 253-" $last_workstation= "Location pc '"+UCASE(@wksta)+"' of domain '"+UCASE($domain)+"'"
?"- 254-" $previous_logon_message="<unknown>"
?"- 255-" $previous_workstation="<unknown>"
?"- 256-" ;
?"- 257-" $filename=$user_drive+"\logon.lst"
?"- 258-" $fileattr="<unknown>"
?"- 259-" $filesize="<unknown>"
?"- 260-" IF (exist($filename) = 1)
?"- 261-" $fileattr=GetFileAttr($filename)
?"- 262-" $filesize=GetFileSize($filename)
?"- 263-" IF (setfileattr($filename, 128) <> 0)
?"- 264-" ? @serror
?"- 265-" ENDIF
?"- 266-" $previous_logon_message=readprofilestring($filename, "last logon", "user")
?"- 267-" $previous_workstation=readprofilestring($filename, "last logon", "workstation")
?"- 268-" DEL $filename
?"- 269-" ENDIF
?"- 270-" IF ($debug_mode = "yes")
?"- 271-" ? " KIX-LOGON "+@kix
?"- 272-" ?
?"- 273-" ? " file "+$filename
?"- 274-" ? " file attributes "+$fileattr
?"- 275-" ? " file size "+$filesize
?"- 276-" ?
?"- 277-" ? " previous_logon_message "+$previous_logon_message
?"- 278-" ? " previous_workstation "+$previous_workstation
?"- 279-" ?
?"- 280-" ? " last_logon_message "+$last_logon_message
?"- 281-" ? " last_workstation "+$last_workstation
?"- 282-" ENDIF
?"- 283-" IF (writeprofilestring($filename, "last logon", "user", $last_logon_message) <> 0)
?"- 284-" ? @serror
?"- 285-" ENDIF
?"- 286-" IF (writeprofilestring($filename, "last logon", "workstation", $last_workstation) <> 0)
?"- 287-" ? @serror
?"- 288-" ENDIF
?"- 289-" IF (setfileattr($filename, 7) <> 0) ; -RHS-
?"- 290-" ? @serror
?"- 291-" ENDIF

The output of this script is (you see exactly which line is executed):

code:

- 248-
- 249-
- 250-
- 251-
- 252-
- 253-
- 254-
- 255-
- 256-
- 257-
- 258-
- 259-
- 260-
- 261-
- 262-
- 263-
- 266-
- 267-
- 268-
- 269-
- 270-
- 271-
KIX-LOGON 4.00 BETA 1
- 272-

- 273-
file c:\logon.lst
- 274-
file attributes 32
- 275-
file size 135
- 276-

- 277-
previous_logon_message Last logon by 'MCA' at tuesday 3-apr-2001 00:36:34
- 278-
previous_workstation Location pc 'Windows2000' of domain 'W2K'
- 279-

- 280-
last_logon_message Last logon by 'MCA' at tuesday 3-apr-2001 00:37:10
- 281-
last_workstation Location pc 'Windows2000' of domain 'W2K'
- 282-
- 283-
- 286-
- 289-
- 290-
The system cannot find the file specified.
- 291-
- 292-
- 293-


Has somebody an idea.
Greetings.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#77420 - 2001-04-03 06:23 PM Re: KIX2001-MAJOR: timings problem between flushing output and setting file attributes
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
I am having trouble reproducing this problem... This script segment appears to work in KiX 3.63 and KiX2k for me.

Here is the dump when the file does not exist:

C:\scripts>k2 MCAlogin.kix

- 248-
- 249-
- 250-
- 251-
- 252-
- 253-
- 254-
- 255-
- 256-
- 257-
- 258-
- 259-
- 260-
- 270-
- 271-
KIX-LOGON 4.00 BETA 1
- 272-

- 273-
file c:\logon.lst
- 274-
file attributes <unknown>
- 275-
file size <unknown>
- 276-

- 277-
previous_logon_message <unknown>
- 278-
previous_workstation <unknown>
- 279-

- 280-
last_logon_message Last logon by 'cj' at wednesday 4-apr-2001 02:19:06
- 281-
last_workstation Location pc 'CJSCOMPUTER' of domain 'CJSDOMAIN'
- 282-
- 283-
- 286-
- 289-


and when the logon.lst file DOES exist:

C:\scripts>k2 MCAlogin.kix

- 248-
- 249-
- 250-
- 251-
- 252-
- 253-
- 254-
- 255-
- 256-
- 257-
- 258-
- 259-
- 260-
- 261-
- 262-
- 263-
- 266-
- 267-
- 268-
- 269-
- 270-
- 271-
KIX-LOGON 4.00 BETA 1
- 272-

- 273-
file c:\logon.lst
- 274-
file attributes 7
- 275-
file size 134
- 276-

- 277-
previous_logon_message Last logon by 'cj' at wednesday 4-apr-2001 02:19:06
- 278-
previous_workstation Location pc 'CJSCOMPUTER' of domain 'CJSDOMAIN'
- 279-

- 280-
last_logon_message Last logon by 'cj' at wednesday 4-apr-2001 02:20:34
- 281-
last_workstation Location pc 'CJSCOMPUTER' of domain 'CJSDOMAIN'
- 282-
- 283-
- 286-
- 289-
C:\scripts>


My additions to the code:
$user_drive="c:"
$debug_mode="yes"

My changes to the code:
?"- 252-" $last_logon_message="Last logon by '"+@fullname+"' at "+LCASE(@day)+" "+@mdayno+"-"+LCASE(substr(@month,1,3))+"-"+@year+" "+@time
?"- 253-" $last_workstation= "Location pc '"+UCASE(@wksta)+"' of domain '"+UCASE(@ldomain)+"'"


cj

------------------
For more scripts goto my website and click the hammer and spanner icon.

chrismat@ozemail.com.au

Top
#77421 - 2001-04-03 07:28 PM Re: KIX2001-MAJOR: timings problem between flushing output and setting file attributes
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear CJ,

A possible problem can created by a very fast workstation. We are running it on a Pentium 3 1000 MHz with DIMM 133.
Greetings.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#77422 - 2001-04-03 10:26 PM Re: KIX2001-MAJOR: timings problem between flushing output and setting file attributes
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
ahh.. I have only a P3 800MHz

If you put a SLEEP 1 in there, does it help?


cj

Top
#77423 - 2001-04-05 06:31 AM Re: KIX2001-MAJOR: timings problem between flushing output and setting file attributes
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

The speed of our computer wasn't the problem.
The scripts runs correct for windows NT and Windows 2000.
Windows 95 / 98 have this problem.
Our work-around is to check first for the availibility of the file before trying to change the attributes of it.
Greetings.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#77424 - 2001-04-05 03:34 PM Re: KIX2001-MAJOR: timings problem between flushing output and setting file attributes
Anonymous
Unregistered


This kind of problem is very common, but not well documented, and occurs when using write-behind disk cacheing with Windows 95 (not sure about 98). There is a bug in the cache logic which fails to flush the buffers prior to performing other operations on the file. What happens is that the changes you make are stored in the disk cache, waiting for idle time, and the attribute change is performed before the new data is written. It is even possible to delete a file before the data is written, which will give the same error message. Alternatively, the file will fail to be deleted because the cache logic has a handle to that file open at that instance.

In contrast, NT/2000 has a better cache algorythm and will flush the buffer prior to altering the attributes.

About the only real way around this is for Kixtart to forcibly flush the buffers at the end of all file write operations. Of course that would require a change at source code level.

Top
#77425 - 2001-07-01 05:50 PM Re: KIX2001-MAJOR: timings problem between flushing output and setting file attributes
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Problem checked. Situation unchanged but it isn't a kix problem.
Greetings.

------------------
Site map:

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
Page 1 of 1 1


Moderator:  ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.055 seconds in which 0.037 seconds were spent on a total of 12 queries. Zlib compression enabled.