Skip to content

Unable to edit config file on network drive #226

Closed

Description

@nalla

The following command-chain works with 2.4.4 but not with 2.4.5. It works with a local drive like C:\ alright.

Steps to reproduce

cd /usr/src/git && git pull && git checkout -t origin/rebase-to-2.4.5
make clean && make -j8
# Map a network share to X:
rm -f X:/test
./git config -f X:\test svn-remote.svn.branches-maxRev 1
# -> succeeds
./git config -f X:\test svn-remote.svn.branches-maxRev 1
# -> fails with Rename from 'X:/test.lock' to 'X:/test' failed. Should I try again? (y/n)
git checkout v2.4.4.windows.2
make clean && make -j8
rm -f X:/test
./git config -f X:\test svn-remote.svn.branches-maxRev 1
# -> succeeds
./git config -f X:\test svn-remote.svn.branches-maxRev 1
# -> succeeds

Analysis

The error messages comes from mingw_rename function in compat/mingw.c. But git diff v2.4.4.windows.2..rebase-to-2.4.5 compat/mingw.c is empty. Maybe git diff v2.4.4.windows.2..rebase-to-2.4.5 config.c is the cause then.

I humble ask if anyone can reproduce this bug.

Activity

  1. nalla commented on Jun 30, 2015

    @nalla
    Author

    So far I found out that somehow the close for the test file is delayed or not even executed at all. See the procmon analysis below. The MoveFileExW function returns SHARING_VIOLATION, as seen in the trace below. What i did track down is that the close call that is being executed before lockfile.c even tries to rename the file is this one. @kblees since you refactored the renaming in mingw.c - maybe you have any ideas?

    "Time of Day","Process Name","PID","Operation","Path","Result","Detail"
    "11:18:35,5242466","git.exe","8108","CreateFile","\\remote.host\test\test.lock","SUCCESS","Desired Access: Read Attributes, Delete, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Open For Backup, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened"
    "11:18:35,5252744","git.exe","8108","QueryAttributeTagFile","\\remote.host\test\test.lock","SUCCESS","Attributes: A, ReparseTag: 0x0"
    "11:18:35,5253114","git.exe","8108","QueryBasicInformationFile","\\remote.host\test\test.lock","SUCCESS","CreationTime: 30.06.2015 11:10:18, LastAccessTime: 30.06.2015 11:16:16, LastWriteTime: 30.06.2015 11:16:16, ChangeTime: 30.06.2015 11:16:16, FileAttributes: A"
    "11:18:35,5302017","git.exe","8108","CreateFile","\\remote.host\test","SUCCESS","Desired Access: Write Data/Add File, Synchronize, Disposition: Open, Options: Open For Backup, Attributes: n/a, ShareMode: Read, Write, AllocationSize: n/a, OpenResult: Superseded"
    "11:18:35,5357504","git.exe","8108","SetRenameInformationFile","\\remote.host\test\test.lock","SHARING VIOLATION","ReplaceIfExists: True, FileName: \\remote.host\test\test"
    "11:18:35,5358329","git.exe","8108","CloseFile","\\remote.host\test\test.lock","SUCCESS",""
    "11:18:35,5435852","git.exe","8108","CreateFile","\\remote.host\test\test","SUCCESS","Desired Access: Write Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Open For Backup, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened"
    "11:18:35,5443905","git.exe","8108","SetBasicInformationFile","\\remote.host\test\test","SUCCESS","CreationTime: 01.01.1601 02:00:00, LastAccessTime: 01.01.1601 02:00:00, LastWriteTime: 01.01.1601 02:00:00, ChangeTime: 01.01.1601 02:00:00, FileAttributes: AN"
    "11:18:35,5455575","git.exe","8108","CloseFile","\\remote.host\test\test","SUCCESS",""
    "11:18:35,5603613","git.exe","8108","CreateFile","\\remote.host\test\test","SUCCESS","Desired Access: Read Attributes, Disposition: Open, Options: Open For Backup, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened"
    "11:18:35,5610020","git.exe","8108","QueryBasicInformationFile","\\remote.host\test\test","SUCCESS","CreationTime: 29.06.2015 12:26:05, LastAccessTime: 29.06.2015 12:26:05, LastWriteTime: 29.06.2015 12:26:05, ChangeTime: 30.06.2015 11:18:35, FileAttributes: A"
    "11:18:35,5610244","git.exe","8108","CloseFile","\\remote.host\test\test","SUCCESS",""
    "11:20:31,8243699","git.exe","8108","CreateFile","\\remote.host\test\test.lock","SUCCESS","Desired Access: Read Attributes, Disposition: Open, Options: Open For Backup, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened"
    "11:20:31,8252595","git.exe","8108","QueryBasicInformationFile","\\remote.host\test\test.lock","SUCCESS","CreationTime: 30.06.2015 11:10:18, LastAccessTime: 30.06.2015 11:16:16, LastWriteTime: 30.06.2015 11:16:16, ChangeTime: 30.06.2015 11:16:16, FileAttributes: A"
    "11:20:31,8252778","git.exe","8108","CloseFile","\\remote.host\test\test.lock","SUCCESS",""
    "11:20:31,8318213","git.exe","8108","CreateFile","\\remote.host\test\test.lock","SUCCESS","Desired Access: Write Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Open For Backup, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened"
    "11:20:31,8328637","git.exe","8108","SetBasicInformationFile","\\remote.host\test\test.lock","SUCCESS","CreationTime: 01.01.1601 02:00:00, LastAccessTime: 01.01.1601 02:00:00, LastWriteTime: 01.01.1601 02:00:00, ChangeTime: 01.01.1601 02:00:00, FileAttributes: AN"
    "11:20:31,8338574","git.exe","8108","CloseFile","\\remote.host\test\test.lock","SUCCESS",""
    "11:20:31,8410566","git.exe","8108","CreateFile","\\remote.host\test\test.lock","SUCCESS","Desired Access: Read Attributes, Delete, Disposition: Open, Options: Non-Directory File, Open For Backup, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened"
    "11:20:31,8422082","git.exe","8108","QueryAttributeTagFile","\\remote.host\test\test.lock","SUCCESS","Attributes: A, ReparseTag: 0x0"
    "11:20:31,8422277","git.exe","8108","SetDispositionInformationFile","\\remote.host\test\test.lock","SUCCESS","Delete: True"
    "11:20:31,8427819","git.exe","8108","CloseFile","\\remote.host\test\test.lock","SUCCESS",""
    
    
  2. nalla commented on Jun 30, 2015

    @nalla
    Author

    Nailed it!
    The issue is with commit 3a1b312. The problem is that munmap(contents, contents_sz); moved past the commit_lock_file(lock) call. That seems to be a problem for files that are on windows shares. git.exe still holds a handle to device\mup\file_in_question

  3. kblees commented on Jun 30, 2015

    @kblees

    Dito 😄

    See #229

  4. nalla commented on Jun 30, 2015

    @nalla
    Author

    Yes! just saw that reference showing up right before clicking on comment ;)

  5. dscho commented on Jun 30, 2015

    @dscho
    Member

    Thanks, both!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions