TransportError 'Operation not permitted' while branching

Eric Siegerman lists08-bzr at
Mon Aug 23 04:57:07 BST 2010

On Sun, 2010-08-22 at 20:17 -0500, John Arbash Meinel wrote:
> We are failing while trying to 'mkdir'. Seems like a simple permission
> error. I don't know why we aren't directly translating Errno 1 to
> PermissionDenied. Looking at the code I see:
>   if e.errno == errno.EACCES:
>       raise errors.PermissionDenied(path, extra=e)
> that should probably be changed to:
>   if e.errno in (errno.EACCES, errno.EPERM):
>       raise errors.PermissionDenied(path, extra=e)

If this change would result in both codes resulting in the text
"Permission denied", it would be most unwise.  EACCES and EPERM
mean different things, so coercing them to the same error-message
text would lose possibly valuable information.  In the specific
case of mkdir(2) on Jaunty:
    EACCES The parent directory does not allow write permission
           to the process, or one of the directories in
           "pathname" did not allow search permission.
           (See also path_resolution(7).)

    EPERM  The file system containing pathname does not support
           the creation of directories.

I have no insight into why mkdir would in fact be failing with
EPERM in Parth's case, but the fact that it is, strongly suggests
that the problem is something other than "a simple permission
error" -- and reporting "Permission denied" for both EACCES and
EPERM would have obscured that distinction.

(In general, EACCES is for reporting failures that were due to
the usual owner/group/mode permission mechanism.  EPERM is for
different sorts of errors; one common use of it is for operations
that don't use the file's mode, but rather are restricted to a
file's owner or root, e.g. chgrp(), chmod(); or purely to root,
e.g. chown().)

  - Eric

More information about the bazaar mailing list