Opened 13 years ago

Closed 13 years ago

#32312 closed defect (invalid)

subversion-python27bindings: initialization fails for user macports

Reported by: titus@… Owned by: blair (Blair Zajac)
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: Cc: danielluke (Daniel J. Luke)
Port: subversion-python27bindings

Description (last modified by ryandesign (Ryan Carsten Schmidt))

When this package is initialized it tries to open the file ~<sudoer>/.subversion/server. This fails if the user sudoed to is underprivileged for this directory, as e.g. on my machine the user macports.

steps to reproduce:

cd ~
chmod 700 .subversion
curl -o hgsubversion-1.3.tar.gz http://pypi.python.org/packages/source/h/hgsubversion/hgsubversion-1.3.tar.gz
tar xzf hgsubversion-1.3.tar.gz
cd hgsubversion-1.3
sudo -u macports /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 setup.py --no-user-cfg build

Change History (8)

comment:1 Changed 13 years ago by danielluke (Daniel J. Luke)

Following your steps, I get:

IOError: [Errno 13] Permission denied: '/Volumes/Extra/dluke/hgsubversion-1.3/hgsubversion.egg-info/top_level.txt'

If I chmod -R macports hgsubversion (after extracting), I get:

% sudo -u macports /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 setup.py --no-user-cfg build
running build
running build_py
creating build
creating build/lib
creating build/lib/hgsubversion
copying hgsubversion/__init__.py -> build/lib/hgsubversion
copying hgsubversion/__version__.py -> build/lib/hgsubversion
copying hgsubversion/editor.py -> build/lib/hgsubversion
copying hgsubversion/maps.py -> build/lib/hgsubversion
copying hgsubversion/pushmod.py -> build/lib/hgsubversion
copying hgsubversion/replay.py -> build/lib/hgsubversion
copying hgsubversion/stupid.py -> build/lib/hgsubversion
copying hgsubversion/svncommands.py -> build/lib/hgsubversion
copying hgsubversion/svnexternals.py -> build/lib/hgsubversion
copying hgsubversion/svnmeta.py -> build/lib/hgsubversion
copying hgsubversion/svnrepo.py -> build/lib/hgsubversion
copying hgsubversion/util.py -> build/lib/hgsubversion
copying hgsubversion/wrappers.py -> build/lib/hgsubversion
creating build/lib/hgsubversion/svnwrap
copying hgsubversion/svnwrap/__init__.py -> build/lib/hgsubversion/svnwrap
copying hgsubversion/svnwrap/common.py -> build/lib/hgsubversion/svnwrap
copying hgsubversion/svnwrap/subvertpy_wrapper.py -> build/lib/hgsubversion/svnwrap
copying hgsubversion/svnwrap/svn_swig_wrapper.py -> build/lib/hgsubversion/svnwrap

Maybe including the actual error you get (and/or how you figured out that failing to access ~/.subversion/servers was the problem) would help?

I imagine that access is actually coming from the subversion client (C) libraries, and should be able to handle the case where it can't access the file...

Of course, the default permissions for ~/.subversion aren't 700 either (and ~/.subversion/servers is normally world-readable), so it's possible that you've discovered problem that upstream hasn't noticed yet.

comment:2 Changed 13 years ago by danielluke (Daniel J. Luke)

I also ran fs_usage against macports python2.7 while doing 'import svn' and it didn't attempt to read anything from ~/.subverison

comment:3 Changed 13 years ago by titus@…

Yes, I forgot to mention the chown -R macports hgsubversion-1.3

Did you install subversion-python27bindings? It has to be installed + activated.

The problem is:

Traceback (most recent call last):
  File "setup.py", line 105, in <module>
    from hgsubversion.svnwrap import svn_swig_wrapper
  File "/private/tmp/hgsubversion-1.3/hgsubversion/__init__.py", line 58, in <module>
    import svncommands
  File "/private/tmp/hgsubversion-1.3/hgsubversion/svncommands.py", line 14, in <module>
    import svnwrap
  File "/private/tmp/hgsubversion-1.3/hgsubversion/svnwrap/__init__.py", line 28, in <module>
    from svn_swig_wrapper import *
  File "/private/tmp/hgsubversion-1.3/hgsubversion/svnwrap/svn_swig_wrapper.py", line 60, in <module>
    svn_config = core.svn_config_get_config(None)
  File "/opt/local/lib/svn-python2.7/libsvn/core.py", line 3864, in svn_config_get_config
    return _core.svn_config_get_config(*args)
svn.core.SubversionException: 13 - Kann Datei »/Users/titus/.subversion/servers« nicht öffnen: Permission denied

comment:4 Changed 13 years ago by danielluke (Daniel J. Luke)

I do have it installed and activated.

Your output doesn't give me anything to try to reproduce the issue (you don't include the command you're running, so I guess I can only assume it's the same as the one I ran). Your instructions don't reproduce the issue for me. Perhaps there is something different with your setup? Perhaps the permissions on ~/.subversion aren't the issue?

This does look like the same issue as #30360. I think it's probably actually an issue with hgsubversion (possibly, you could argue that it's an upstream issue with the implementation of svn_config_get_config).

comment:5 Changed 13 years ago by danielluke (Daniel J. Luke)

Here is a simple reproduction of the issue you are seeing:

% python2.7
Python 2.7.2 (default, Nov 22 2011, 09:49:02) 
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from svn import core
>>> core.svn_config_get_config(None)
{'config': <libsvn.core.svn_config_t; proxy of <Swig Object of type 'svn_config_t *' at 0x10ecdded0> >, 'servers': <libsvn.core.svn_config_t; proxy of <Swig Object of type 'svn_config_t *' at 0x10ecddfc0> >}
>>> ^D
[xeon:~] dluke% chmod 000 .subversion/
[xeon:~] dluke% python2.7
Python 2.7.2 (default, Nov 22 2011, 09:49:02) 
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from svn import core
>>> core.svn_config_get_config(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/lib/svn-python2.7/libsvn/core.py", line 3864, in svn_config_get_config
    return _core.svn_config_get_config(*args)
svn.core.SubversionException: 13 - Can't open file '/Volumes/Extra/dluke/.subversion/servers': Permission denied

comment:6 Changed 13 years ago by danielluke (Daniel J. Luke)

further: svn_config_get_config is called from hgsubversion/svnwrap/svn_swig_wrapper.py which doesn't appear to be run when you build hgsubversion.

I tested again with ~/.subversion chmod'd to 000 and it built fine again for me.

comment:7 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

comment:8 Changed 13 years ago by titus@…

Resolution: invalid
Status: newclosed

Still, I don't understand why that doesn't happen with your installation.

Anyway, I think that it's a combination of svn_swig_wrapper.py not catching an exception from svn_config_get_config and maybe - as you said - svn_config_get_config itself.

Thanks for the testing!

Note: See TracTickets for help on using tickets.