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

Re: svn commit: r23282 - in trunk/subversion/svn: . schema

From: Hyrum K. Wright <hyrum_wright_at_mail.utexas.edu>
Date: 2007-01-30 21:50:52 CET

Daniel Rall wrote:
> On Tue, 30 Jan 2007, Hyrum K. Wright wrote:
>
>> Peter Lundblad wrote:
...
>>>> Modified: trunk/subversion/svn/props.c
>>>> @@ -106,3 +107,50 @@
>>>>
>>>> return SVN_NO_ERROR;
>>>> }
>>>> +
>>>> +svn_error_t *
>>>> +svn_cl__print_xml_prop_hash(svn_stringbuf_t **outstr,
>>>> + apr_hash_t *prop_hash,
>>>> + svn_boolean_t names_only,
>>>> + apr_pool_t *pool)
>>>> +{
>>>> + apr_hash_index_t *hi;
>>>> +
>>>> + if (*outstr == NULL)
>>>> + *outstr = svn_stringbuf_create("", pool);
>>>> +
>>>> + for (hi = apr_hash_first(pool, prop_hash); hi; hi = apr_hash_next(hi))
>>>> + {
>>>> + const void *key;
>>>> + void *val;
>>>> + const char *pname;
>>>> + svn_string_t *propval;
>>>> +
>>>> + apr_hash_this(hi, &key, NULL, &val);
>>>> + pname = key;
>>>> + propval = val;
>>>> +
>>>> + if (names_only)
>>>> + {
>>>> + svn_xml_make_open_tag(outstr, pool, svn_xml_self_closing, "property",
>>>> + "name", pname, NULL);
>>>> + }
>>>> + else
>>>> + {
>>>> + const char *pname_out;
>>>> +
>>>> + if (svn_prop_needs_translation(pname))
>>>> + SVN_ERR(svn_subst_detranslate_string(&propval, propval,
>>>> + TRUE, pool));
>>>> +
>>>> + SVN_ERR(svn_cmdline_cstring_from_utf8(&pname_out, pname, pool));
>>>> +
>>>> + svn_xml_make_open_tag(outstr, pool, svn_xml_protect_pcdata,
>>>> + "property", "name", pname, NULL);
>>>> + svn_xml_escape_cdata_string(outstr, propval, pool);
>>> If we have a property that doesn't start with "svn:", we can't assume
>>> that it is valid UTF8, so this call will produce non-well-formed XML.
>>> This is also the case if the value contains characters that are not legal in
>>> XML, such as certain control characters.
>>> So, we need to encode values that are not well-formed, in a similar way that
>>> we do in our DAV implementation.
>> Would something like the following patch address the problem?
>
> Seems okay to me, but I'm not particularly familiar with this area of
> the libraries, either.

After some local testing, this solution appears to work. I've committed it in r23296.

-Hyrum

Received on Tue Jan 30 21:51:18 2007

This is an archived mail posted to the Subversion Dev mailing list.

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