DO NOT TRUST XP Text search in file contents - it cannot be relied upon

  • Thread starter Thread starter Ralph
  • Start date Start date
R

Ralph

This is truly awful. Even more awful is that a Microsoft
support person suggesting that I might have to pay "per
incident" in order to talk to someone technical to
explain the bug. Then not emailing me back after
promising to do so. Personally I think I deserve a prize
for finding and investigating this issue and persevering
to report it to Microsoft despite their reluctance to
listen - I think that Microsoft have failed to meet
acceptable standards here.

To recreate the fault - Imagine 1000 files in a folder
named from 0000.txt to 0999.txt, each containing just the
same number of "x"'s as the number in the filename
suggests, followed by the word "SEARCH_TEXT". Now, use XP
(SP1 in my case) search to look for "SEARCH_TEXT". You
will find it in 952 cases out of the 1000!

Delete the files it found and you will find there are
blind spots at (inclusive) 210-221, 432-443, 654-665 ...
the pattern continues.

1. This is positional, probably based on the way the
algorithm interface works on files a section at a time
(though 221 seems a strange size for a chunk).
2. It also depends in a complex manner on what the search
text is (SEARCHSTRING doesn't show the issue - but I'm
fairly sure I have seen examples without "_" that do)
3. The search string length makes a difference - but I
don't think the number of files missed is always the
length of the search string as here.
4. What other text is in the file makes a difference
(use "(" or " " instead of "x" and it will find all files)

BTW - the email address is fake - I'm not a fan of spam.
If you want to contact me you will have to reply to the
post.

VB(6) program to generate test file set (you need to
create "Dir1" under "C:\"):

Sub LogFile(Filename As String, Message As String)
Dim LogFile As Integer
LogFile = FreeFile
Open Filename For Append As #LogFile
Print #LogFile, Message
Close #LogFile
End Sub

Sub Main()
Dim Filename As String
Dim OutputString As String
Dim Count As Integer
Dim TCount As Integer

For TCount = 0 To 999
Filename = Format(TCount)
While Len(Filename) < 4
Filename = "0" + Filename
Wend
Filename = "C:\Dir1\" + Filename + ".txt"
OutputString = ""
For Count = 1 To TCount
OutputString = OutputString + "x"
Next Count
OutputString = OutputString + "SEARCH_STRING"
LogFile Filename, OutputString
Next TCount
End Sub
 
-----Original Message-----
....Personally I think I deserve a prize
for finding and investigating this issue and persevering
to report it to Microsoft despite their reluctance to
listen ...


Congradulations, you have earned a cookie.
 
Mike Mulligan said:
And why should I trust you?

One can obviously tell that, you simply read the subject line, and made your pillocking, gormless reply, you stupid tit!
 
Is that you, Amethyst? I guess I'll have to add your new
name the the killfile! - Your still a ****wit, you know!


-----Original Message-----



One can obviously tell that, you simply read the subject
line, and made your pillocking, gormless reply, you stupid
tit!
 
I used a variation of your code in VB .Net 2003 and duplicated your results.
My search for SEARCH_TEXT only found 952 of the 1000 files.

Dim Filename As String
Dim OutputString As String
Dim Count As Integer
Dim TCount As Integer

For TCount = 0 To 999
Filename = Format(TCount)
While Len(Filename) < 4
Filename = "0" + Filename
End While
Filename = "C:\Dir1\" + Filename + ".txt"
OutputString = ""
For Count = 1 To TCount
OutputString = OutputString + "x"
Next Count
OutputString = OutputString + "SEARCH_TEXT"
Dim file As New StreamWriter(Filename)
file.WriteLine(OutputString)
file.Close()
Next TCount
 
Back
Top