Project

General

Profile

Bug #10245

OS-COPY removes the file

Added by Teodor Gorghe about 1 year ago. Updated about 1 year ago.

Status:
Test
Priority:
Normal
Assignee:
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
production:
No
env_name:
topics:

History

#2 Updated by Teodor Gorghe about 1 year ago

When using OS-COPY with the same source and target, FWD removes this file from the filesystem.
This test illustrate this issue:

    @Test.
    method public void TestCopySameSourceTarget ():
        os-copy value('tests~/base_language~/builtin_functions~/support~/EncodeA.txt') value('tests~/base_language~/builtin_functions~/support~/OsCopy.txt').
        AssertFile:FileExists('tests~/base_language~/builtin_functions~/support~/OsCopy.txt').
        Assert:IsZero(os-error).

        os-copy value('tests~/base_language~/builtin_functions~/support~/OsCopy.txt') value('tests~/base_language~/builtin_functions~/support~/OsCopy.txt').
        /* The test fails here and the file has been removed. */
        Assert:IsZero(os-error).
        AssertFile:FileExists('tests~/base_language~/builtin_functions~/support~/OsCopy.txt').

        os-delete value('tests~/base_language~/builtin_functions~/support~/OsCopy.txt').
        Assert:IsZero(os-error).
    end method.

#3 Updated by Teodor Gorghe about 1 year ago

  • Status changed from New to WIP
  • Assignee set to Teodor Gorghe

Created task branch 10245a.

#4 Updated by Teodor Gorghe about 1 year ago

  • % Done changed from 0 to 100
  • reviewer Constantin Asofiei added

Committed revision 16023 in task branch 10245a:
- When the target path is the same with the source path, the FileSystemDaemon.copy should return ERR_NO_ERROR.

#5 Updated by Teodor Gorghe about 1 year ago

  • Status changed from WIP to Review

#6 Updated by Constantin Asofiei about 1 year ago

  • Project changed from Runtime Infrastructure to Base Language

#7 Updated by Constantin Asofiei about 1 year ago

What about case-insensitivity on Windows?

#8 Updated by Teodor Gorghe about 1 year ago

Constantin Asofiei wrote:

What about case-insensitivity on Windows?

I have made a simple Java application, which uses the file.getCanonicalPath(). I have compiled and ran it on Windows.
If the file exists, this function will return the actual filename. For example, if I pass "TeSt.txt", but the filename is actually "Test.txt", if the file exists, then file.getCanonicalPath() returns "..Test.txt". If the file does not exist, the returned value from file.getCanonicalPath() is "...TeSt.txt".

#9 Updated by Constantin Asofiei about 1 year ago

  • Status changed from Review to Internal Test

OK, I think it makes sense. The problem is when both source and target exists, and in this case, getCanonicalPath is used, and this returns the actual filename and paths on the filesystem; and is ok to use equals in this case.

Please merge to trunk now.

#10 Updated by Constantin Asofiei about 1 year ago

  • Status changed from Internal Test to Merge Pending

#11 Updated by Teodor Gorghe about 1 year ago

Branch 10245a was merged to trunk rev 16028 and archived.

#12 Updated by Teodor Gorghe about 1 year ago

  • Status changed from Merge Pending to Test

Also available in: Atom PDF