bzr 1.0.0.candidate.3: ERROR: Permission denied: [Errno 13]
John Arbash Meinel
john at arbash-meinel.com
Thu Dec 13 17:04:23 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jari Aalto wrote:
...
>
> You might also try a patch like:
> === modified file 'bzrlib/lockable_files.py'
> - --- bzrlib/lockable_files.py 2007-08-15 04:33:34 +0000
> +++ bzrlib/lockable_files.py 2007-12-13 15:16:45 +0000
> @@ -132,7 +132,9 @@
> self._dir_mode = 0755
> self._file_mode = 0644
> else:
> - - self._dir_mode = st.st_mode & 07777
> + # Always set user read-write
> + self._dir_mode = (st.st_mode & 07777) | 00600
> +
> # Remove the sticky and execute bits for files
> self._file_mode = self._dir_mode & ~07111
> if not self._set_dir_mode:
>
>
> Since it seems like when we check we get a readonly directory returned, which
>> is causing us to try and create the files in readonly mode (which doesn't work
>> so well).
>
> Excellent! This worked, thanks.
>
> Jari
>
Yeah, so what is happening is that we are doing (effectively):
mode = os.stat('.bzr/repository').st_mode
mode &= 07777 # Get only the user permissions
mode &= ~07111 # Strip setgid/setuid bits and executable
os.open('.bzr/repository/ff/foo.knit',
os.O_CREAT | os.O_WRONLY,
mode)
And that means that we are doing "os.open()" with a default mode bits of
readonly (since we didn't get the writable flag from the os.stat call).
I find it *very* weird that on cygwin you get back a readonly directory, and
then have no problem creating a file there.
That said, I think the patch is reasonable. There isn't any reason why we would
want to open a file that is not writable to the current user. We may or may not
want it writable by group, but we'll use the bits to determine that.
I'll post a patch to the group.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHYWYXJdeBCYSNAAMRAgJmAJ9d861CafpoZE9zhwGs6AwurkpZkwCghHDw
eAILmD74mW/tJdkzxxIm2TM=
=vi/o
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list