Edgewall Software
Modify

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10416 closed defect (fixed)

Repository Resync broken with Subversion 1.7.0

Reported by: anonymous Owned by: Remy Blank
Priority: high Milestone: not applicable
Component: admin/console Version: 0.12.2
Severity: critical Keywords: svn17
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

trac-admin repository resync fails with error message after upgrade to Subversion 1.7.0:

TypeError: must be string, not instance

System: Windows 7 (x64); Trac 0.12.2; Python 2.7.2.5 (32-bit); SVN 1.7.0 (32-bit, alagazam.net).

System confirmed working when downgraded to SVN 1.6.15. Using single repository connected with new provider.

Attachments (0)

Change History (21)

comment:1 by Remy Blank, 12 years ago

Owner: set to Remy Blank
Priority: normalhigh

See, that's exactly what I meant in #10414. Oh well…

Could you please check the log and see if you can find the complete traceback for the error? This would be extremely helpful.

comment:2 by Remy Blank, 12 years ago

Keywords: needinfo added

I'll definitely need the traceback, because everything works fine here on OS X with 1.7.0. The issue may be Windows-specific.

comment:3 by Jun Omae, 12 years ago

Keywords: needinfo removed

I can reproduce the issue with 0.12.3dev r10843, Python 2.6 and win32svn svn-win32-1.7.0_py26.zip on Windows XP sp3 (32-bit, Japanese Edition).

Complete traceback;

Trac [C:\usr\var\trac\0.12.2dev]> repository resync ""
リポジトリ (default) の履歴を再同期します…
18:14:45 Trac[cache] INFO: Cleaning cache
18:14:45 Trac[cache] INFO: Resetting "repository_dir": svn:456a77e7-5939-0410-b211-84f85430c667:C:/usr/var/svn/shibuya-trac
18:14:45 Trac[cache] DEBUG: cache metadata undefined (youngest_rev=0)
18:14:45 Trac[cache] INFO: repos rev [807] != cached rev [None]
18:14:45 Trac[cache] INFO: Trying to sync revision [1]
TypeError: svn_time_from_cstring() argument 2 must be string, not instance
18:14:45 Trac[console] ERROR: Exception in trac-admin command:
Traceback (most recent call last):
  File "trac\admin\console.py", line 107, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "C:\usr\apps\python26\lib\cmd.py", line 218, in onecmd
    return self.default(line)
  File "trac\admin\console.py", line 270, in default
    return cmd_mgr.execute_command(*args)
  File "C:\usr\src\trac\0.12-stable\trac\admin\api.py", line 123, in execute_command
    return f(*fargs)
  File "C:\usr\src\trac\0.12-stable\trac\versioncontrol\admin.py", line 153, in _do_resync
    self._sync(reponame, rev, clean=True)
  File "C:\usr\src\trac\0.12-stable\trac\versioncontrol\admin.py", line 139, in _sync
    repos.sync(self._sync_feedback, clean=clean)
  File "C:\usr\src\trac\0.12-stable\trac\versioncontrol\cache.py", line 242, in sync
    @self.env.with_transaction()
  File "C:\usr\src\trac\0.12-stable\trac\db\api.py", line 77, in transaction_wrapper
    fn(ldb)
  File "C:\usr\src\trac\0.12-stable\trac\versioncontrol\cache.py", line 249, in do_transaction
    cset = self.repos.get_changeset(next_youngest)
  File "C:\usr\src\trac\0.12-stable\trac\versioncontrol\svn_fs.py", line 442, in get_changeset
    return SubversionChangeset(self, rev, self.scope, self.pool)
  File "C:\usr\src\trac\0.12-stable\trac\versioncontrol\svn_fs.py", line 865, in __init__
    ts = core.svn_time_from_cstring(_date, self.pool())
  File "C:\usr\apps\python26\lib\site-packages\libsvn\core.py", line 405, in svn_time_from_cstring
    return _core.svn_time_from_cstring(*args)
TypeError: svn_time_from_cstring() argument 2 must be string, not instance

Similar issues are #3854 and #8762.

comment:4 by Remy Blank, 12 years ago

Can you try printing the arguments to svn_time_from_cstring()? I assume argument 2 is actually the first argument, otherwise it doesn't make sense. So your date value is not a string. That value is retrieved with fs.revision_prop(core.SVN_PROP_REVISION_DATE).

comment:5 by Jun Omae, 12 years ago

Ok. I just use pdb. It seems the first argument is a string.

> c:\usr\apps\python26\lib\site-packages\libsvn\core.py(405)svn_time_from_cstring()
-> return _core.svn_time_from_cstring(*args)
(Pdb) p args
('2007-10-14T13:41:57.252315Z', <libsvn.core.apr_pool_t; proxy of <Swig Object of type 'apr_pool_t *' at 0x0128CC68> >)
(Pdb) type(args[0])
<type 'str'>
(Pdb) isinstance(args[0], basestring)
True

(Pdb) up
> c:\usr\src\trac\0.12-stable\trac\versioncontrol\svn_fs.py(865)__init__()
-> ts = core.svn_time_from_cstring(_date, self.pool())
(Pdb) l
860             # we _hope_ it's UTF-8, but can't be 100% sure (#4321)
861             message = message and to_unicode(message, 'utf-8')
862             author = author and to_unicode(author, 'utf-8')
863             _date = self._get_prop(core.SVN_PROP_REVISION_DATE)
864             if _date:
865  ->             ts = core.svn_time_from_cstring(_date, self.pool())
866                 date = from_utimestamp(ts)
867             else:
868                 date = None
869             Changeset.__init__(self, repos, rev, message, author, date)
870
(Pdb) p self._get_prop(core.SVN_PROP_REVISION_DATE)
'2007-10-14T13:41:57.252315Z'
(Pdb) p _date
'2007-10-14T13:41:57.252315Z'

comment:6 by Remy Blank, 12 years ago

Mmh, bad. Can you try calling svn.time_from_cstring() interactively? Does it raise an exception for all strings that you pass?

comment:7 by Jun Omae, 12 years ago

Does it raise an exception for all strings that you pass?

Yes. I always get a exception with any arguments.

(Pdb) down
> c:\usr\apps\python26\lib\site-packages\libsvn\core.py(405)svn_time_from_cstring()
-> return _core.svn_time_from_cstring(*args)
(Pdb) p _core.svn_time_from_cstring('2007-10-14T13:41:57.252315Z', None)
*** TypeError: TypeError('svn_time_from_cstring() argument 2 must be string, not None',)
(Pdb) p _core.svn_time_from_cstring('2007-10-14T13:41:57.252315Z', '')
*** SubversionException: SubversionException(None, 125003)
(Pdb) p _core.svn_time_from_cstring('2007-10-14T13:41:57.252315Z', u'')
*** SubversionException: SubversionException(None, 125003)
(Pdb) p _core.svn_time_from_cstring('2007-10-14T13:41:57.252315Z', 'blah')
*** SubversionException: SubversionException(None, 125003)
(Pdb) p _core.svn_time_from_cstring('2007-10-14T13:41:57.252315Z', 1)
*** TypeError: TypeError('svn_time_from_cstring() argument 2 must be string, not int',)
(Pdb) p _core.svn_time_from_cstring(None, None)
*** TypeError: TypeError('svn_time_from_cstring() argument 2 must be string, not None',)
(Pdb) p _core.svn_time_from_cstring(None, '2007-10-14T13:41:57.252315Z')
===> (python.exe crashed)

comment:8 by Remy Blank, 12 years ago

Weird. Here's what I get on OS X with 1.7.0 on Python 2.6:

>>> from libsvn import _core
>>> _core.svn_time_from_cstring('2007-10-14T13:41:57.252315Z', None)
1192369317252315L
>>> _core.svn_time_from_cstring('2007-10-14T13:41:57.252315Z', '')
TypeError: argument number 2: a 'apr_pool_t *' is expected, 'str()' is received
>>> _core.svn_time_from_cstring('2007-10-14T13:41:57.252315Z', 1)
TypeError: argument number 2: a 'apr_pool_t *' is expected, 'int(1)' is received
>>> _core.svn_time_from_cstring(None, None)
TypeError: svn_time_from_cstring() argument 1 must be string, not None
>>> _core.svn_time_from_cstring(None, '2007-10-14T13:41:57.252315Z')
TypeError: svn_time_from_cstring() argument 1 must be string, not None

So the function signature is different between *nix and Windows? This could also be a SWIG issue. Do you happen to run on a 64-bit system? Mine is 32-bit.

comment:9 by Jun Omae, 12 years ago

Do you happen to run on a 64-bit system? Mine is 32-bit.

mine is also 32-bit.

comment:10 by Remy Blank, 12 years ago

I can reproduce the issue on Windows 7 with the 1.7.0 bindings from alagazam.net. The bindings for the same version on Linux and OS X work correctly.

The function signature is actually completely screwed up. I couldn't find a way to call the function that returns a useful result.

At this point, I think it's an issue with the Windows bindings, and I have reported it to the packager. He does mention on the web site that the bindings aren't tested, but hopefully he'll take a look. A comparison with bindings compiled by someone else could have been interesting, but AFAICT, none of the other binary packages provide Python bindings.

in reply to:  10 comment:11 by Jun Omae, 12 years ago

Replying to rblank:

A comparison with bindings compiled by someone else could have been interesting, but AFAICT, none of the other binary packages provide Python bindings.

