You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Dmitry Savvateev <ds...@mail.ru> on 2010/03/17 05:08:09 UTC

Cannot accept 'svn:sync-lock' property because it is not encoded in UTF-8

Hello,

I've ran into the following problem with svnsync on Windows Vista.
I'm trying to mirror a repository from my flash drive to the local
disk, and keep getting the following message:

svnsync: Cannot accept 'svn:sync-lock' property because it is not
encoded in UTF-8

What's wrong here? I've been doing the same thing many times before,
on Windows and Linux, and never seen anything like this.

Here's what I'm doing:

C:\Data>svnadmin create svn-backup

C:\Data>svnsync init file:///c:/data/svn-backup file:///s:/svn
svnsync: Cannot accept 'svn:sync-lock' property because it is not
encoded in UTF-8

C:\Data>svn pdel --revprop -r 0 svn:sync-lock file:///c:/data/svn-backup
property 'svn:sync-lock' deleted from repository revision 0

C:\Data>svnsync init file:///c:/data/svn-backup file:///s:/svn
svnsync: Cannot accept 'svn:sync-lock' property because it is not
encoded in UTF-8

It seems that the message from svnsync is issued before calling
pre-revprop-change hook in the target repository.
Here's the svn version I'm using:

C:\Data>svnsync --version
svnsync, version 1.6.6 (r40053)
   compiled Oct 26 2009, 20:14:36

Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - with Cyrus SASL authentication
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
  - handles 'http' scheme
  - handles 'https' scheme

C:\Data>svnadmin --version
svnadmin, version 1.6.6 (r40053)
   compiled Oct 26 2009, 20:14:36

Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository back-end (FS) modules are available:

* fs_base : Module for working with a Berkeley DB repository.
* fs_fs : Module for working with a plain file (FSFS) repository.

Yours,
Dmitry Savvateev

Re: Cannot accept 'svn:sync-lock' property because it is not encoded in UTF-8

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Ryan Schmidt wrote on Thu, 18 Mar 2010 at 05:33 -0500:
> If your hostname is not UTF-8, how is Subversion to know what
> character encoding it's using? It seems to me it's a bug (of your OS)
> to present a non-UTF-8 string (or possibly even a non-ASCII string) as
> a valid hostname.

