bzr commit FILE breaks when given symlink as argument

Bug #128562 reported by James Troup
62
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Martin Pool
2.0
Fix Released
Medium
Unassigned
2.1
Fix Released
Undecided
Unassigned
2.2
Fix Released
Undecided
Unassigned
bzr (Ubuntu)
Fix Released
Undecided
Unassigned
Lucid
Fix Released
Undecided
Unassigned

Bug Description

/etc# bzr commit -m "lala" alternatives/spi_connect.7.gz
bzr: ERROR: Not a branch: /usr/share/postgresql/8.1/man/man7/spi_connect.7.gz/
/etc# ls -l alternatives/spi_connect.7.gz
lrwxrwxrwx 1 root root 51 Jul 24 10:50 alternatives/spi_connect.7.gz -> /usr/share/postgresql/8.1/man/man7/spi_connect.7.gz
/etc#

If I run bzr commit without specifying the filename, it works just fine.

Related branches

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

Specifically, this is related to bug #32669. And relates to our overall decisions as to when to dereference a symlink, and when not to.
In this case, we are dereferencing right away, and so we look at the target of the symlink and start searching for a branch there.
Most likely this is because we are opening a transport using a 'base' of the symlink, which causes us to dereference it. And then when we start walking up from there, we are walking the wrong location.

Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Nick Moffitt (nick-moffitt) wrote :

I can verify that this problem is still present in version 1.11. Steps to reproduce are exactly the same: Specify a symlink that points outside the tree, or a directory containing such symlinks, and bzr refuses to commit.

Revision history for this message
Martin Pool (mbp) wrote :

I think this is distinct from the core bug 32669, though there are some comments #8 #11 that are hitting this. In bzr 2.2 you get "Error: not a branch" in open_containing_from transport called by internal_tree_files, which calls osutils.realpath on the first file name.

tags: added: commit symlink
Revision history for this message
Martin Pool (mbp) wrote :

jam and I are working on this.

Changed in bzr:
status: Confirmed → In Progress
assignee: nobody → Martin Pool (mbp)
Revision history for this message
Martin Pool (mbp) wrote :

This is the basic fix:

=== modified file 'bzrlib/builtins.py'
--- bzrlib/builtins.py 2010-03-08 13:12:55 +0000
+++ bzrlib/builtins.py 2010-07-16 10:27:37 +0000
@@ -172,7 +172,7 @@
                 view_str = views.view_display_str(view_files)
                 note("Ignoring files outside view. View is %s" % view_str)
         return tree, file_list
- tree = WorkingTree.open_containing(osutils.realpath(file_list[0]))[0]
+ tree = WorkingTree.open_containing(file_list[0])[0]
     return tree, safe_relpath_files(tree, file_list, canonicalize,
         apply_view=apply_view)

Vincent Ladeuil (vila)
Changed in bzr:
status: In Progress → Fix Released
Revision history for this message
Clint Byrum (clint-fewbar) wrote : Please test proposed package

Accepted bzr into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in bzr (Ubuntu Lucid):
status: New → Fix Committed
tags: added: verification-needed
Jelmer Vernooij (jelmer)
Changed in bzr (Ubuntu):
status: New → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bzr - 2.1.4-0ubuntu1

---------------
bzr (2.1.4-0ubuntu1) lucid-proposed; urgency=low

  * Update watch file to use 2.1 series.
  * New upstream release.
   + Fix file descriptors leaks in dirstate compiled extension. LP: #583486
   + Refuse to stack on repositories in incompatible formats. LP: #562380
   + Don't delete nested trees/repos. LP: #572098
   + Fix 'bzr switch' crash when a 'ConfigurableFileMerger' is used. LP: #559436
   + Fix compatibility with older smart servers. LP: #528041
   + Fix symlinks addition. LP: #192859
   + Properly unversion children of unversioned directories. LP: #494221
   + Lock configuration files in '~/.bazaar' for updates. LP: #525571
   + Fix 'bzr commit <symlink>'. LP: #128562
   + Fix `lp:` urls when behind an http proxy. LP: #558343
   + Stop using edge.launchpad.net. LP: #583667
 -- Max Bowsher <email address hidden> Tue, 17 May 2011 09:54:17 +0100

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

Other bug subscribers

Remote bug watches

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