[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: bug: TortoiseSVN refuses valid property names

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Mon, 16 Jan 2012 19:09:03 +0100

On Mon, Jan 16, 2012 at 16:07, Garret Wilson <garret_at_globalmentor.com> wrote:
> On 1/16/2012 2:01 AM, Stefan Küng wrote:
>
>
> Not just TSVN. All svn clients that use the svn library do not.
> While the svn server behaves as much as DAV server as it can, there
> are some differences. And svn clients first check svn properties for
> validity in svn before they can be set. Your property is a valid DAV
> property, but not a valid svn property. You might be able to set that
> property with non-official clients, but that doesn't make them valid.
>
>
> OK, that makes sense, but that still leaves the question: what is it about
> this property that makes it invalid? Here's the property here in case it got
> lost in the thread:
>
> http·3a·2f·2fpurl.org·2fdc·2felements·2f1.1·2ftitle
>

this fails the test (the svn library tests the property names for
valid chars) on the first non-alphanumeric char. your property name is
properly utf-8 encoded by TSVN to:
http·3a·2f·2fpurl.org·2fdc·2felements·2f1.1·2ftitle
but the test then fails on the  char.

the test is done in libsvn_subr\properties.c, function svn_prop_name_is_valid():

svn_boolean_t
svn_prop_name_is_valid(const char *prop_name)
{
  const char *p = prop_name;

  /* The characters we allow use identical representations in UTF8
     and ASCII, so we can just test for the appropriate ASCII codes.
     But we can't use standard C character notation ('A', 'B', etc)
     because there's no guarantee that this C environment is using
     ASCII. */

  if (!(svn_ctype_isalpha(*p)
        || *p == SVN_CTYPE_ASCII_COLON
        || *p == SVN_CTYPE_ASCII_UNDERSCORE))
    return FALSE;
  p++;
  for (; *p; p++)
    {
      if (!(svn_ctype_isalnum(*p)
            || *p == SVN_CTYPE_ASCII_MINUS
            || *p == SVN_CTYPE_ASCII_DOT
            || *p == SVN_CTYPE_ASCII_COLON
            || *p == SVN_CTYPE_ASCII_UNDERSCORE))
        return FALSE;
    }
  return TRUE;
}

> svn properties must be utf8 encoded. And that's mentioned in every doc about
> svn properties.
>
>
> Well, that's interesting, because I assumed that TortoiseSVN would do the
> UTF-8 encoding for me automatically for property names. After all, it does
> the UTF-8 encoding automatically for property values, right?

Not quite: property values are actually binary. You could set a
property to an image (you can pass a path to a file that's used as the
property value).
So no encoding is done there at all.

Stefan

-- 
       ___
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2909194
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2012-01-16 19:09:29 CET

This is an archived mail posted to the TortoiseSVN Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.