error on unix filesystems that don't support symlinks

Bug #242522 reported by Martin Pool
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Bazaar
Medium
Parth Malwankar

Bug Description

bzr may be on a unix system that knows about symlinks, but a filesystem that doesn't support them. We should, at minimum, give a clear error about this. Perhaps it would be better to fallback to putting placeholders instead of the symlinks.

-----

I'm trying to push a branch to a repository on a USB stick, but
getting an error that appears to be ultimately from the filesystem.

=====
$ bzr version
Bazaar (bzr) 1.5
 Python interpreter: /usr/bin/python 2.5.2
 Python standard library: /usr/lib/python2.5
 bzrlib: /usr/lib/python2.5/site-packages/bzrlib
 Bazaar configuration: /home/bignose/.bazaar
 Bazaar log file: /home/bignose/.bzr.log
[...]

$ bzr init-repository --trees /media/sdb1/bazaar/
$ bzr info /media/sdb1/bazaar/
Shared repository with trees (format: pack-0.92)
Location:
 shared repository: /media/sdb1/bazaar

$ bzr init /media/sdb1/bazaar/roaming-profile/
$ bzr info /media/sdb1/bazaar/roaming-profile/
Repository tree (format: pack-0.92)
Location:
 shared repository: /media/sdb1/bazaar
 repository branch: /media/sdb1/bazaar/roaming-profile

$ bzr info .
Standalone tree (format: pack-0.92)
Location:
 branch root: .
[...]

$ bzr push /media/sdb1/bazaar/roaming-profile/
bzr: ERROR: [Errno 1] Operation not permitted
$ bzr push --verbose /media/sdb1/bazaar/roaming-profile/
bzr: ERROR: [Errno 1] Operation not permitted
=====

What can I do to find out what Bazaar is trying to do that fails here?
What can I do to fix it?

Here is the corresponding traceback from '$HOME/.bzr.log':

=====
0.254 encoding stdout as sys.stdout encoding 'UTF-8'
0.255 bzr arguments: [u'push', u'--verbose', u'/media/sdb1/bazaar/roaming-profile/']
0.255 looking for plugins in /home/bignose/.bazaar/plugins
0.255 looking for plugins in /usr/lib/python2.5/site-packages/bzrlib/plugins
0.256 Plugin name __init__ already loaded
0.256 Plugin name __init__ already loaded
0.316 encoding stdout as sys.stdout encoding 'UTF-8'
0.513 opening working tree '/media/sdb1/bazaar/roaming-profile'
0.582 Using fetch logic to copy between KnitPackRepository('file:///home/bignose/.roam/.bzr/repository/')(<RepositoryFormatKnitPack1>) and KnitPackRepository('file:///media/sdb1/bazaar/.bzr/repository/')(<RepositoryFormatKnitPack1>)
0.667 Traceback (most recent call last):
 File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 846, in run_bzr_catch_errors
   return run_bzr(argv)
 File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 797, in run_bzr
   ret = run(*run_argv)
 File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 499, in run_argv_aliases
   return self.run(**all_cmd_args)
 File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 865, in run
   tree_to.update()
 File "/usr/lib/python2.5/site-packages/bzrlib/workingtree.py", line 2093, in update
   return self._update_tree(old_tip, change_reporter)
 File "/usr/lib/python2.5/site-packages/bzrlib/mutabletree.py", line 52, in tree_write_locked
   return unbound(self, *args, **kwargs)
 File "/usr/lib/python2.5/site-packages/bzrlib/workingtree.py", line 2133, in _update_tree
   change_reporter=change_reporter)
 File "/usr/lib/python2.5/site-packages/bzrlib/merge.py", line 1196, in merge_inner
   return merger.do_merge()
 File "/usr/lib/python2.5/site-packages/bzrlib/merge.py", line 419, in do_merge
   merge.do_merge()
 File "/usr/lib/python2.5/site-packages/bzrlib/merge.py", line 519, in do_merge
   self._compute_transform()
 File "/usr/lib/python2.5/site-packages/bzrlib/merge.py", line 557, in _compute_transform
   file_status = self.merge_contents(file_id)
 File "/usr/lib/python2.5/site-packages/bzrlib/merge.py", line 827, in merge_contents
   self.other_tree, trans_id)
 File "/usr/lib/python2.5/site-packages/bzrlib/transform.py", line 1823, in create_by_entry
   tt.create_symlink(tree.get_symlink_target(entry.file_id), trans_id)
 File "/usr/lib/python2.5/site-packages/bzrlib/transform.py", line 388, in create_symlink
   os.symlink(target, self._limbo_name(trans_id))
OSError: [Errno 1] Operation not permitted
=====

That gives a pretty big clue: This repository is on a FAT16
filesystem, and I'm asking it to update a working tree containing
symlinks.

Should I expect that to work?

If it is to fail, I would at least expect a more sensible error
message, indicating what operation is failing, and exactly which file
in the working tree is being updated at the point of the failure.

Related branches

Martin Pool (mbp)
Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Jelmer Vernooij (jelmer)
tags: added: filesystem symlink
Revision history for this message
Igor Nawrocki (igornaw) wrote :

at work we use samba to share files - we can't use bazaar because of this bug :/

Revision history for this message
Parth Malwankar (parthm) wrote :

I looked into this a bit. The reason for the failure, as is apparent from the above report, is that the target filesystem does not support symbolic links.
In transform.create_symlink bazaar tries to create a symbolic link as shown below:
        if has_symlinks():
            os.symlink(target, self._limbo_name(trans_id))
            unique_add(self._new_contents, trans_id, 'symlink')
where has_symlink is merely a check to see if the os module has a symlink attribute. Hence, a target not supporting symlinks is not handled.

It may be good to simply ignore symlinks in a case like this. This approach would be similar to the patch under review for bug #81689.
https://code.launchpad.net/~parthm/bzr/81689-win-symlink-warning
It should be fairly straightforward to catch the OSError errno 1 that come up in the above case and use this approch. Would appreciate any suggestions/comments on this approach.

Changed in bzr:
assignee: nobody → Parth Malwankar (parthm)
status: Confirmed → In Progress
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers