Branching plain branch under shared repository from Windows over SFTP gives Errno 13 permission denied

Asked by Kaustav Das Modak

Hello,
I'm trying to branch a project hosted on a Windows XP Pro machine on my network to my Ubuntu 10.10 desktop. The XP machine uses Core FTP server to provide SFTP. I am able to connect to the XP machine through FileZilla, create file and directory, change permissions on file and directory, delete file and directory over SFTP.

The branches on the XP host are plain branches under a shared repository. The shared repository directory is the home directory of the SFTP user. When I try to run the "bzr branch" command it is returning Errno 13: permission denied. The commandline output is:

$ bzr branch sftp://kido@192.168.1.103/test/ test/
kido@192.168.1.103's password:
Welcome to 192.168.1.103 running on Win XP Probzr: ERROR: Permission denied: "/test/.bzr/repository/format": [Errno 13] Permission denied

Please advise on what I'm doing wrong. Thanks!

P.S. I'm able to pull branches hosted on the Ubuntu machine to the XP machine.
---------------------------------------------------------------------------------------

Bazaar version on Ubuntu
----------------------------------
Bazaar (bzr) 2.2.1
  Python interpreter: /usr/bin/python 2.6.6
  Python standard library: /usr/lib/python2.6
  Platform: Linux-2.6.35-22-generic-i686-with-Ubuntu-10.10-maverick
  bzrlib: /usr/lib/python2.6/dist-packages/bzrlib

Bazaar version on Win XP
-----------------------------------
Bazaar (bzr) 2.1.1

  Python interpreter: C:\Program Files\Bazaar\python25.dll 2.5.4

  Python standard library: C:\Program Files\Bazaar\lib\library.zip

  Platform: Windows-XP-5.1.2600-SP3

  bzrlib: C:\Program Files\Bazaar\lib\library.zip\bzrlib

  Bazaar configuration: C:\Documents and Settings\Kaustav\Application Data\bazaa
r\2.0

  Bazaar log file: F:\work\.bzr.log

Win XP branch's "bzr info" output
--------------------------------------------
E:\source\test>bzr info

Repository tree (format: 2a)

Location:

  shared repository: E:/source

  repository branch: .

Win XP SFTP server
------------------------------------
Core FTP Server version 1.0 build 349

Bzr log
------------------------------------
0.038 bazaar version: 2.2.1
0.038 bzr arguments: [u'branch', u'sftp://kido@192.168.1.103/test/', u'test/']
0.051 looking for plugins in /home/kido/.bazaar/plugins
0.051 looking for plugins in /usr/lib/python2.6/dist-packages/bzrlib/plugins
0.112 encoding stdout as sys.stdout encoding 'UTF-8'
0.156 ssh implementation is OpenSSH
2.901 Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 912, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 1112, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 690, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 705, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 135, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/builtins.py", line 1209, in run
    from_location)
  File "/usr/lib/python2.6/dist-packages/bzrlib/bzrdir.py", line 1033, in open_tree_or_branch
    return bzrdir._get_tree_branch()
  File "/usr/lib/python2.6/dist-packages/bzrlib/bzrdir.py", line 1015, in _get_tree_branch
    branch = self.open_branch(name=name)
  File "/usr/lib/python2.6/dist-packages/bzrlib/bzrdir.py", line 1871, in open_branch
    _found=True, ignore_fallbacks=ignore_fallbacks)
  File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 2069, in open
    _repository=a_bzrdir.find_repository(),
  File "/usr/lib/python2.6/dist-packages/bzrlib/bzrdir.py", line 735, in find_repository
    found_repo = self._find_containing(usable_repository)
  File "/usr/lib/python2.6/dist-packages/bzrlib/bzrdir.py", line 701, in _find_containing
    result, stop = evaluate(found_bzrdir)
  File "/usr/lib/python2.6/dist-packages/bzrlib/bzrdir.py", line 725, in usable_repository
    repository = found_bzrdir.open_repository()
  File "/usr/lib/python2.6/dist-packages/bzrlib/bzrdir.py", line 1876, in open_repository
    format = RepositoryFormat.find_format(self)
  File "/usr/lib/python2.6/dist-packages/bzrlib/repository.py", line 3110, in find_format
    format_string = transport.get_bytes("format")
  File "/usr/lib/python2.6/dist-packages/bzrlib/transport/sftp.py", line 435, in get_bytes
    f = self.get(relpath)
  File "/usr/lib/python2.6/dist-packages/bzrlib/transport/sftp.py", line 431, in get
    failure_exc=errors.ReadError)
  File "/usr/lib/python2.6/dist-packages/bzrlib/transport/sftp.py", line 701, in _translate_io_exception
    self._translate_error(e, path, raise_generic=False)
  File "/usr/lib/python2.6/dist-packages/bzrlib/transport/__init__.py", line 316, in _translate_error
    raise errors.PermissionDenied(path, extra=e)