I tried CollabNet Subversion Edge 2.1.0 (for Windows 32 bit) which includes Python bindings. The svn_time_from_cstring method works fine with CollabNet Subversion Edge on Windows XP sp3.

It seems that the bindings from alagazam.net only has the issue.

C:\csvn>svn --version
svn, version 1.7.0 (r1176462)
   compiled Oct  5 2011, 02:14:21

Copyright (C) 2011 The Apache Software Foundation.
....

C:\csvn>set PYTHONPATH=C:\csvn\lib\svn-python

C:\csvn>python
Python 2.7.1 (r271:86832, Oct  5 2011, 02:00:56) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from libsvn import _core
>>> _core.svn_time_from_cstring('2007-10-14T13:41:57.252315Z', None)
1192369317252315L
>>> _core.svn_time_from_cstring('2007-10-14T13:41:57.252315Z', '')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: argument number 2: a 'apr_pool_t *' is expected, 'str()' is received
>>> _core.svn_time_from_cstring('2007-10-14T13:41:57.252315Z', 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: argument number 2: a 'apr_pool_t *' is expected, 'int(1)' is received
>>> _core.svn_time_from_cstring(None, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: must be string, not None
Last edited 12 years ago by Jun Omae (previous) (diff)

comment:12 by Remy Blank, 12 years ago

Good to know, thanks. I have added a warning to the Windows section of TracSubversion.

comment:13 by Remy Blank, 12 years ago

Keywords: svn17 added

comment:14 by Christian Boos, 12 years ago

Milestone: 0.12.3not applicable

The bindings found in the CollabNet Server 2.1 are working fine (see TracSubversion#forPython2.7), so there's nothing critical here.

We can keep the ticket as a reminder to update the TracSubversion page once the Alagazam bindings get fixed.

comment:15 by dawuid@…, 12 years ago

Trying to contribute:

  • CollabNet Server compiles APR producing the function _apr_time_ansi_put@12. It's used in that way in bindings, svn and apache server. They use Visual Studio 2010.
  • Alagazam compiles APR producing the function _apr_time_ansi_put@8 (for bindings and svn server/binaries). He is using Visual C++ 6.0.
  • Apache compiles and distributes HTTP Server for windows (with APR) compiling in the same way that Alagazam (@8 and using VC 6).
  • Apache Lounge compiles and distributes HTTP Server for windows in the same way that CollabNet (@12 and using VC 8).

There is a directive (_USE_32BIT_TIME_T) to change _apr_time_ansi_put@8 to _apr_time_ansi_put@12. Maybe, with SV 1.7.0 new similar problems have raised with other functions. I think this is the principal problem (mixing Apache APR, SVN APR and Python bindings compiled in different ways because of such kind of directives).

CollabNet python bindings works fine with CollabNet SVN server (Edge named) plus Apache Lounge Server (and Trac with mod_wsgi). CollabNet python bindings doesn't work with Alazagam SVN Server and Apache server.

Note: APR is Apache Portable Runtime, used by Apache HTPP server, SVN server/binaries and SWIG (used in python bindings).

comment:16 by anonymous, 12 years ago

Problem seems to be resolved on original reporters system for Alagazam SVN 1.7.1 binaries. Anyone confirm with more sophisticated tests than "try it and see"?

in reply to:  16 ; comment:17 by anonymous, 12 years ago

Replying to anonymous:

Problem seems to be resolved on original reporters system for Alagazam SVN 1.7.1 binaries. Anyone confirm with more sophisticated tests than "try it and see"?

Although it turns out setuptools is broken: "unrecognized .svn/entries format in" error as was the case with previous svn upgrades.

in reply to:  17 comment:18 by Christian Boos, 12 years ago

Replying to anonymous:

Replying to anonymous: … Although it turns out setuptools is broken: "unrecognized .svn/entries format in" error as was the case with previous svn upgrades.

Let's hope that the Distribute people are more reactive on this issue… See https://bitbucket.org/tarek/distribute/issue/252/subversion-17-introduces-new-storage.

in reply to:  16 comment:19 by trac@…, 12 years ago

Replying to anonymous:

Problem seems to be resolved on original reporters system for Alagazam SVN 1.7.1 binaries. Anyone confirm with more sophisticated tests than "try it and see"?

I have used the Alagazam 1.7.1 bindings for Python 2.5 and they are working fine here.

comment:20 by Remy Blank, 12 years ago

Resolution: fixed
Status: newclosed

Alagazam's 1.7.1 bindings indeed work fine, and the 1.7.0 bindings should be fixed as well. Thanks Alagazam!

comment:21 by Alagazam, 12 years ago

Actually the 1.7.0 bindings was not fixed…they was withdrawn from download.

There was some other quite serious bugs in 1.7.0 so everyone using that version is highly recomended to upgrade to a newer version.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.