subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1229888 - /subversion/trunk/subversion/libsvn_client/prop_commands.c
Date Wed, 11 Jan 2012 04:02:36 GMT
Author: hwright
Date: Wed Jan 11 04:02:35 2012
New Revision: 1229888

URL: http://svn.apache.org/viewvc?rev=1229888&view=rev
Log:
Fix a potential editor violation when setting properties on a file URL.

* subversion/libsvn_client/prop_commands.c
  (do_url_propset): Add param for the URL being set, and if a file, use
    its basename to do the setting.
  (propset_on_url): If the target is a file, we need to anchor the edit
    at its parent, since all good editor drives have a directory at the root.

Modified:
    subversion/trunk/subversion/libsvn_client/prop_commands.c

Modified: subversion/trunk/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/prop_commands.c?rev=1229888&r1=1229887&r2=1229888&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/prop_commands.c Wed Jan 11 04:02:35 2012
@@ -117,7 +117,8 @@ get_file_for_validation(const svn_string
 
 static
 svn_error_t *
-do_url_propset(const char *propname,
+do_url_propset(const char *url,
+               const char *propname,
                const svn_string_t *propval,
                const svn_node_kind_t kind,
                const svn_revnum_t base_revision_for_url,
@@ -133,7 +134,9 @@ do_url_propset(const char *propname,
   if (kind == svn_node_file)
     {
       void *file_baton;
-      SVN_ERR(editor->open_file("", root_baton, base_revision_for_url,
+      const char *basename = svn_uri_basename(url, pool);
+
+      SVN_ERR(editor->open_file(basename, root_baton, base_revision_for_url,
                                 pool, &file_baton));
       SVN_ERR(editor->change_file_prop(file_baton, propname, propval, pool));
       SVN_ERR(editor->close_file(file_baton, NULL, pool));
@@ -186,6 +189,18 @@ propset_on_url(const char *propname,
        _("Path '%s' does not exist in revision %ld"),
        target, base_revision_for_url);
 
+  if (node_kind == svn_node_file)
+    {
+      /* We need to reparent our session one directory up, since editor
+         semantics require the root is a directory.
+
+         ### How does this interact with authz? */
+      const char *parent_url;
+      parent_url = svn_uri_dirname(target, pool);
+
+      SVN_ERR(svn_ra_reparent(ra_session, parent_url, pool));
+    }
+
   /* Setting an inappropriate property is not allowed (unless
      overridden by 'skip_checks', in some circumstances).  Deleting an
      inappropriate property is allowed, however, since older clients
@@ -234,8 +249,8 @@ propset_on_url(const char *propname,
                                     NULL, TRUE, /* No lock tokens */
                                     pool));
 
-  err = do_url_propset(propname, propval, node_kind, base_revision_for_url,
-                       editor, edit_baton, pool);
+  err = do_url_propset(target, propname, propval, node_kind,
+                       base_revision_for_url, editor, edit_baton, pool);
 
   if (err)
     {



Mime
View raw message