PermissionDenied: Permission denied: "/test/.bzr/repository/format": [Errno 13] Permission denied

2.902 Transferred: 0kB (2.3kB/s r:0kB w:0kB)
2.902 return code 3

Question information

Language:
English Edit question
Status:
Solved
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Solved by:
Kaustav Das Modak
Solved:
Last query:
Last reply:
Revision history for this message
John A Meinel (jameinel) said :
#1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/17/2010 11:37 AM, Kaustav Das Modak wrote:
> New question #134437 on Bazaar:
> https://answers.launchpad.net/bzr/+question/134437
>
> Hello,
> I'm trying to branch a project hosted on a Windows XP Pro machine on my network to my Ubuntu 10.10 desktop. The XP machine uses Core FTP server to provide SFTP. I am able to connect to the XP machine through FileZilla, create file and directory, change permissions on file and directory, delete file and directory over SFTP.
>
> The branches on the XP host are plain branches under a shared repository. The shared repository directory is the home directory of the SFTP user. When I try to run the "bzr branch" command it is returning Errno 13: permission denied. The commandline output is:
>
> $ bzr branch sftp://kido@192.168.1.103/test/ test/
> kido@192.168.1.103's password:
> Welcome to 192.168.1.103 running on Win XP Probzr: ERROR: Permission denied: "/test/.bzr/repository/format": [Errno 13] Permission denied
>
> Please advise on what I'm doing wrong. Thanks!

My first guess is that you are using the wrong url. Try:

$ bzr branch sftp://kido@192.168.1.103/~/test/

bzr urls use the absolute path to the directory, so if you want to use
the one in your home directory you need to add ~/ to it.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzkE14ACgkQJdeBCYSNAAMJMQCfdTuQ1wtvrGDUyn8U4uGk0eIZ
qOYAn3FYK9N6xSsemVxf0l7QY0l9bMh0
=x7Lg
-----END PGP SIGNATURE-----

Revision history for this message
Kaustav Das Modak (kaustav-dasmodak) said :
#2

Hello John,

Thanks for replying. I had expected that will be the first reply I get. Sadly, I have tried using absolute path with curl. But the result is still the same. Here is the output:

$ bzr branch sftp://kido@192.168.1.103/~/test/ test/
kido@192.168.1.103's password:
Welcome to 192.168.1.103 running on Win XP Probzr: ERROR: Permission denied: "test/.bzr/repository/format": [Errno 13] Permission denied

I know that this path is correct because when I connect with the same credentials via FileZilla, I land in the E:\source directory. So from there, the path to the "test" directory should be "~/test" for the SFTP user, and this "test" directory is the branch in question.

Revision history for this message
John A Meinel (jameinel) said :
#3

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/17/2010 12:01 PM, Kaustav Das Modak wrote:
> Question #134437 on Bazaar changed:
> https://answers.launchpad.net/bzr/+question/134437
>
> Status: Answered => Open
>
> Kaustav Das Modak is still having a problem:
> Hello John,
>
> Thanks for replying. I had expected that will be the first reply I get.
> Sadly, I have tried using absolute path with curl. But the result is
> still the same. Here is the output:
>
> $ bzr branch sftp://kido@192.168.1.103/~/test/ test/
> kido@192.168.1.103's password:
> Welcome to 192.168.1.103 running on Win XP Probzr: ERROR: Permission denied: "test/.bzr/repository/format": [Errno 13] Permission denied
>
> I know that this path is correct because when I connect with the same
> credentials via FileZilla, I land in the E:\source directory. So from
> there, the path to the "test" directory should be "~/test" for the SFTP
> user, and this "test" directory is the branch in question.
>

So there actually seems to be a permissions issue. Specifically, if we
are getting to the point of probing for .bzr/repository/format, then
that should indicate that we've already read .bzr/branch-format.

As such, I would double check your permissions for everything under .bzr/

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzkHDUACgkQJdeBCYSNAAPnagCfZnTt3M3xFUiIfg4/cU0syDqI
KscAoJ4u5LDMDZEGqjib1DgdrJJyfNwE
=WI9K
-----END PGP SIGNATURE-----

