Author: kotkov
Date: Fri Sep 8 22:27:33 2017
New Revision: 1807834
URL: http://svn.apache.org/viewvc?rev=1807834&view=rev
Log:
Introduce a new error code that allows distinguishing invalid property
values with non-LF line endings.
This lays the necessary groundwork for the `svnadmin load --normalize-props`
implementation. To keep our existing API promises in functions such as
svn_repos_fs_change_node_prop(), where we say that the existing error
code (SVN_ERR_BAD_PROPERTY_VALUE) will be returned in case of any
invalid properties, we would only add the new error code to the bottom
of the chain, while still keeping the original error code first in the chain.
* subversion/include/svn_error_codes.h
(SVN_ERR_BAD_PROPERTY_VALUE_EOL): New.
* subversion/libsvn_repos/fs-wrap.c
(svn_repos__validate_prop): Return the new error code when encountering
property values with non-LF line endings. Keep the original error code
(SVN_ERR_BAD_PROPERTY_VALUE) in the top of the error chain.
Modified:
subversion/trunk/subversion/include/svn_error_codes.h
subversion/trunk/subversion/libsvn_repos/fs-wrap.c
Modified: subversion/trunk/subversion/include/svn_error_codes.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_error_codes.h?rev=1807834&r1=1807833&r2=1807834&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_error_codes.h (original)
+++ subversion/trunk/subversion/include/svn_error_codes.h Fri Sep 8 22:27:33
2017
@@ -240,6 +240,11 @@ SVN_ERROR_START
SVN_ERR_BAD_CATEGORY_START + 16,
"Invalid compression method")
+ /** @since New in 1.10. */
+ SVN_ERRDEF(SVN_ERR_BAD_PROPERTY_VALUE_EOL,
+ SVN_ERR_BAD_CATEGORY_START + 17,
+ "Unexpected line ending in the property value")
+
/* xml errors */
SVN_ERRDEF(SVN_ERR_XML_ATTRIB_NOT_FOUND,
Modified: subversion/trunk/subversion/libsvn_repos/fs-wrap.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/fs-wrap.c?rev=1807834&r1=1807833&r2=1807834&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/fs-wrap.c (original)
+++ subversion/trunk/subversion/libsvn_repos/fs-wrap.c Fri Sep 8 22:27:33 2017
@@ -235,10 +235,13 @@ svn_repos__validate_prop(const char *nam
* carriage return characters ('\r'). */
if (strchr(value->data, '\r') != NULL)
{
- return svn_error_createf
- (SVN_ERR_BAD_PROPERTY_VALUE, NULL,
+ svn_error_t *err = svn_error_createf
+ (SVN_ERR_BAD_PROPERTY_VALUE_EOL, NULL,
_("Cannot accept non-LF line endings in '%s' property"),
name);
+
+ return svn_error_create(SVN_ERR_BAD_PROPERTY_VALUE, err,
+ _("Invalid property value"));
}
}