symlinks not handled correctly

Bug #118461 reported by Václav Šmilauer
4
Affects Status Importance Assigned to Milestone
Bazaar GTK+ Frontends
Fix Released
Low
Szilveszter Farkas

Bug Description

I have the directory ~/yt which is symlink to ~/yade/trunk. If I run olive-gtk and then cd to yt via the file browser, I get the following error in terminal:

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/olive/__init__.py", line 538, in on_treeview_right_row_activated
    self.refresh_right()
  File "/usr/lib/python2.5/site-packages/olive/__init__.py", line 840, in refresh_right
    filename = tree1.relpath(path + os.sep + item)
  File "/usr/lib/python2.5/site-packages/bzrlib/workingtree.py", line 464, in relpath
    return osutils.relpath(self.basedir, path)
  File "/usr/lib/python2.5/site-packages/bzrlib/osutils.py", line 866, in relpath
    raise errors.PathNotChild(rp, base)
bzrlib.errors.PathNotChild: Path '/home/eudoxos/yt/ChangeLog' is not a child of path u'/home/eudoxos/yade/trunk'

That means that the directory path is canonicalized (/home/eudoxos/yade/trunk), while the filename uses symlink (/home/eudoxos/yt/ChangeLog, canonical form is /home/eudoxos/yade/trunk/ChangeLog). Therefore the algorithm for finding relative path fails.

Tags: olive
Revision history for this message
Szilveszter Farkas (phanatic) wrote :

Thanks for the report, Václav!

Changed in bzr-gtk:
importance: Undecided → Low
status: Unconfirmed → Confirmed
Changed in bzr-gtk:
assignee: nobody → phanatic
Revision history for this message
Jasper Groenewegen (colbrac) wrote :

This still isn't fixed in current trunk (531):

Case: symlink to stand-alone branch (or how do you call it? Anyway, the .bzr folder contains the history).
- Jumping to folder by changing entry in adress bar + double-clicking on symlink in right window changes view to folder but doesn't show any of the version-controlled files present. Going directly to the folder that is being symlinked works like it should.

Case: symlink to a branch in a repo (so .bzr folder does not contain the history)
- Jumping to folder by changing entry in adress bar does the same as above
- Double-clicking on symlink in right window does nothing

Error message for symlink of repo:
Traceback (most recent call last):
  File "/home/jasper/.bazaar/plugins/gtk/olive/__init__.py", line 913, in on_treeview_right_row_activated
    self.set_path(fullpath)
  File "/home/jasper/.bazaar/plugins/gtk/olive/__init__.py", line 311, in set_path
    self.wt, self.wtpath = WorkingTree.open_containing(path)
  File "/usr/lib/python2.5/site-packages/bzrlib/workingtree.py", line 325, in open_containing
    return control.open_workingtree(), relpath
  File "/usr/lib/python2.5/site-packages/bzrlib/bzrdir.py", line 1388, in open_workingtree
    return format.open(self, _found=True)
  File "/usr/lib/python2.5/site-packages/bzrlib/workingtree.py", line 2842, in open
    wt = self._open(a_bzrdir, self._open_control_files(a_bzrdir))
  File "/usr/lib/python2.5/site-packages/bzrlib/workingtree_4.py", line 1377, in _open
    branch=a_bzrdir.open_branch(),
  File "/usr/lib/python2.5/site-packages/bzrlib/bzrdir.py", line 1371, in open_branch
    return format.open(self, _found=True)
  File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 1213, in open
    _repository=a_bzrdir.find_repository())
  File "/usr/lib/python2.5/site-packages/bzrlib/bzrdir.py", line 561, in find_repository
    raise errors.NoRepositoryPresent(self)
bzrlib.errors.NoRepositoryPresent: No repository present: "file:///home/jasper/bzrgtktrunk/"

Errormessage of symlink to stand-alone branch:
Traceback (most recent call last):
  File "/home/jasper/.bazaar/plugins/gtk/olive/__init__.py", line 921, in on_treeview_right_row_activated
    self.refresh_right()
  File "/home/jasper/.bazaar/plugins/gtk/olive/__init__.py", line 1326, in refresh_right
    filename = tree1.relpath(path + os.sep + item)
  File "/usr/lib/python2.5/site-packages/bzrlib/workingtree.py", line 416, in relpath
    return osutils.relpath(self.basedir, path)
  File "/usr/lib/python2.5/site-packages/bzrlib/osutils.py", line 884, in relpath
    raise errors.PathNotChild(rp, base)
bzrlib.errors.PathNotChild: Path "/home/jasper/plottest/depositions.py" is not a child of path "/home/jasper/Programming/plotting"

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Patches are very much welcome :-) I'm afraid I don't have time for this at the moment.

Revision history for this message
Jasper Groenewegen (colbrac) wrote :

Send patch to mailing list

Changed in bzr-gtk:
status: Confirmed → Fix Committed
Revision history for this message
Jasper Groenewegen (colbrac) wrote :

Attached patch is send to mailinglist.

Uses os.path.islink() and os.path.realpath() to remove all symlinks from the path if present.
Downside: Acts like a jump to that sub/sub/sub/sub/sub folder you just nicely symlinked

Jelmer Vernooij (jelmer)
Changed in bzr-gtk:
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.