Bug 2543 - os.unlink deletes wrong file on windows share served by Samba
Summary: os.unlink deletes wrong file on windows share served by Samba
Status: RESOLVED ARCHIVED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: PC Windows
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-11 10:40 UTC by Adrian Buehlmann
Modified: 2014-07-31 13:23 UTC (History)
2 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Buehlmann 2010-12-11 10:40 UTC
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
Comment 1 Adrian Buehlmann 2010-12-11 11:38 UTC
See also the thread

http://mercurial.markmail.org/thread/a734pihauca2bjmf

"disappearing repo history on samba server" started Joel B. Mohler
Comment 2 Adrian Buehlmann 2010-12-12 04:48 UTC
The same use case works fine (no bug) if the share is served by
a second Windows 7 x64 computer.
Comment 3 Adrian Buehlmann 2010-12-12 08:18 UTC
Bug reproduced with Windows 7 x64 client and a more recent

  Samba 3.4.7

running on Ubuntu 10.04 LTS (which was running in a VM)
Comment 4 Adrian Buehlmann 2010-12-12 12:46 UTC
Bug is also reproducible with Samba 3.5.4
Comment 5 Adrian Buehlmann 2010-12-13 06:21 UTC
Bug is also present with latest stable Samba 3.5.6
(compiled from source on Ubuntu 10.10 Maverick)
Comment 6 Matt Mackall 2010-12-13 11:08 UTC
Submitted to the Samba BTS:

https://bugzilla.samba.org/show_bug.cgi?id=7863
Comment 7 Adrian Buehlmann 2010-12-22 14:35 UTC
Uploaded client wireshark trace and server log to the Samba bugtracker
(as requested there by Jeremy Allison)
Comment 8 Bugzilla 2012-05-12 09:15 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:15 EDT  ---

This bug was previously known as _bug_ 2543 at http://mercurial.selenic.com/bts/issue2543
Comment 9 Matt Mackall 2014-07-25 17:23 UTC
Bulk close: no activity for >2 years -> WONTFIX
Comment 10 Matt Mackall 2014-07-31 13:23 UTC
Bulk change recent WONTFIX -> new, more descriptive ARCHIVED state (sorry for the spam)