Page 1 of 1 1
Topic Options
#79624 - 2003-03-26 03:29 PM Bug? EXIST() reports returncode 0 on Win2000
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Was messing around with som of my login scripts today, and was trying redo a check I did to see if my clients fileserver was available on their local subnets.

This was done by just using EXIST("\\server\share")

Since I've remade my approach on storing userfiles, I now have a root share on each local fileserver (w2k server) named "\\server\Users" on which the share permission are set to admins only (under that folder there's userfolders individually shared as \\server\@USERID$).

Anyhow, while doing this I though I'd just see what EXIST() reports if the user has no share permissions on the folder.

WinNT4 and Win9x reports @ERROR = 1 for EXIST("\\server\users"), which is correct (the folder exists and is "browsable" to, even though they might not have access to it), on Win2000 though, it report @ERROR = 0 [Eek!]

Is this a known bug? I tried with both KiX 363 and 420, and it was the same.

[ 26. March 2003, 15:58: Message edited by: masken ]
_________________________
The tart is out there

Top
#79625 - 2003-03-26 03:34 PM Re: Bug? EXIST() reports returncode 0 on Win2000
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, if the folder exists...
it actually should be 0!

if it is not a hidden share and users can see it in net view, sure it should always return 0.
_________________________
!

download KiXnet

Top
#79626 - 2003-03-26 03:35 PM Re: Bug? EXIST() reports returncode 0 on Win2000
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Not quite !

quote:
Exist( )

Action: Checks for the existence of one or more files.

Syntax: Exist ("file name")

Parameters: File name
Identifies the file(s) you want to locate.

Remarks: Supports wildcards.

Returns: 0
File not found

1
File found



Examples: IF EXIST (@LDRIVE + "\users.txt")
DISPLAY @LDRIVE + "\users.txt"
ENDIF

IF EXIST (@LDRIVE + "\*.INI")
; Etc, etc.
ENDIF


_________________________



Top
#79627 - 2003-03-26 03:40 PM Re: Bug? EXIST() reports returncode 0 on Win2000
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
quite right in the meaning that exist does not set @error.

so, even though it does not specifically set it to 0, it does not set it to anything else either.
_________________________
!

download KiXnet

Top
#79628 - 2003-03-26 03:50 PM Re: Bug? EXIST() reports returncode 0 on Win2000
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
...problem remains? [Wink]

Should clarify myself with what I used to for testing...
code:
? "test # 1:"
? "========="
IF EXIST("\\server\Users") = 1
? "yupp, folder exists"
ELSE
? "nope, doesn't exist, errorcode @ERROR (@SERROR)"
ENDIF

? "test # 2:"
? "========="
IF EXIST("\\server\Users\")
? "yupp, folder exists"
ELSE
? "nope, doesn't exist, errorcode @ERROR (@SERROR)"
ENDIF



[ 26. March 2003, 15:53: Message edited by: masken ]
_________________________
The tart is out there

Top
#79629 - 2003-03-26 04:01 PM Re: Bug? EXIST() reports returncode 0 on Win2000
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Need to be clear on the terminology. What a function returns and the @Error that may or may not get set can be two separate and distinct values.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#79630 - 2003-03-27 08:55 AM Re: Bug? EXIST() reports returncode 0 on Win2000
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
yes yes, returncode, errorcode, whatever heh... it still reports wrong?
_________________________
The tart is out there

Top
#79631 - 2003-03-27 08:57 AM Re: Bug? EXIST() reports returncode 0 on Win2000
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Mats,

you may want to post this in Beta to get Ruuds attention ?
_________________________



Top
#79632 - 2003-03-27 03:43 PM Re: Bug? EXIST() reports returncode 0 on Win2000
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Perhaps some mod can move it? [Smile]
_________________________
The tart is out there

Top
#79633 - 2003-03-27 04:40 PM Re: Bug? EXIST() reports returncode 0 on Win2000
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
masken, please first post the console output of the above code.

I still don't see it as a bug on w2k but there is some problem on older systems.
by the manual, there is not said that it should give you errorcode which you seem to miss.

[ 27. March 2003, 16:41: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#79634 - 2003-03-27 06:05 PM Re: Bug? EXIST() reports returncode 0 on Win2000
Rocco Capra Offline
Hey THIS is FUN
*****

Registered: 2002-04-01
Posts: 380
Loc: Mansfield Ohio
Output..
code:
test # 1:
=========
nope, doesn't exist, errorcode 0 (The operation completed successfully.)
test # 2:
=========
nope, doesn't exist, errorcode 0 (The operation completed successfully.)
***********************************************
test # 1:
=========
yupp, folder exists
test # 2:
=========
yupp, folder exists

Think of it this way...

The exist() command returns a 1 or 0. The @Error returns weather or not the command completed or not. So if the file is there or not you will get a 0 from @Error as long as the command completed.

Here try this code...
code:
BREAK ON

?EXIST("\\MANFP1NT\Users");this does exist
?@ERROR
?EXIST("\\MANFP1NT\User") ;this does not exist
?@ERROR

GET $_

You will see that @Error returns a 0 on both because the Exist() command completed successfully.

HTH
Rocco
_________________________
I Love this board!! -------------------- My DEV PC is running KIX 4.22 WINXP Pro

Top
#79635 - 2003-03-27 06:30 PM Re: Bug? EXIST() reports returncode 0 on Win2000
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
rocco, but you use XP. also on w2k it works as expected.

I talked to masken yesterday and he said that the error was set on other OS'es like win9x and NT.

sorry for not clearing that out here.
_________________________
!

download KiXnet

Top
#79636 - 2003-03-27 06:39 PM Re: Bug? EXIST() reports returncode 0 on Win2000
Rocco Capra Offline
Hey THIS is FUN
*****

Registered: 2002-04-01
Posts: 380
Loc: Mansfield Ohio
Lonkero,

I get the same output on XP and 2000 and NT(don't have any 9X to test). Same kix (4.11)

[Confused]

Rocco
_________________________
I Love this board!! -------------------- My DEV PC is running KIX 4.22 WINXP Pro

Top
#79637 - 2003-03-27 09:11 PM Re: Bug? EXIST() reports returncode 0 on Win2000
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok, then remove the rights for you on the share and try again [Big Grin]
_________________________
!

download KiXnet

Top
#79638 - 2003-03-28 02:37 PM Re: Bug? EXIST() reports returncode 0 on Win2000
Rocco Capra Offline
Hey THIS is FUN
*****

Registered: 2002-04-01
Posts: 380
Loc: Mansfield Ohio
quote:
Anyhow, while doing this I though I'd just see what EXIST() reports if the user has no share permissions on the folder.

Duh, I missed that sorry! [Roll Eyes]

Rocco
_________________________
I Love this board!! -------------------- My DEV PC is running KIX 4.22 WINXP Pro

Top
#79639 - 2003-03-28 03:52 PM Re: Bug? EXIST() reports returncode 0 on Win2000
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Did some more testing...
code:
? "TEST 1"
IF GETFILEATTR("\\server\Users") & 16
? "yupp, exists"
ELSE
? "nope, not found"
ENDIF

? "TEST 2"
$returncode = GETFILEATTR( "\\server\Users")
? "returncode: $returncode"

On Win9x and NT4, the returncode is 16, on Win2000 it's 0.

On all tests, the client didn't have share permissions to the share.

@Lonkero, the output is as I've told.

[ 28. March 2003, 15:54: Message edited by: masken ]
_________________________
The tart is out there

Top
#79640 - 2003-04-03 06:41 PM Re: Bug? EXIST() reports returncode 0 on Win2000
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
Thanks for the report.

This phenomenon is caused by a change in the underlying Windows API's. I'll look into it, but I doubt there is anything I can change about it.

Regards,

Ruud

Top
#79641 - 2003-04-21 07:27 PM Re: Bug? EXIST() reports returncode 0 on Win2000
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Ok, thanks for replying. Damned... well I hope it could be made so that the errorcodes are at least reported the same on different OS's?
_________________________
The tart is out there

Top
#79642 - 2003-04-21 08:42 PM Re: Bug? EXIST() reports returncode 0 on Win2000
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
still, you shouldn't be looking at the error-code.

as exist even shouldn't return errorcodes in the first place (according to manual)
_________________________
!

download KiXnet

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 764 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

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