We get the hostname from APR.  Either Subversion or APR (depending on 
APR's API promises) should convert it to UTF-8 (or, as you say, punycode) 
before we attempt to use it as the property value.

Another option: we could use the local IP address instead of the hostname.

> (My thought is that if a non-ASCII hostname is
> desired, the UTF-8 representation of the hostname should be encoded in
> punycode [1] by the OS. But maybe that's just me.)
> 
> 
> [1] http://en.wikipedia.org/wiki/Punycode
> 
> 
> 

Re: Cannot accept 'svn:sync-lock' property because it is not encoded in UTF-8

Posted by Dmitry Savvateev <ds...@mail.ru>.
hostname is irrelevant for those not using their PCs as servers (like
me). I've been using this computer (with this hostname) for about a
year without any problems. It was used for Internet access, but only
client side.

AFAIK, Windows has a notion of "ansi" encoding, which is a single-byte
encoding for the local language used by the system  (cp1251 in my
case). There are also set of "parallel" APIs returning Unicode strings
in UTF-16. May be these should be used instead, I don't know.


2010/3/18 Ryan Schmidt <su...@ryandesign.com>:
>
> On Mar 18, 2010, at 03:47, Dmitry Savvateev wrote:
>
>> Yes, indeed, the host name contained cyrillics. I changed it, and the
>> problem disappeared.
>>
>> I think, the host name was automatically generated by the system
>> (sounded like "user-pc" in Russian). That means the problem may be
>> rather common, and it makes sense to encode hostname in UTF-8 before
>> using as lock text.
>
> If your hostname is not UTF-8, how is Subversion to know what character encoding it's using? It seems to me it's a bug (of your OS) to present a non-UTF-8 string (or possibly even a non-ASCII string) as a valid hostname. (My thought is that if a non-ASCII hostname is desired, the UTF-8 representation of the hostname should be encoded in punycode [1] by the OS. But maybe that's just me.)
>
>
> [1] http://en.wikipedia.org/wiki/Punycode
>
>

Re: Cannot accept 'svn:sync-lock' property because it is not encoded in UTF-8

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 18, 2010, at 03:47, Dmitry Savvateev wrote:

> Yes, indeed, the host name contained cyrillics. I changed it, and the
> problem disappeared.
> 
> I think, the host name was automatically generated by the system
> (sounded like "user-pc" in Russian). That means the problem may be
> rather common, and it makes sense to encode hostname in UTF-8 before
> using as lock text.

If your hostname is not UTF-8, how is Subversion to know what character encoding it's using? It seems to me it's a bug (of your OS) to present a non-UTF-8 string (or possibly even a non-ASCII string) as a valid hostname. (My thought is that if a non-ASCII hostname is desired, the UTF-8 representation of the hostname should be encoded in punycode [1] by the OS. But maybe that's just me.)


[1] http://en.wikipedia.org/wiki/Punycode


Re: Cannot accept 'svn:sync-lock' property because it is not encoded in UTF-8

Posted by Dmitry Savvateev <ds...@mail.ru>.
Yes, indeed, the host name contained cyrillics. I changed it, and the
problem disappeared.

I think, the host name was automatically generated by the system
(sounded like "user-pc" in Russian). That means the problem may be
rather common, and it makes sense to encode hostname in UTF-8 before
using as lock text.

Thanks a lot for pointing that out!

Dmitry


2010/3/17 Daniel Shahaf <d....@daniel.shahaf.name>:
> svn:sync-lock is set by svnsync as follows:
>
>  apr_err = apr_gethostname(hostname_str, sizeof(hostname_str), pool);
> ...
>  mylocktoken = svn_string_createf(pool, "%s:%s", hostname_str,
>                                   svn_uuid_generate(pool));
> ...
>          /* Except in the very last iteration, try to set the lock. */
>          SVN_ERR(svn_ra_change_rev_prop(session, 0, SVNSYNC_PROP_LOCK,
>                                         mylocktoken, subpool));
>
> I suppose either _gethostname() or _uuid_generate() return a non-UTF-8
> string for you.
>
> For the short term, you could either change the hostname (assuming that's
> the problem) or hack svnsync so it generates the lock token differently.
> For the long term, we'll have to make sure the 'mylocktoken' is always
> valid UTF-8. (e.g., what is the encoding of hostname_str?)
>
> Daniel
>
> Dmitry Savvateev wrote on Wed, 17 Mar 2010 at 12:40 +0300:
>> Yes, I know that, but svn:sync-lock is a system property added by
>> svnsync during synchronization, to keep the target repository locked.
>> How do I re-encode it?
>>
>> 2010/3/17 Ryan Schmidt <su...@ryandesign.com>:
>> > On Mar 17, 2010, at 00:08, Dmitry Savvateev wrote:
>> >
>> >> I've ran into the following problem with svnsync on Windows Vista.
>> >> I'm trying to mirror a repository from my flash drive to the local
>> >> disk, and keep getting the following message:
>> >>
>> >> svnsync: Cannot accept 'svn:sync-lock' property because it is not
>> >> encoded in UTF-8
>> >>
>> >> What's wrong here? I've been doing the same thing many times before,
>> >> on Windows and Linux, and never seen anything like this.
>> >
>> > Subversion requires properties to be UTF-8. This wasn't enforced before, but now is, as of Subversion 1.6.something, I think. If you have non-UTF-8 properties on old revisions, you have to re-encode them to UTF-8 manually.
>> >
>>
>

Re: Cannot accept 'svn:sync-lock' property because it is not encoded in UTF-8

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
svn:sync-lock is set by svnsync as follows:

  apr_err = apr_gethostname(hostname_str, sizeof(hostname_str), pool);
...
  mylocktoken = svn_string_createf(pool, "%s:%s", hostname_str,
                                   svn_uuid_generate(pool));
...
          /* Except in the very last iteration, try to set the lock. */
          SVN_ERR(svn_ra_change_rev_prop(session, 0, SVNSYNC_PROP_LOCK,
                                         mylocktoken, subpool));

I suppose either _gethostname() or _uuid_generate() return a non-UTF-8 
string for you.

For the short term, you could either change the hostname (assuming that's 
the problem) or hack svnsync so it generates the lock token differently.  
For the long term, we'll have to make sure the 'mylocktoken' is always 
valid UTF-8. (e.g., what is the encoding of hostname_str?)

Daniel

Dmitry Savvateev wrote on Wed, 17 Mar 2010 at 12:40 +0300:
> Yes, I know that, but svn:sync-lock is a system property added by
> svnsync during synchronization, to keep the target repository locked.
> How do I re-encode it?
> 
> 2010/3/17 Ryan Schmidt <su...@ryandesign.com>:
> > On Mar 17, 2010, at 00:08, Dmitry Savvateev wrote:
> >
> >> I've ran into the following problem with svnsync on Windows Vista.
> >> I'm trying to mirror a repository from my flash drive to the local
> >> disk, and keep getting the following message:
> >>
> >> svnsync: Cannot accept 'svn:sync-lock' property because it is not
> >> encoded in UTF-8
> >>
> >> What's wrong here? I've been doing the same thing many times before,
> >> on Windows and Linux, and never seen anything like this.
> >
> > Subversion requires properties to be UTF-8. This wasn't enforced before, but now is, as of Subversion 1.6.something, I think. If you have non-UTF-8 properties on old revisions, you have to re-encode them to UTF-8 manually.
> >
> 

Re: Cannot accept 'svn:sync-lock' property because it is not encoded in UTF-8

Posted by Dmitry Savvateev <ds...@mail.ru>.
Yes, I know that, but svn:sync-lock is a system property added by
svnsync during synchronization, to keep the target repository locked.
How do I re-encode it?

2010/3/17 Ryan Schmidt <su...@ryandesign.com>:
> On Mar 17, 2010, at 00:08, Dmitry Savvateev wrote:
>
>> I've ran into the following problem with svnsync on Windows Vista.
>> I'm trying to mirror a repository from my flash drive to the local
>> disk, and keep getting the following message:
>>
>> svnsync: Cannot accept 'svn:sync-lock' property because it is not
>> encoded in UTF-8
>>
>> What's wrong here? I've been doing the same thing many times before,
>> on Windows and Linux, and never seen anything like this.
>
> Subversion requires properties to be UTF-8. This wasn't enforced before, but now is, as of Subversion 1.6.something, I think. If you have non-UTF-8 properties on old revisions, you have to re-encode them to UTF-8 manually.
>

Re: Cannot accept 'svn:sync-lock' property because it is not encoded in UTF-8

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 17, 2010, at 00:08, Dmitry Savvateev wrote:

> I've ran into the following problem with svnsync on Windows Vista.
> I'm trying to mirror a repository from my flash drive to the local
> disk, and keep getting the following message:
> 
> svnsync: Cannot accept 'svn:sync-lock' property because it is not
> encoded in UTF-8
> 
> What's wrong here? I've been doing the same thing many times before,
> on Windows and Linux, and never seen anything like this.

Subversion requires properties to be UTF-8. This wasn't enforced before, but now is, as of Subversion 1.6.something, I think. If you have non-UTF-8 properties on old revisions, you have to re-encode them to UTF-8 manually.