Can't create branch/repo on vfat

Bug #254514 reported by René 'Necoro' Neumann
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Low
Unassigned

Bug Description

Bzr version: 1.5
OS: Gentoo Linux

I tried to branch onto a USB drive with vfat-FS. But it fails with the following traceback:

/usr/lib/python2.5/site-packages/bzrlib/atomicfile.py:125: UserWarning: AtomicFile(u'/mnt/usb/t/.bzr/README') leaked
  warnings.warn("%r leaked" % self)
bzr: ERROR: bzrlib.errors.TransportError: Transport error: [Errno 1] Operation not permitted: '/mnt/usb/t/.bzr/README.32069.Zakarumiy.tmp' [Errno 1] Operation not permitted: '/mnt/usb/t/.bzr/README.32069.Zakarumiy.tmp'

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 942, in run
    hardlink=hardlink)
  File "/usr/lib/python2.5/site-packages/bzrlib/bzrdir.py", line 932, in sprout
    result = cloning_format.initialize_on_transport(target_transport)
  File "/usr/lib/python2.5/site-packages/bzrlib/bzrdir.py", line 1524, in initialize_on_transport
    control_files.put_utf8(file, content)
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 165, in write_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/lockable_files.py", line 201, in put_utf8
    self.put_bytes(path, a_string.encode('utf-8'))
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 165, in write_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/lockable_files.py", line 184, in put_bytes
    mode=self._file_mode)
  File "/usr/lib/python2.5/site-packages/bzrlib/transport/local.py", line 185, in put_bytes
    self._translate_error(e, path)
  File "/usr/lib/python2.5/site-packages/bzrlib/transport/__init__.py", line 322, in _translate_error
    raise errors.TransportError(orig_error=e)
TransportError: Transport error: [Errno 1] Operation not permitted: '/mnt/usb/t/.bzr/README.32069.Zakarumiy.tmp' [Errno 1] Operation not permitted: '/mnt/usb/t/.bzr/README.32069.Zakarumiy.tmp'

bzr 1.5 on python 2.5.2 (linux2)
arguments: ['/usr/bin/bzr', '-Derror', 'branch', 'thesis', 't']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'de_DE.UTF-8'
plugins:
  bzrtools /usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools [1.5.0]
  cia /home/necoro/.bazaar/plugins/cia [1.0.0dev0]
  gtk /usr/lib/python2.5/site-packages/bzrlib/plugins/gtk [0.94.0]
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
  svn /usr/lib/python2.5/site-packages/bzrlib/plugins/svn [0.4.10]
  vimdiff /usr/lib/python2.5/site-packages/bzrlib/plugins/vimdiff [unknown]
*** 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.

Using the "print-debugging"-style, I saw, that the error is thrown in os.chmod in AtomicFile.__init__.
Seems like everything which creates a new .bzr directory is affected (bzr init, init-repo, branch, push ...)

Tags: fat
Revision history for this message
René 'Necoro' Neumann (necoro) wrote :

On my laptop it works without flaws --- and in theory they should be configured the same ...

The mount parameters (on my laptop):
/dev/sda1 on /mnt/usb type vfat (rw,nosuid,nodev,user=necoro)

Revision history for this message
René 'Necoro' Neumann (necoro) wrote :

On PC:
/dev/sdb1 on /mnt/usb type vfat (rw,nosuid,nodev,user=necoro)

Perhaps it is a kernel issue? - Using 2.6.25 on my PC and 2.6.24 on the laptop.

Revision history for this message
René 'Necoro' Neumann (necoro) wrote :

Ok - changed kernel to 2.6.24 on my PC too - and then it works again

So I guess, there was a change in the vfat-module.

I haven't tested 2.6.26 though

Revision history for this message
René 'Necoro' Neumann (necoro) wrote :

From ChangeLog-2.6.25:

commit 19c561a60ffe52df88dd63de0bff480ca094efe4
Author: Jan Engelhardt <email address hidden>
Date: Wed Feb 6 01:36:08 2008 -0800

    fs/fat/: refine chmod checks

    Prohibit mode changes in non-quiet mode that cannot be stored reliably with
    the on-disk format.

    Suppose a vfat filesystem is mounted with umask=0 and [not-quiet]. Then
    all files will have mode 0777. Trying to change the owner will fail,
    because fat does not know about owners or groups. chmod 0770, on the other
    hand, will succeed, even though fat does not know about the permission
    triplet [user/group/other].

    So this patch changes fat's not-quiet behavior so that only UNIX modes are
    accepted that can be mapped lossless between the fat disk format and the
    local system. There is only one attribute, and that is the readonly
    attribute, which is mapped to the UNIX write permission bit(s). chmod 0555
    is therefore valid (taking away the +w bits <=> setting the readonly
    attribute). Since chmod 0775 and chmod 0755 is an ambiguous case as to
    whether to set or clear the readonly bit, these modes are also denied.

    In quiet mode, chmod and chown will continue to "succeed" as they did
    before, meaning that a subsequent stat() will temporarily return the new
    mode as long as the inode is not reread from disk, and chown will silently
    do nothing, not even return the new uid/gid in stat().

So - a workaround is to have the mount option "quiet" set.

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

I guess we could detect FAT filesystems under Linux somehow and then limit the file modes we use.

Changed in bzr:
importance: Undecided → Low
status: New → Triaged
tags: added: fat
Martin Pool (mbp)
Changed in bzr:
status: Triaged → Confirmed
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.