Nice detective work.

On Mon, Aug 1, 2011 at 13:26, Crawford, Scott <[email protected]> wrote:
> Yeah, it’s more general than just the copy command. It’s pervasive across
> the whole OS.
>
>
>
> After re-reading the KB article, I realize that the fix described only
> applied to explorer.exe.  And, in fact, W2K3’s version of explorer is fixed.
> But, Win7 is (re)broken.  You can see this by running the batch I posted.
> Then, from explorer, create a *new* folder, and copy the long name
> (xxxxxxxxxx.xxx) file first and then the short name (xxxxxx~1.xxx). As you
> note, the second file will overwrite the first.
>
>
>
> It’s interesting to note that once the files have been copied in the
> “correct” order (ie files with only short names, followed by files with long
> and short names), the destination becomes “fixed” and subsequent copies work
> correctly. This can be seen in the batch below.
>
>
>
> Bottom line is that it appears that support for short file names is simply
> broken. There is a high potential for data loss when copying data that has
> file names in xxxxxx~1.xxx format, especially when using automatic
> overwriting common in tools such as robocopy /mir or even explorer.exe.
>
>
>
> Turning off short file name support does seem to be the best answer, but has
> the potential problem of breaking things that are hard-coded to look for the
> short name.
>
>
>
> -----------------------snip-----------------------
>
> md CollisionTest
>
> cd CollisionTest
>
> echo a > xxxxxx~1.xxx
>
> echo a > xxxxxxxxxx.xxx
>
> md new
>
> copy /y xxxxxxxxxx.xxx new
>
> copy /y xxxxxx~1.xxx new
>
> dir new /x
>
> @echo Note that "xxxxxx~1.xxx" is gone after copying the long file name
> first.
>
> pause
>
> del /q new
>
> copy /y xxxxxx~1.xxx new
>
> copy /y xxxxxxxxxx.xxx new
>
> dir new /x
>
> @echo Note that both files are there because we copied the short file name
> first.
>
> pause
>
> del /q new
>
> copy /y xxxxxxxxxx.xxx new
>
> copy /y xxxxxx~1.xxx new
>
> copy /y *.* new
>
> dir new /x
>
> @echo Note that both files are still there even though we copied the long
> file name first.
>
> -----------------------snip-----------------------
>
>
>
> From: Jeff Bunting [mailto:[email protected]]
> Sent: Saturday, July 30, 2011 9:09 AM
>
> To: NT System Admin Issues
> Subject: Re: Weird robocopy /mir bug?
>
>
>
> In your example, if you reverse the order of the echo commands you'll only
> end up with one file in the CollisionTest directory because the long file
> name version creates a short name of xxxxxx~1.xxx, so the act of copying
> isn't really the problem, but that you have different files with the same
> name (or same short name)
>
>
>
> echo a > xxxxxxxxxx.xxx  (creates short name xxxxxx~1.xxx)
>
> echo b > xxxxxx~1.xxx
>
>
>
> type xxxxxxxxxx.xxx
>
> b
>
>
>
>
>
> You might be able to use fsutil to strip the shortnames of the files you're
> copying without having to disable it on the whole volume:
>
>
>
> http://technet.microsoft.com/en-us/library/ff621566(WS.10).aspx
>
>
>
> Jeff
>
>
>
> On Fri, Jul 29, 2011 at 4:54 PM, Crawford, Scott <[email protected]>
> wrote:
>
> If you'd like to play along, the batch file below demonstrates the problem.
>  Note that we're creating two files, copying them to a new folder, but only
> one ends up at the end.  I really need to be able to use robocopy to do this
> copy to minimize the disruption to the users, but this is really jamming me
> up.
>
> -----------------snip-----------------
> md CollisionTest
> cd CollisionTest
> echo a > xxxxxx~1.xxx
> echo a > xxxxxxxxxx.xxx
> md new
> copy /y *.* new
> dir new
> -----------------snip-----------------
>
> -----Original Message-----
> From: Crawford, Scott [mailto:[email protected]]
>
> Sent: Friday, July 29, 2011 3:41 PM
> To: NT System Admin Issues
> Subject: RE: Weird robocopy /mir bug?
>
> Turns out that this issue was a known issue that was fixed in W2K SP3 and NT
> SP5.  Unfortunately it seems to be back.  Maybe I should spin up a W2K box
> to do this copy :) Anybody have any better options?
>
> http://support.microsoft.com/kb/195144
>
>
> -----Original Message-----
> From: Crawford, Scott [mailto:[email protected]]
> Sent: Thursday, July 28, 2011 7:33 PM
> To: NT System Admin Issues
> Subject: RE: Weird robocopy /mir bug?
>
> You mean short name generation on the server?  That's on my list of
> "desperation" ideas, mainly cuz I've never done it so I'm not sure exactly
> what the effects will be. Does that delete all existing short names?
>
> -----Original Message-----
> From: Kurt Buff [mailto:[email protected]]
> Sent: Thursday, July 28, 2011 6:42 PM
> To: NT System Admin Issues
> Subject: Re: Weird robocopy /mir bug?
>
> Turn off short filenames?
>
> On Thu, Jul 28, 2011 at 15:51, Crawford, Scott <[email protected]>
> wrote:
>> I’m having some strange problem where robocopy /mir doesn’t actually,
>> well…mirror.  I’m pretty sure it has something to do with short file
>> names.
>> The files that are causing problems are named:
>>
>>
>>
>> Short name   Long name
>>
>> OLIVER~1.WPD OLIVER-M.GD2.wpd
>>
>>              OLIVER-M.GRD
>>
>> OLIVER~3.WPD oliver-m.rec.wpd
>>
>>              OLIVER~2.WPD
>>
>>
>>
>> Due to the nature of the problem, I’m not sure which files are
>> actually causing the problem, but I believe it’s the last two listed.
>> It seems like there’s a name collision on OLIVER~2.WPD.
>>
>>
>>
>> I’ve posted the log below and also at www.evangel.edu/robocopy.txt for
>> better readability. I’ve run robocopy /mir 4 times so you can see how
>> it goes back and forth replacing existing files with new ones.
>>
>>
>>
>> I can’t for the life of me figure out what’s going on or more
>> importantly how to fix it. Any help is appreciated.
>>
>>
>>
>> E:\Staff\NelsonN\My Documents\WPDocs\profcorr\Rec\Letters>dir "Floppy
>> Disk 1\oli*.*" /x
>>
>> Volume in drive E is New Volume
>>
>> Volume Serial Number is B0B3-6FF9
>>
>>
>>
>> Directory of E:\Staff\NelsonN\My
>> Documents\WPDocs\profcorr\Rec\Letters\Floppy Disk 1
>>
>>
>>
>> 12/25/1999  06:36 PM            13,121 OLIVER~1.WPD OLIVER-M.GD2.wpd
>>
>> 03/15/1999  01:20 AM            12,684              OLIVER-M.GRD
>>
>> 03/15/1999  05:50 PM             8,803 OLIVER~3.WPD oliver-m.rec.wpd
>>
>> 12/25/1999  06:29 PM            10,367              OLIVER~2.WPD
>>
>>                4 File(s)         44,975 bytes
>>
>>                0 Dir(s)  61,758,398,464 bytes free
>>
>>
>>
>> E:\Staff\NelsonN\My Documents\WPDocs\profcorr\Rec\Letters>n:
>>
>>
>>
>> N:\Staff\NelsonN\My Documents\WPDocs\profcorr\Rec\Letters>e:
>>
>>
>>
>> E:\Staff\NelsonN\My Documents\WPDocs\profcorr\Rec\Letters>robocopy
>> "Floppy Disk 1" "n:Floppy Disk 1" /mir
>>
>>
>>
>> ----------------------------------------------------------------------
>> ---------
>>
>>    ROBOCOPY     ::     Robust File Copy for Windows
>>
>> ----------------------------------------------------------------------
>> ---------
>>
>>
>>
>>   Started : Thu Jul 28 12:03:13 2011
>>
>>
>>
>>    Source : E:\Staff\NelsonN\My
>> Documents\WPDocs\profcorr\Rec\Letters\Floppy
>> Disk 1\
>>
>>      Dest : N:\Staff\NelsonN\My
>> Documents\WPDocs\profcorr\Rec\Letters\Floppy
>> Disk 1\
>>
>>
>>
>>     Files : *.*
>>
>>
>>
>>   Options : *.* /S /E /COPY:DAT /PURGE /MIR /R:1000000 /W:30
>>
>>
>>
>> ----------------------------------------------------------------------
>> --------
>>
>>
>>
>>                           91    E:\Staff\NelsonN\My
>> Documents\WPDocs\profcorr\Rec\Letters\Floppy Disk 1\
>>
>> 100%        New File               10367        OLIVER~2.WPD
>>
>>
>>
>> ----------------------------------------------------------------------
>> --------
>>
>>
>>
>>                Total    Copied   Skipped  Mismatch    FAILED    Extras
>>
>>     Dirs :         1         0         1         0         0         0
>>
>>    Files :        91         1        90         0         0         0
>>
>>    Bytes :    1.01 m    10.1 k    1.00 m         0         0         0
>>
>>    Times :   0:00:00   0:00:00                       0:00:00   0:00:00
>>
>>
>>
>>    Ended : Thu Jul 28 12:03:13 2011
>>
>>
>>
>> E:\Staff\NelsonN\My Documents\WPDocs\profcorr\Rec\Letters>robocopy
>> "Floppy Disk 1" "n:Floppy Disk 1" /mir
>>
>>
>>
>> ----------------------------------------------------------------------
>> ---------
>>
>>    ROBOCOPY     ::     Robust File Copy for Windows
>>
>> ----------------------------------------------------------------------
>> ---------
>>
>>
>>
>>   Started : Thu Jul 28 12:03:15 2011
>>
>>
>>
>>    Source : E:\Staff\NelsonN\My
>> Documents\WPDocs\profcorr\Rec\Letters\Floppy
>> Disk 1\
>>
>>      Dest : N:\Staff\NelsonN\My
>> Documents\WPDocs\profcorr\Rec\Letters\Floppy
>> Disk 1\
>>
>>
>>
>>     Files : *.*
>>
>>
>>
>>   Options : *.* /S /E /COPY:DAT /PURGE /MIR /R:1000000 /W:30
>>
>>
>>
>> ----------------------------------------------------------------------
>> --------
>>
>>
>>
>>                           91    E:\Staff\NelsonN\My
>> Documents\WPDocs\profcorr\Rec\Letters\Floppy Disk 1\
>>
>> 100%        New File               10367        OLIVER~2.WPD
>>
>> 100%        Older                   8803        oliver-m.rec.wpd
>>
>>
>>
>> ----------------------------------------------------------------------
>> --------
>>
>>
>>
>>                Total    Copied   Skipped  Mismatch    FAILED    Extras
>>
>>     Dirs :         1         0         1         0         0         0
>>
>>    Files :        91         2        89         0         0         0
>>
>>    Bytes :    1.01 m    18.7 k  1016.1 k         0         0         0
>>
>>    Times :   0:00:00   0:00:00                       0:00:00   0:00:00
>>
>>
>>
>>    Ended : Thu Jul 28 12:03:15 2011
>>
>>
>>
>> E:\Staff\NelsonN\My Documents\WPDocs\profcorr\Rec\Letters>robocopy
>> "Floppy Disk 1" "n:Floppy Disk 1" /mir
>>
>>
>>
>> ----------------------------------------------------------------------
>> ---------
>>
>>    ROBOCOPY     ::     Robust File Copy for Windows
>>
>> ----------------------------------------------------------------------
>> ---------
>>
>>
>>
>>   Started : Thu Jul 28 12:03:16 2011
>>
>>
>>
>>    Source : E:\Staff\NelsonN\My
>> Documents\WPDocs\profcorr\Rec\Letters\Floppy
>> Disk 1\
>>
>>      Dest : N:\Staff\NelsonN\My
>> Documents\WPDocs\profcorr\Rec\Letters\Floppy
>> Disk 1\
>>
>>
>>
>>     Files : *.*
>>
>>
>>
>>   Options : *.* /S /E /COPY:DAT /PURGE /MIR /R:1000000 /W:30
>>
>>
>>
>> ----------------------------------------------------------------------
>> --------
>>
>>
>>
>>                           91    E:\Staff\NelsonN\My
>> Documents\WPDocs\profcorr\Rec\Letters\Floppy Disk 1\
>>
>> 100%        New File               10367        OLIVER~2.WPD
>>
>>
>>
>> ----------------------------------------------------------------------
>> --------
>>
>>
>>
>>                Total    Copied   Skipped  Mismatch    FAILED    Extras
>>
>>     Dirs :         1         0         1         0         0         0
>>
>>    Files :        91         1        90         0         0         0
>>
>>    Bytes :    1.01 m    10.1 k    1.00 m         0         0         0
>>
>>    Times :   0:00:00   0:00:00                       0:00:00   0:00:00
>>
>>
>>
>>    Ended : Thu Jul 28 12:03:16 2011
>>
>>
>>
>> E:\Staff\NelsonN\My Documents\WPDocs\profcorr\Rec\Letters>robocopy
>> "Floppy Disk 1" "n:Floppy Disk 1" /mir
>>
>>
>>
>> ----------------------------------------------------------------------
>> ---------
>>
>>    ROBOCOPY     ::     Robust File Copy for Windows
>>
>> ----------------------------------------------------------------------
>> ---------
>>
>>
>>
>>   Started : Thu Jul 28 12:03:17 2011
>>
>>
>>
>>    Source : E:\Staff\NelsonN\My
>> Documents\WPDocs\profcorr\Rec\Letters\Floppy
>> Disk 1\
>>
>>      Dest : N:\Staff\NelsonN\My
>> Documents\WPDocs\profcorr\Rec\Letters\Floppy
>> Disk 1\
>>
>>
>>
>>     Files : *.*
>>
>>
>>
>>   Options : *.* /S /E /COPY:DAT /PURGE /MIR /R:1000000 /W:30
>>
>>
>>
>> ----------------------------------------------------------------------
>> --------
>>
>>
>>
>>                           91    E:\Staff\NelsonN\My
>> Documents\WPDocs\profcorr\Rec\Letters\Floppy Disk 1\
>>
>> 100%        New File               10367        OLIVER~2.WPD
>>
>> 100%        Older                   8803        oliver-m.rec.wpd
>>
>>
>>
>> ----------------------------------------------------------------------
>> --------
>>
>>
>>
>>                Total    Copied   Skipped  Mismatch    FAILED    Extras
>>
>>     Dirs :         1         0         1         0         0         0
>>
>>    Files :        91         2        89         0         0         0
>>
>>    Bytes :    1.01 m    18.7 k  1016.1 k         0         0         0
>>
>>    Times :   0:00:00   0:00:00                       0:00:00   0:00:00
>>
>>
>>
>>    Ended : Thu Jul 28 12:03:17 2011
>>
>>
>>
>> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~
>> <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>>
>> ---
>> To manage subscriptions click here:
>> http://lyris.sunbelt-software.com/read/my_forums/
>> or send an email to [email protected]
>> with the body: unsubscribe ntsysadmin
>
> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~
> <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>
> ---
> To manage subscriptions click here:
> http://lyris.sunbelt-software.com/read/my_forums/
> or send an email to [email protected]
> with the body: unsubscribe ntsysadmin
>
> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~
> <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>
> ---
> To manage subscriptions click here:
> http://lyris.sunbelt-software.com/read/my_forums/
> or send an email to [email protected]
> with the body: unsubscribe ntsysadmin
>
> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~
> <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>
> ---
> To manage subscriptions click here:
> http://lyris.sunbelt-software.com/read/my_forums/
> or send an email to [email protected]
> with the body: unsubscribe ntsysadmin
>
> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
> ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>
> ---
> To manage subscriptions click here:
> http://lyris.sunbelt-software.com/read/my_forums/
> or send an email to [email protected]
> with the body: unsubscribe ntsysadmin
>
>
>
> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
> ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>
> ---
> To manage subscriptions click here:
> http://lyris.sunbelt-software.com/read/my_forums/
> or send an email to [email protected]
> with the body: unsubscribe ntsysadmin
>
> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
> ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>
> ---
> To manage subscriptions click here:
> http://lyris.sunbelt-software.com/read/my_forums/
> or send an email to [email protected]
> with the body: unsubscribe ntsysadmin

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

Reply via email to