Can't add files when branch at the root of some drive (on Windows)

Bug #322807 reported by Ernst on 2009-01-29
34
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
High
John A Meinel

Bug Description

I'm running Windows XP SP3 with Bazaar Setup 1.11.1.
I've checked out an existing repository. I wanted to add some files. It doesn't matter if I use the command line or GUI, but if I type:

bzr add Computer

I get:
bzr: ERROR: No such file: u'F:/omputer'

So, the first character of Computer is ignored! Therefore, i cannot commit any file. For your info: F:\ is also 'My Documents'

do 2009-01-29 17:15:16 +0100
0.078 bzr arguments: [u'add', u'Computer']
0.078 looking for plugins in C:/Documents and Settings/<user>/Application Data/bazaar/2.0/plugins
0.078 looking for plugins in C:/Program Files/Bazaar/plugins
0.141 bzr-svn: using Subversion 1.5.4 ()
0.157 encoding stdout as sys.stdout encoding 'cp850'
0.235 opening SVN RA connection to 'file:///F:/Computer'
0.235 Unable to open <bzrlib.transport.local.LocalTransport url=file:///F:/Computer/> with Subversion: Unable to open an ra_local session to URL
0.250 opening working tree 'F:/'
0.266 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 513, in run
  File "bzrlib\mutabletree.pyo", line 52, in tree_write_locked
  File "bzrlib\mutabletree.pyo", line 372, in smart_add
  File "bzrlib\osutils.pyo", line 1695, in file_kind
NoSuchFile: No such file: u'F:/omputer'

Related branches

Marius Kruger (amanica) wrote :

this sounds quit serious to me.
I saw on #324494 that a workaround may be to prefix a bogus letter to the file name.
I'm marking this as confirmed because somebody else also reported it.

Marius Kruger (amanica) on 2009-02-05
Changed in bzr:
importance: Undecided → High
status: New → Confirmed
Marius Kruger (amanica) wrote :

from #326553 it appears that this only happen in the drive root directory

After I read your comment, I want to confirm this. I tested bzr on my private Windows XP installation and everything works, if the repository is not within the root directory of one drive.

Alexander Röhnsch (roehnsch) wrote :

I confirm the bug to be persistent in Bazaar 1.17 for Windows.

The chopping behaviour occurs when a branch lies directly in a root directory, e.g. "S:\".

Alexander Belchenko (bialix) wrote :

What a wonderful bug. Smells very bad, and close to critical than to high.

summary: - Adding files on Windows fails because first character is ignored
+ Can't add files when branch at the root of some drive (on Windows)
tags: added: win32
Jason Spashett (jspashett) wrote :

Is this only on add or on other operations?

Also this bug can be manifested though a subst drive. e.g.

branch at:

c:\temp\test1

subst t: c:\temp\test1

T:\>echo > fish2

T:\>bzr add fish2
bzr: ERROR: No such file: u'T:/ish2'

Jason Spashett (jspashett) wrote :

In _cicp_canonical_relpath (osutils.py)

This is done:
return current[len(abs_base)+1:]

Can we not just use os.path.split instead?

>>> import os
>>> os.path.split("t:/fish")
('t:/', 'fish')
>>> os.path.split("t:/and/chips/fish")
('t:/and/chips', 'fish')
>>> os.path.split("fish")
('', 'fish')
>>>

C:\bzr\bazaar\trunk>bzr diff
=== modified file 'bzrlib/osutils.py'
--- bzrlib/osutils.py 2009-07-23 16:01:17 +0000
+++ bzrlib/osutils.py 2009-10-02 23:15:55 +0000
@@ -1093,7 +1093,7 @@
             # the target of a move, for example).
             current = pathjoin(current, bit, *list(bit_iter))
             break
- return current[len(abs_base)+1:]
+ return os.path.split(current)[1]

 # XXX - TODO - we need better detection/integration of case-insensitive
 # file-systems; Linux often sees FAT32 devices (or NFS-mounted OSX

Changed in bzr:
assignee: nobody → Jason Spashett (jspashett)
status: Confirmed → In Progress
John A Meinel (jameinel) on 2009-10-06
Changed in bzr:
assignee: Jason Spashett (jspashett) → John A Meinel (jameinel)
milestone: none → 2.0.1
John A Meinel (jameinel) on 2009-10-06
Changed in bzr:
status: In Progress → Fix Committed
Andrew Bennetts (spiv) wrote :

This fix has now landed in both lp:bzr and lp:bzr/2.0.

Changed in bzr:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers