--hardlink option produce traceback on Windows

Bug #209912 reported by Alexander Belchenko
10
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned
Breezy
Triaged
Medium
Unassigned

Bug Description

0.125 encoding stdout as sys.stdout encoding 'cp866'
0.125 bzr arguments: [u'branch', u'eol', u'sha1.eol', u'--hardlink']
0.125 looking for plugins in C:\work\Bazaar\plugins-repo
0.297 looking for plugins in C:/Program Files/Bazaar/plugins
0.297 encoding stdout as sys.stdout encoding 'cp866'
0.406 opening working tree 'C:/work/Bazaar/mydev.packs/eol'
0.531 opening working tree 'C:/work/Bazaar/mydev.packs/eol'
0.547 created control directory in file:///C:/work/Bazaar/mydev.packs/sha1.eol/
0.672 creating branch <bzrlib.branch.BzrBranchFormat6 object at 0x00EFA210> in file:///C:/work/Bazaar/mydev.packs/sha1.eol/.bzr/
1.156 trying to create missing lock 'C:/work/Bazaar/mydev.packs/sha1.eol/.bzr/checkout/dirstate'
1.156 opening working tree 'C:/work/Bazaar/mydev.packs/sha1.eol'
3.578 Traceback (most recent call last):
  File "bzrlib\commands.pyc", line 834, in run_bzr_catch_errors
  File "bzrlib\commands.pyc", line 790, in run_bzr
  File "bzrlib\commands.pyc", line 492, in run_argv_aliases
  File "bzrlib\builtins.pyc", line 927, in run
  File "bzrlib\bzrdir.pyc", line 957, in sprout
  File "bzrlib\bzrdir.pyc", line 1242, in create_workingtree
  File "bzrlib\workingtree_4.pyc", line 1358, in initialize
  File "bzrlib\transform.pyc", line 1494, in build_tree
  File "bzrlib\transform.pyc", line 1584, in _build_tree
  File "bzrlib\transform.pyc", line 1624, in _create_files
  File "bzrlib\transform.pyc", line 361, in create_hardlink
AttributeError: 'module' object has no attribute 'link'

3.656 return code 4

Tags: win32 hardlink
Revision history for this message
John A Meinel (jameinel) wrote :

Seems like we are blindly trying to hard link.

If we wanted, we could try using the win32 apis for doing NTFS hard links.
Alternatively, we could detect "getattr(os, 'link', None) is None" and abort with a BzrCommandError that the user requested --hardlink on a platform without support for it.

Changed in bzr:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Aaron Bentley (abentley) wrote :

IME, Windows uses the standard Python API for hard linking. That may only work on Python 2.5.

Revision history for this message
John A Meinel (jameinel) wrote :

IME? Did you mean IIRC? As I understand, os.link() has not been implement for python on win32, but I could be wrong.

I was thinking of using:
  win32file.CreateHardLink(dst, src)

Revision history for this message
Aaron Bentley (abentley) wrote : Re: [Bug 209912] Re: --hardlink option produce traceback on Windows

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John A Meinel wrote:
> IME? Did you mean IIRC? As I understand, os.link() has not been
> implement for python on win32, but I could be wrong.

I tested the --hardlink code under win32, and to my great surprise, it
worked.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIEP920F+nu1YWqI0RAh0OAKCAcsilPqhJd6Vo4iz1waCDppgXLACeN3QB
v+jY2Hz3A8xplnh45yIzc5c=
=Ew3G
-----END PGP SIGNATURE-----

Revision history for this message
Jay R. Wren (evarlast) wrote :

It doesn't work here. I still get an error. This is on Win7 Beta1 build 7000, but I don't think the hardlink api has changed since Vista.
--

$ bzr branch . ../SS --hardlink
bzr: ERROR: exceptions.AttributeError: 'module' object has no attribute 'link'

Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 893, in run_bzr_catch_errors
  File "bzrlib\commands.pyo", line 839, in run_bzr
  File "bzrlib\commands.pyo", line 539, in run_argv_aliases
  File "bzrlib\builtins.pyo", line 1038, in run
  File "bzrlib\bzrdir.pyo", line 1127, in sprout
  File "bzrlib\bzrdir.pyo", line 1441, in create_workingtree
  File "bzrlib\workingtree_4.pyo", line 1389, in initialize
  File "bzrlib\transform.pyo", line 2033, in build_tree
  File "bzrlib\transform.pyo", line 2125, in _build_tree
  File "bzrlib\transform.pyo", line 2168, in _create_files
  File "bzrlib\transform.pyo", line 392, in create_hardlink
AttributeError: 'module' object has no attribute 'link'

bzr 1.11rc1 on python 2.5.2 (win32)
arguments: ['c:\\Program Files (x86)\\Bazaar\\bzr.exe', 'branch', '.', '../SS', '--hardlink']
encoding: 'cp1252', fsenc: 'mbcs', lang: None
plugins:
  bzrtools C:\Program Files (x86)\Bazaar\plugins\bzrtools [1.11]
  launchpad C:\Program Files (x86)\Bazaar\plugins\launchpad [unknown]
  netrc_credential_store C:\Program Files (x86)\Bazaar\plugins\netrc_credential_store [unknown]
  qbzr C:\Program Files (x86)\Bazaar\plugins\qbzr [0.9.6]
  svn C:\Program Files (x86)\Bazaar\plugins\svn [0.4.17]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Martin Pool (mbp)
Changed in bzr:
status: Triaged → Confirmed
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
tags: added: hardlink
removed: check-for-breezy
Changed in brz:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.