Revision history for this message
Kaustav Das Modak (kaustav-dasmodak) said :
#4

Fixed it.

The real problem: There was no "repository" directory under .bzr/
The fix: Create an empty "repository" directory.

It seems like when Bzr 2.1.1 is used in Windows to create a "Plain Branch" using Bazaar Explorer, it does not create the .bzr/repository/ directory. Should this be treated as a bug?

Revision history for this message
John A Meinel (jameinel) said :
#5

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/17/2010 12:44 PM, Kaustav Das Modak wrote:
> Question #134437 on Bazaar changed:
> https://answers.launchpad.net/bzr/+question/134437
>
> Kaustav Das Modak posted a new comment:
> Fixed it.
>
> The real problem: There was no "repository" directory under .bzr/
> The fix: Create an empty "repository" directory.
>
> It seems like when Bzr 2.1.1 is used in Windows to create a "Plain
> Branch" using Bazaar Explorer, it does not create the .bzr/repository/
> directory. Should this be treated as a bug?
>

If you have a shared repository somewhere, branching into a subdirectory
is going to re-use the shared repository. If you don't then expose that
repository to the sftp server, we can't get to it. I don't think this is
a bug, but a simple misconfiguration.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzkJ04ACgkQJdeBCYSNAAMXrQCgvNYSW6dXbAe6iGkFDU1Dj4fp
syoAmgJe12M3FAmFDhUz24sjt6QW9aLA
=olVS
-----END PGP SIGNATURE-----

Revision history for this message
Kaustav Das Modak (kaustav-dasmodak) said :
#6

Checked and it's working.

Changes that I had to do are:
1. Create a blank directory ".bzr/repository" in the branch on the Windows XP host.
2. Use absolute path to the directory in the format of sftp://kido@192.168.1.103/~/test/

I was facing similar error when trying to branch from a Windows 7 host. I'm yet to check it on Win 7. But my guess is if the ".bzr/repository" does not exist, creating a blank ".bzr/repository" directory will solve it.

Thanks John A Meinel for the help!

Revision history for this message
Kaustav Das Modak (kaustav-dasmodak) said :
#7

@John A Meinel
The SFTP root folder is the shared repository I'm using for these branches. In this case, E:\source is the shared repository, and it is used as the SFTP server root folder. sftp://kido@192.168.1.103/ actually opens E:\source on the Windows XP machine. So, as far as I can see, the SFTP server exposes the shared repository and Bzr can access it over SFTP. Is this still a misconfiguration?

The point is there was no ".bzr/repository" directory in the branch and Bzr was trying to access that directory, as you can see here:
bzr: ERROR: Permission denied: "test/.bzr/repository/format": [Errno 13] Permission denied

Also, full write permissions are given to the directory, and the SFTP user has all privileges. Still, if the directory didn't exist, Bzr did not create the directory itself, instead of throwing the permission error.

Revision history for this message
John A Meinel (jameinel) said :
#8

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/17/2010 1:28 PM, Kaustav Das Modak wrote:
> Question #134437 on Bazaar changed:
> https://answers.launchpad.net/bzr/+question/134437
>
> Kaustav Das Modak posted a new comment:
> @John A Meinel
> The SFTP root folder is the shared repository I'm using for these branches. In this case, E:\source is the shared repository, and it is used as the SFTP server root folder. sftp://kido@192.168.1.103/ actually opens E:\source on the Windows XP machine. So, as far as I can see, the SFTP server exposes the shared repository and Bzr can access it over SFTP. Is this still a misconfiguration?
>
> The point is there was no ".bzr/repository" directory in the branch and Bzr was trying to access that directory, as you can see here:
> bzr: ERROR: Permission denied: "test/.bzr/repository/format": [Errno 13] Permission denied
>
> Also, full write permissions are given to the directory, and the SFTP
> user has all privileges. Still, if the directory didn't exist, Bzr did
> not create the directory itself, instead of throwing the permission
> error.
>

We will probe to see if there is a file there. It looks like we are
getting "Permission Denied" rather than "No Such File" which is
confusing us.

I think there is an open bug about this. But I don't know it offhand.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzkNz0ACgkQJdeBCYSNAANBgACfRUkYYnR8BXvJx3WDzYcno1fK
ZrgAnREW7G9DMQ+TMveU4220yNkGh/TM
=8oi+
-----END PGP SIGNATURE-----

Revision history for this message
Kaustav Das Modak (kaustav-dasmodak) said :
#9

Even I think it is a permission issue. At least I have a workaround till it is fixed. This seems to be a Windows specific issue.