[issue2543] os.unlink deletes wrong file on windows share served by Samba

Adrian Buehlmann bugs at mercurial.selenic.com
Sat Dec 11 16:40:58 UTC 2010


New submission from Adrian Buehlmann <adrian at cadifra.com>:

Windows 7 x64 client, drive Y: on client is mapped to a CIFS/SMB share served
by a Samba server running on a FreeBSD box.

On the FreeBSD box:

  %uname -r
  6.2-RELEASE
  %smbd -V
  Version 3.0.26a

On the Windows 7 client in cmd.exe:

  $ cd
  Y:\

Current directory is empty:

  $ dir /w
   Volume in drive Y is adi
   Volume Serial Number is 0691-010D

   Directory of Y:\

  [.]  [..]
                 0 File(s)              0 bytes
                 2 Dir(s)  19'348'033'536 bytes free

Create file a.txt using python:

  $ python
  Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32
  Type "help", "copyright", "credits" or "license" for more information.
  >>> from mercurial.windows import posixfile
  >>> fd = posixfile('a.txt', 'w')
  >>> fd.close()

Create hardlinked a.link.txt, linked to a.txt:

  >>> from win32file import CreateHardLink
  >>> CreateHardLink('a.link.txt', 'a.txt')

Open a.txt for reading:

  >>> fd = posixfile('a.txt')
  
Delete a.link.txt and close handle on a.txt:

  >>> import os
  >>> os.unlink('a.link.txt')
  >>> fd.close()
  >>> exit()

Now, file a.txt is gone (!) instead of a.link.txt (HORRIBLY WRONG):

  $ dir /w
   Volume in drive Y is adi
   Volume Serial Number is 0691-010D

   Directory of Y:\

  [.]          [..]         a.link.txt
                 1 File(s)              0 bytes
                 2 Dir(s)  19'348'033'536 bytes free

----------
messages: 14611
nosy: abuehl
priority: bug
status: unread
title: os.unlink deletes wrong file on windows share served by Samba

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2543>
____________________________________________________


More information about the Mercurial-devel mailing list