Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: SYS(2000) and ADIR and wildcards filtering
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
BUG: SYS(2000) and ADIR and wildcards filtering
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01174449
Message ID:
01174449
Views:
67
This message has been marked as the solution to the initial question of the thread.
After the long threads:

thread #1173721 Invalid subscript reference
thread #1173982 ADIR, SYS(2000) and Filer all returned wrong results

I put attention on the issue, with VFP9 SP2 CTP.

Well, the short filename is a terrible MS's workaround,
( rather to make certain things is better to lose the compatibility ),
but for me the VFP routines that processing wildcards are fully bad.
Some internal C++ pointers become wrong,
and during the tests VFP9 has gone to crash 3 times in deterministic way,
(I don't have time to eviscerate this condition).

But even if it was a consequence of the short names used in windows,
and even if it was an error of windows, it is to owe of the VFP team to create
of the usable commands.
(I to my clients don't respond that my application doesn't work because VFP,SQL Server,Windows or others have some bugs, if I find bugs
I have to revolve them, without unloading the guilt on others)

this is the repro,
where SYS(2000) ( and ADIR )
return various "false positive".
the only workaround is
it consists of filtering with
LIKE(m.FindName,result)
the results
MD TESTFINDFILE

CD TESTFINDFILE

CREATE CURSOR FOUND	(postlike C(8),fName C(254))

* DIFFERENT TYPE
STRTOFILE("","P1S.0")

* 
STRTOFILE("","P1S.1")
STRTOFILE("","P 1S.1")
STRTOFILE("","P 1 S.1")
STRTOFILE("","P 1T.1")
STRTOFILE("","P1 S.1")
STRTOFILE("","P1 T.1")
STRTOFILE("","P1 X.1")

* BUGS
* spaces are ignored, or stop the stem name comparison with a match
* with more of 4 files on the directory, the search return false match
* and more, more ....

* P1 S.1			OK
* P1 T.1			OK
* P1 X.1			OK
* P1S.1				OK
* P 1S.1			WRONG !
* P 1 S.1			WRONG !
* P 1T.1			WRONG !

findMask("P1*.1")	&& unusable

* P 1S.1			OK
* P1S.1				OK

findMask("*1S.1")

* P 1S.1			OK
* P 1T.1			OK
* P1S.1				OK
* P1S X.1			WRONG ! : the space stop ....

findMask("*1?.1")	&& unusable

* P 1 S.1			WRONG !
* P1 T.1			WRONG !
* P1 X.1			SKIPPED !!!!
findMask("*2.1")	&& unusable

CD ..

ERASE "TESTFINDFILE\*.*"

CD TESTFINDFILE

STRTOFILE("","P          2S.XXX")
STRTOFILE("","P          3S.XXX")

* none OK
findMask("*4*.XXX")

* all !!!!!
findMask("*1*.XXX")	&& unusable

* none OK
findMask("*4*.XXX")

STRTOFILE("","P          1S.XXX")

* P          2S.XXX OK
findMask("*2*.XXX")


STRTOFILE("","P          4S.XXX")
STRTOFILE("","P          5S.XXX")

* P          4S.XXX OK
findMask("*4*.XXX")

CD ..

ERASE "TESTFINDFILE\*.*"

CD TESTFINDFILE

	STRTOFILE("","AAAAAAAAAAAAAAA1S.XXX")
	STRTOFILE("","AAAAAAAAAAAAAAA2T.XXX")
	STRTOFILE("","AAAAAAAAAAAAAAA3U.XXX")
	STRTOFILE("","AAAAAAAAAAAAAAA4V.XXX")

* AAAAAAAAAAAAAAA2T.XXX	OK
findMask("*2*.XXX")

* AAAAAAAAAAAAAAA1S.XXX	OK
findMask("*1*.XXX")


	STRTOFILE("","AAAAAAAAAAAAAAA5S.XXX")

* AAAAAAAAAAAAAAA2T.XXX	OK
findMask("*2*.XXX")

* AAAAAAAAAAAAAAA5S.XXX	WRONG !
* AAAAAAAAAAAAAAA1S.XXX	OK
findMask("*1*.XXX")	&& unusable

CD ..

ERASE "TESTFINDFILE\*.*"

CD TESTFINDFILE

	STRTOFILE("","AAAAAAAAAAAAAA1S.XXX")
	STRTOFILE("","AAAAAAAAAAAAAA2T.XXX")
	STRTOFILE("","AAAAAAAAAAAAAA3U.XXX")
	STRTOFILE("","AAAAAAAAAAAAAA4V.XXX")

* AAAAAAAAAAAAAA2T.XXX	OK
findMask("*2*.XXX")

* AAAAAAAAAAAAAA1S.XXX	OK
findMask("*1*.XXX")


	STRTOFILE("","AAAAAAAAAAAAAA5S.XXX")

* AAAAAAAAAAAAAA5S.XXX	WRONG !
* AAAAAAAAAAAAAA2T.XXX	OK
findMask("*2*.XXX")	&& unusable

* AAAAAAAAAAAAAA5S.XXX	WRONG !
* AAAAAAAAAAAAAA1S.XXX	OK
findMask("*1*.XXX")	&& unusable

CD ..

ERASE "TESTFINDFILE\*.*"


RD TESTFINDFILE

LOCATE

BROWSE NAME oBrowse NOWAIT

oBrowse.SetAll("DynamicForecolor","IIF(postlike='OK',0,IIF(postlike='WRONG',255,0x8F0000))")


*************************************
PROCEDURE findMask(FindName)

INSERT INTO found VALUES ("","---- SYS(2000) ----" + m.FindName)

fLocate=SYS(2000,m.FindName)
DO WHILE NOT EMPTY(m.fLocate)
	INSERT INTO found VALUES (IIF(LIKE(m.FindName,m.fLocate),"OK","WRONG"),m.fLocate)
	fLocate=SYS(2000,m.FindName,1)
ENDDO
SYS(2000,"")

INSERT INTO found VALUES ("","---- ADIR ----" + m.FindName)

FOR k=1 TO ADIR(aLocate,m.FindName)
	INSERT INTO found VALUES (IIF(LIKE(m.FindName,aLocate[m.k,1]),"OK","WRONG"),aLocate[m.k,1])
NEXT

INSERT INTO found VALUES ("","")
Reply
Map
View

Click here to load this message in the networking platform