You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Shahaf <d....@daniel.shahaf.name> on 2008/09/17 12:42:21 UTC

[PATCH] Issue #2748: non-UTF-8 filenames in the repository

Patch for issue #2748 ("clients can create non UTF-8 filenames in the 
repository").  It prevents non-UTF-8 paths from entering the repository, 
but it doesn't affect existing files in existing repositories, svnsync,
or 'svnadmin load'.

I'm running 'make check' now, and I'll commit later today or tomorrow if
I don't hear anything.

Daniel

[[[
Validate in libsvn_repos that paths added to the repository are valid UTF-8.
This fixes issue #2748.

TODO: update callers of svn_path_check_valid

* subversion/libsvn_repos/commit.c
  (add_directory, add_file):
    Validate incoming paths for UTF-8 using svn_path_check_valid2().

* subversion/include/svn_path.h
  (svn_path_check_valid2):  New.
  (svn_path_check_valid):   Deprecate.

* subversion/libsvn_subr/path.c
  (utf_impl.h):  Include.
  (svn_path_check_valid2):  New.
  (svn_path_check_valid):   Deprecate.

* subversion/tests/libsvn_repos/repos-test.c
  (prop_validation_commit_with_revprop): Renamed to...
  (commit_path_with_revprops):  ... this.
    Also, add KIND parameter, and make PROP_KEY optional.
  (prop_validation):
    Track rename and extension of prop_validation_commit_with_revprop().
  (paths_are_UTF_8):  New test.
  (test_funcs):  Run paths_are_UTF_8 as PASS.
]]]

Index: subversion/libsvn_subr/path.c
===================================================================
--- subversion/libsvn_subr/path.c	(revision 33124)
+++ subversion/libsvn_subr/path.c	(working copy)
@@ -31,6 +31,7 @@
 #include "svn_io.h"                     /* for svn_io_stat() */
 #include "svn_ctype.h"
 
+#include "utf_impl.h"                   /* for svn_utf__cstring_is_valid() */
 
 /* The canonical empty path.  Can this be changed?  Well, change the empty
    test below and the path library will work, not so sure about the fs/wc
@@ -1461,10 +1462,20 @@ illegal_path_escape(const char *path, apr_pool_t *
 }
 
 svn_error_t *
-svn_path_check_valid(const char *path, apr_pool_t *pool)
+svn_path_check_valid2(const char *path, svn_boolean_t assume_utf8,
+                      apr_pool_t *pool)
 {
   const char *c;
 
+  if (assume_utf8 == FALSE
+      && svn_utf__cstring_is_valid(path) == FALSE)
+    {
+      return svn_error_createf
+        (SVN_ERR_FS_PATH_SYNTAX, NULL,
+         _("Path '%s' is not valid UTF-8"),
+         illegal_path_escape(svn_path_local_style(path, pool), pool));
+    }
+
   for (c = path; *c; c++)
     {
       if (svn_ctype_iscntrl(*c))
@@ -1480,6 +1491,12 @@ svn_error_t *
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_path_check_valid(const char *path, apr_pool_t *pool)
+{
+  return svn_path_check_valid2(path, TRUE, pool);
+}
+
 void
 svn_path_splitext(const char **path_root,
                   const char **path_ext,
Index: subversion/tests/libsvn_repos/repos-test.c
===================================================================
--- subversion/tests/libsvn_repos/repos-test.c	(revision 33124)
+++ subversion/tests/libsvn_repos/repos-test.c	(working copy)
@@ -2189,52 +2189,56 @@ reporter_depth_exclude(const char **msg,
 
 
 
-/* Test if prop values received by the server are validated.
- * These tests "send" property values to the server and diagnose the
- * behaviour.
- */
+/* Test validation of properties and path names by the server. */
 
 /* Helper function that makes an arbitrary change to a given repository
  * REPOS and runs a commit with a specific revision property set to a
  * certain value. The property name, type and value are given in PROP_KEY,
  * PROP_KLEN and PROP_VAL, as in apr_hash_set(), using a const char* key.
  *
- * The FILENAME argument names a file in the test repository to add in
- * this commit, e.g. "/A/should_fail_1".
+ * If PROP_KEY is NULL, no revision property is set.
  *
+ * The PATH argument names an object in the test repository to add in
+ * this commit, e.g. "/A/should_fail_1".  The object will be a file or
+ * a directory according to KIND being svn_node_file or svn_node_dir.
+ *
  * On success, the given file is added to the repository. So, using
  * the same name multiple times on the same repository might fail. Thus,
  * use different FILENAME arguments for every call to this function
  * (e.g. "/A/f1", "/A/f2", "/A/f3" etc).
  */
 static svn_error_t *
-prop_validation_commit_with_revprop(const char *filename,
-                                    const char *prop_key,
-                                    apr_ssize_t prop_klen,
-                                    const svn_string_t *prop_val,
-                                    svn_repos_t *repos,
-                                    apr_pool_t *pool)
+commit_path_with_revprops(const char *path,
+                          svn_node_kind_t kind,
+                          const char *prop_key,
+                          apr_ssize_t prop_klen,
+                          const svn_string_t *prop_val,
+                          svn_repos_t *repos,
+                          apr_pool_t *pool)
 {
   const svn_delta_editor_t *editor;
   void *edit_baton;
   void *root_baton;
-  void *file_baton;
 
   /* Prepare revision properties */
   apr_hash_t *revprop_table = apr_hash_make(pool);
 
+  /* Validate input. */
+  SVN_ERR_ASSERT(kind == svn_node_file || kind == svn_node_dir);
+
   /* Add the requested property */
-  apr_hash_set(revprop_table, prop_key, prop_klen, prop_val);
+  if (prop_key)
+    apr_hash_set(revprop_table, prop_key, prop_klen, prop_val);
 
   /* Set usual author and log props, if not set already */
-  if (strcmp(prop_key, SVN_PROP_REVISION_AUTHOR) != 0)
+  if (prop_key != NULL && strcmp(prop_key, SVN_PROP_REVISION_AUTHOR) != 0)
     {
       apr_hash_set(revprop_table, SVN_PROP_REVISION_AUTHOR,
                    APR_HASH_KEY_STRING,
                    svn_string_create("plato", pool));
     }
   else
-    if (strcmp(prop_key, SVN_PROP_REVISION_LOG) != 0)
+    if (prop_key != NULL && strcmp(prop_key, SVN_PROP_REVISION_LOG) != 0)
       {
         apr_hash_set(revprop_table, SVN_PROP_REVISION_LOG,
                      APR_HASH_KEY_STRING,
@@ -2250,12 +2254,27 @@ static svn_error_t *
 
   SVN_ERR(editor->open_root(edit_baton, 0, pool, &root_baton));
 
-  SVN_ERR(editor->add_file(filename, root_baton, NULL,
-                           SVN_INVALID_REVNUM, pool,
-                           &file_baton));
+  if (kind == svn_node_file)
+    {
+      void *file_baton;
 
-  SVN_ERR(editor->close_file(file_baton, NULL, pool));
+      SVN_ERR(editor->add_file(path, root_baton, NULL,
+                               SVN_INVALID_REVNUM, pool,
+                               &file_baton));
 
+      SVN_ERR(editor->close_file(file_baton, NULL, pool));
+    }
+  else if (kind == svn_node_dir)
+    {
+      void *dir_baton;
+
+      SVN_ERR(editor->add_directory(path, root_baton, NULL,
+                                    SVN_INVALID_REVNUM, pool,
+                                    &dir_baton));
+
+      SVN_ERR(editor->close_directory(dir_baton, pool));
+    }
+
   SVN_ERR(editor->close_directory(root_baton, pool));
 
   SVN_ERR(editor->close_edit(edit_baton, pool));
@@ -2291,8 +2310,8 @@ prop_validation(const char **msg,
 
 
   /* Test an invalid commit log message: UTF-8 */
-  err = prop_validation_commit_with_revprop
-            ("/non_utf8_log_msg",
+  err = commit_path_with_revprops
+            ("/non_utf8_log_msg", svn_node_file,
              SVN_PROP_REVISION_LOG, APR_HASH_KEY_STRING,
              svn_string_create(non_utf8_string, subpool),
              repos, subpool);
@@ -2311,8 +2330,8 @@ prop_validation(const char **msg,
 
 
   /* Test an invalid commit log message: LF */
-  err = prop_validation_commit_with_revprop
-            ("/non_lf_log_msg",
+  err = commit_path_with_revprops
+            ("/non_lf_log_msg", svn_node_file,
              SVN_PROP_REVISION_LOG, APR_HASH_KEY_STRING,
              svn_string_create(non_lf_string, subpool),
              repos, subpool);
@@ -2337,6 +2356,71 @@ prop_validation(const char **msg,
 }
 
 
+/* Committing non-UTF-8 paths should fail. */
+static svn_error_t *
+paths_are_UTF_8(const char **msg,
+                svn_boolean_t msg_only,
+                svn_test_opts_t *opts,
+                apr_pool_t *pool)
+{
+  svn_error_t *err;
+  svn_repos_t *repos;
+  const char non_utf8_string[] = { 'a', 0xff, 'b', 0 };
+  apr_pool_t *subpool = svn_pool_create(pool);
+
+  *msg = "test if paths are validated for UTF-8";
+
+  if (msg_only)
+    return SVN_NO_ERROR;
+
+  /* Create a filesystem and repository. */
+  SVN_ERR(svn_test__create_repos(&repos, "test-repo-path-validation",
+                                 opts, subpool));
+
+
+  /* The next two blocks of code are identical (up to s/file/dir/). */
+
+  /* Commit a non-UTF-8 file. */
+  err = commit_path_with_revprops(non_utf8_string, svn_node_file,
+                                  NULL, 0, NULL,
+                                  repos, subpool);
+  if (err == SVN_NO_ERROR)
+    {
+      return svn_error_create(SVN_ERR_TEST_FAILED, err,
+                              "Failed to reject a non-UTF-8 file");
+    }
+  else if (err->apr_err != SVN_ERR_FS_PATH_SYNTAX)
+    {
+      return svn_error_create(SVN_ERR_TEST_FAILED, err,
+                              "Unexpected error code for non-UTF-8 file");
+    }
+  else
+    svn_error_clear(err);
+
+  /* Commit a non-UTF-8 dir. */
+  err = commit_path_with_revprops(non_utf8_string, svn_node_dir,
+                                  NULL, 0, NULL,
+                                  repos, subpool);
+  if (err == SVN_NO_ERROR)
+    {
+      return svn_error_create(SVN_ERR_TEST_FAILED, err,
+                              "Failed to reject a non-UTF-8 dir");
+    }
+  else if (err->apr_err != SVN_ERR_FS_PATH_SYNTAX)
+    {
+      return svn_error_create(SVN_ERR_TEST_FAILED, err,
+                              "Unexpected error code for non-UTF-8 dir");
+    }
+  else
+    svn_error_clear(err);
+
+  /* Done. */
+  svn_pool_destroy(subpool);
+
+  return SVN_NO_ERROR;
+}
+
+
 
 /* The test table.  */
 
@@ -2355,5 +2439,6 @@ struct svn_test_descriptor_t test_funcs[] =
     SVN_TEST_PASS(node_location_segments),
     SVN_TEST_PASS(reporter_depth_exclude),
     SVN_TEST_PASS(prop_validation),
+    SVN_TEST_PASS(paths_are_UTF_8),
     SVN_TEST_NULL
   };
Index: subversion/include/svn_path.h
===================================================================
--- subversion/include/svn_path.h	(revision 33124)
+++ subversion/include/svn_path.h	(working copy)
@@ -437,16 +437,27 @@ svn_path_is_ancestor(const char *path1, const char
  * a repository.  There may be other, OS-specific, limitations on
  * what paths can be represented in a working copy.
  *
- * ASSUMPTION: @a path is a valid UTF-8 string.  This function does
- * not check UTF-8 validity.
+ * When @a assume_utf8 is @c TRUE, assume that @a path is a valid
+ * UTF-8 string and do not check UTF-8 validity.
  *
  * Return @c SVN_NO_ERROR if valid and @c SVN_ERR_FS_PATH_SYNTAX if
  * invalid.
  *
- * @since New in 1.2.
+ * @since New in 1.6.
  */
-svn_error_t *svn_path_check_valid(const char *path, apr_pool_t *pool);
+svn_error_t *
+svn_path_check_valid2(const char *path, svn_boolean_t assume_utf8,
+                      apr_pool_t *pool);
 
+/**
+ * Similar to svn_path_check_valid2(), but with @a assume_utf8 set to @c TRUE.
+ *
+ * @deprecated Provided for backward compatibility with the 1.5 API.
+ */
+SVN_DEPRECATED
+svn_error_t *
+svn_path_check_valid(const char *path, apr_pool_t *pool);
+
 
 /** URI/URL stuff
  *
Index: subversion/libsvn_repos/commit.c
===================================================================
--- subversion/libsvn_repos/commit.c	(revision 33124)
+++ subversion/libsvn_repos/commit.c	(working copy)
@@ -295,6 +295,9 @@ add_directory(const char *path,
       (SVN_ERR_FS_GENERAL, NULL,
        _("Got source path but no source revision for '%s'"), full_path);
 
+  /* Validate for UTF-8. */
+  SVN_ERR(svn_path_check_valid2(path, FALSE, pool));
+
   if (copy_path)
     {
       const char *fs_path;
@@ -440,6 +443,9 @@ add_file(const char *path,
       (SVN_ERR_FS_GENERAL, NULL,
        _("Got source path but no source revision for '%s'"), full_path);
 
+  /* Validate for UTF-8. */
+  SVN_ERR(svn_path_check_valid2(path, FALSE, pool));
+
   if (copy_path)
     {
       const char *fs_path;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH v2] Issue #2748: non-UTF-8 filenames in the repository

Posted by "C. Michael Pilato" <cm...@collab.net>.
> Great.  Committed r33148.

I'm late to the party, but +1 on this.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand


Re: [PATCH v2] Issue #2748: non-UTF-8 filenames in the repository

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
> > @@ -324,6 +326,28 @@ default_warning_func(void *baton, svn_error_t *err
> >    abort();
> >  }
> >  
> > +static svn_error_t *
> > +path_valid(const char *path, apr_pool_t *pool)
> 
> Please add a doc-string.
> 

It was in the header file, but then I made the function file-local and
forgot to move it here.  Fixed.

> > +      return svn_error_createf(SVN_ERR_FS_PATH_SYNTAX, NULL,
> > +                               _("Path '%s' contains '.' or '..' element"));
> 
> You have to supply a 'path' argument to correspond to the '%s' !
> 
> (Some compilers - at least GCC - ought to warn you of that, I think.)
> 

Fixed.

> The rest looks good.
> 
> - Julian
> 

Great.  Committed r33148.

Thanks,

Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH v2] Issue #2748: non-UTF-8 filenames in the repository

Posted by Julian Foad <ju...@btopenworld.com>.
On Wed, 2008-09-17 at 22:14 +0300, Daniel Shahaf wrote:
> Daniel Shahaf wrote on Wed, 17 Sep 2008 at 15:42 +0300:
> > Patch for issue #2748 ("clients can create non UTF-8 filenames in the 
> > repository").
> 
> New iteration.  It moves the logic to libsvn_fs and doesn't touch 
> svn_path_check_valid().  No tests included this time (but I could write 
> one if the rest looks good).
> 
> Daniel
> 
> [[[
> Enforce the requirement that paths added to the filesystem must be in UTF-8.
> This fixes issue #2748.
> 
> * subversion/libsvn_fs/fs-loader.c
>   (svn_utf_private.h):  Include.
>   (path_valid):  New helper.
>   (svn_fs_make_dir, svn_fs_make_file, svn_fs_copy):
>     Call path_valid() instead of svn_path_check_valid().
> 
> * subversion/include/svn_path.h,
>   subversion/libsvn_subr/path.c
>   (svn_path_is_dotpath_present):
>     New, similar to svn_path_is_backpath_present().
> 
> * subversion/include/svn_path.h
>   (svn_path_check_valid):
>     Clarify that this function is unrelated to the FS layer's concept of
>     validty.
> 
> * subversion/libsvn_subr/utf_impl.h
>   (svn_utf__cstring_is_valid):  Move the declaration ...
> 
> * subversion/include/private/svn_utf_private.h
>   (svn_utf__cstring_is_valid):  ... here.
> ]]]
> 
> Index: subversion/libsvn_fs/fs-loader.c
> ===================================================================
> --- subversion/libsvn_fs/fs-loader.c	(revision 33124)
> +++ subversion/libsvn_fs/fs-loader.c	(working copy)
> @@ -34,6 +34,8 @@
>  #include "svn_md5.h"
>  #include "svn_private_config.h"
>  
> +#include "private/svn_utf_private.h"
> +
>  #include "fs-loader.h"
>  
>  /* This is defined by configure on platforms which use configure, but
> @@ -324,6 +326,28 @@ default_warning_func(void *baton, svn_error_t *err
>    abort();
>  }
>  
> +static svn_error_t *
> +path_valid(const char *path, apr_pool_t *pool)

Please add a doc-string.

> +{
> +  /* UTF-8 encoded string without NULs. */
> +  if (! svn_utf__cstring_is_valid(path))
> +    {
> +      return svn_error_createf(SVN_ERR_FS_PATH_SYNTAX, NULL,
> +                               _("Path '%s' is not in UTF-8"), path);
> +    }
> +
> +  /* No "." or ".." elements. */
> +  if (svn_path_is_backpath_present(path)
> +      || svn_path_is_dotpath_present(path))
> +    {
> +      return svn_error_createf(SVN_ERR_FS_PATH_SYNTAX, NULL,
> +                               _("Path '%s' contains '.' or '..' element"));

You have to supply a 'path' argument to correspond to the '%s' !

(Some compilers - at least GCC - ought to warn you of that, I think.)

The rest looks good.

- Julian



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

[PATCH v2] Issue #2748: non-UTF-8 filenames in the repository

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Daniel Shahaf wrote on Wed, 17 Sep 2008 at 15:42 +0300:
> Patch for issue #2748 ("clients can create non UTF-8 filenames in the 
> repository").

New iteration.  It moves the logic to libsvn_fs and doesn't touch 
svn_path_check_valid().  No tests included this time (but I could write 
one if the rest looks good).

Daniel

[[[
Enforce the requirement that paths added to the filesystem must be in UTF-8.
This fixes issue #2748.

* subversion/libsvn_fs/fs-loader.c
  (svn_utf_private.h):  Include.
  (path_valid):  New helper.
  (svn_fs_make_dir, svn_fs_make_file, svn_fs_copy):
    Call path_valid() instead of svn_path_check_valid().

* subversion/include/svn_path.h,
  subversion/libsvn_subr/path.c
  (svn_path_is_dotpath_present):
    New, similar to svn_path_is_backpath_present().

* subversion/include/svn_path.h
  (svn_path_check_valid):
    Clarify that this function is unrelated to the FS layer's concept of
    validty.

* subversion/libsvn_subr/utf_impl.h
  (svn_utf__cstring_is_valid):  Move the declaration ...

* subversion/include/private/svn_utf_private.h
  (svn_utf__cstring_is_valid):  ... here.
]]]

Index: subversion/libsvn_fs/fs-loader.c
===================================================================
--- subversion/libsvn_fs/fs-loader.c	(revision 33124)
+++ subversion/libsvn_fs/fs-loader.c	(working copy)
@@ -34,6 +34,8 @@
 #include "svn_md5.h"
 #include "svn_private_config.h"
 
+#include "private/svn_utf_private.h"
+
 #include "fs-loader.h"
 
 /* This is defined by configure on platforms which use configure, but
@@ -324,6 +326,28 @@ default_warning_func(void *baton, svn_error_t *err
   abort();
 }
 
+static svn_error_t *
+path_valid(const char *path, apr_pool_t *pool)
+{
+  /* UTF-8 encoded string without NULs. */
+  if (! svn_utf__cstring_is_valid(path))
+    {
+      return svn_error_createf(SVN_ERR_FS_PATH_SYNTAX, NULL,
+                               _("Path '%s' is not in UTF-8"), path);
+    }
+
+  /* No "." or ".." elements. */
+  if (svn_path_is_backpath_present(path)
+      || svn_path_is_dotpath_present(path))
+    {
+      return svn_error_createf(SVN_ERR_FS_PATH_SYNTAX, NULL,
+                               _("Path '%s' contains '.' or '..' element"));
+    }
+
+  /* That's good enough. */
+  return SVN_NO_ERROR;
+}
+
 /* This API is publicly deprecated, but we continue to use it
    internally to properly allocate svn_fs_t structures. */
 svn_fs_t *
@@ -866,7 +890,7 @@ svn_fs_dir_entries(apr_hash_t **entries_p, svn_fs_
 svn_error_t *
 svn_fs_make_dir(svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 {
-  SVN_ERR(svn_path_check_valid(path, pool));
+  SVN_ERR(path_valid(path, pool));
   return root->vtable->make_dir(root, path, pool);
 }
 
@@ -880,7 +904,7 @@ svn_error_t *
 svn_fs_copy(svn_fs_root_t *from_root, const char *from_path,
             svn_fs_root_t *to_root, const char *to_path, apr_pool_t *pool)
 {
-  SVN_ERR(svn_path_check_valid(to_path, pool));
+  SVN_ERR(path_valid(to_path, pool));
   return to_root->vtable->copy(from_root, from_path, to_root, to_path, pool);
 }
 
@@ -950,7 +974,7 @@ svn_fs_file_contents(svn_stream_t **contents, svn_
 svn_error_t *
 svn_fs_make_file(svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 {
-  SVN_ERR(svn_path_check_valid(path, pool));
+  SVN_ERR(path_valid(path, pool));
   return root->vtable->make_file(root, path, pool);
 }
 
Index: subversion/libsvn_subr/utf_impl.h
===================================================================
--- subversion/libsvn_subr/utf_impl.h	(revision 33124)
+++ subversion/libsvn_subr/utf_impl.h	(working copy)
@@ -50,9 +50,6 @@ const char *svn_utf__cstring_from_utf8_fuzzy(const
  */
 const char *svn_utf__last_valid(const char *src, apr_size_t len);
 
-/* As for svn_utf__is_valid but SRC is NULL terminated. */
-svn_boolean_t svn_utf__cstring_is_valid(const char *src);
-
 /* As for svn_utf__last_valid but uses a different implementation without
    lookup tables.  It avoids the table memory use (about 400 bytes) but the
    function is longer (about 200 bytes extra) and likely to be slower when
Index: subversion/libsvn_subr/path.c
===================================================================
--- subversion/libsvn_subr/path.c	(revision 33124)
+++ subversion/libsvn_subr/path.c	(working copy)
@@ -842,6 +842,26 @@ svn_path_is_single_path_component(const char *name
 
 
 svn_boolean_t
+svn_path_is_dotpath_present(const char *path)
+{
+  int len = strlen(path);
+
+  if (! strcmp(path, "."))
+    return TRUE;
+
+  if (! strncmp(path, "./", 2))
+    return TRUE;
+
+  if (strstr(path, "/./") != NULL)
+    return TRUE;
+
+  if (path[len - 2] == '/' && path[len - 1] == '.')
+    return TRUE;
+
+  return FALSE;
+}
+
+svn_boolean_t
 svn_path_is_backpath_present(const char *path)
 {
   int len = strlen(path);
Index: subversion/include/svn_path.h
===================================================================
--- subversion/include/svn_path.h	(revision 33124)
+++ subversion/include/svn_path.h	(working copy)
@@ -396,6 +396,16 @@ svn_boolean_t svn_path_is_single_path_component(co
 svn_boolean_t svn_path_is_backpath_present(const char *path);
 
 
+/**
+ * Test to see if a dotpath, i.e. '.', is present in @a path.
+ * If not, return @c FALSE.
+ * If so, return @c TRUE.
+ *
+ * @since New in 1.6.
+ */
+svn_boolean_t svn_path_is_dotpath_present(const char *path);
+
+
 /** Test if @a path2 is a child of @a path1.
  * If not, return @c NULL.
  * If so, return a copy of the remainder path, allocated in @a pool.
@@ -443,6 +453,9 @@ svn_path_is_ancestor(const char *path1, const char
  * Return @c SVN_NO_ERROR if valid and @c SVN_ERR_FS_PATH_SYNTAX if
  * invalid.
  *
+ * @note Despite returning an @c SVN_ERR_FS_* error, this function has
+ * nothing to do with the versioned filesystem's concept of validity.
+ *
  * @since New in 1.2.
  */
 svn_error_t *svn_path_check_valid(const char *path, apr_pool_t *pool);
Index: subversion/include/private/svn_utf_private.h
===================================================================
--- subversion/include/private/svn_utf_private.h	(revision 33124)
+++ subversion/include/private/svn_utf_private.h	(working copy)
@@ -34,7 +34,10 @@ extern "C" {
 svn_boolean_t
 svn_utf__is_valid(const char *src, apr_size_t len);
 
+/* As for svn_utf__is_valid but SRC is NULL terminated. */
+svn_boolean_t svn_utf__cstring_is_valid(const char *src);
 
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Issue #2748: non-UTF-8 filenames in the repository

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
> > Index: subversion/include/svn_path.h
> > ===================================================================
> > --- subversion/include/svn_path.h	(revision 33124)
> > +++ subversion/include/svn_path.h	(working copy)
> > @@ -437,16 +437,27 @@ svn_path_is_ancestor(const char *path1, const char
> >   * a repository.  There may be other, OS-specific, limitations on
> >   * what paths can be represented in a working copy.
> >   *
> > - * ASSUMPTION: @a path is a valid UTF-8 string.  This function does
> > - * not check UTF-8 validity.
> > + * When @a assume_utf8 is @c TRUE, assume that @a path is a valid
> > + * UTF-8 string and do not check UTF-8 validity.
> [...]
> > -svn_error_t *svn_path_check_valid(const char *path, apr_pool_t *pool);
> > +svn_error_t *
> > +svn_path_check_valid2(const char *path, svn_boolean_t assume_utf8,
> > +                      apr_pool_t *pool);
> 
> This is ugly! Our main "validate a path" API should not have an option
> for allowing invalid paths.
> 

When assume_utf8 is False, the new API is equivalent to the existing one
(prior to the revving), and when assume_utf8 is True, the new API
explicitly checks for valid UTF-8 (and errors if it is invalid).

So, if that option is here, it has been here since 1.2 at least (when
svn_path_check_valid was added) -- it's not something I introduced.

> When an API says it assumes and does not check something, I understand
> that to mean it's a requirement on the caller, not that it's permissible
> to violate the assumption. I understand "does not check" as being a note
> about the current implementation, to reinforce the message that it's the
> caller's responsibility.
> 

Agreed.  And I only added a flag that makes the function do that check for
the caller.  It was just for convenience (read: laziness).  Existing
callers that do the checking themselves (they follow the API, right?) can
pass False.  New callers can pass True instead of coding the check
themselves.

We could make the function check UTF-8 always (removing the need for the
assumption), never (relying on the assumption), or with a flag (for lazy
callers).  And either way we'll need to fix some callers.

Daniel

> May I suggest something like this:
> 
>   - Change the implementation of svn_path_check_valid() to validate for
> UTF-8. (I see this as enforcing a requirement, so a backward-compatible
> change even though some callers will be bitten by it.
> )
> 
>   - Any callers that were doing their own UTF-8 validation prior to
> calling this: remove that, as it will now be redundant.
> 
>   - Change the callers that we know might need to handle non-UTF8 paths
> (such as the ones that are reading from a possibly-invalid repository
> history) to handle an error returned by this newly strengthened
> validation. When they encounter this error, they should call a private
> semi-validation function that behaves like the old version of
> svn_path_check_valid().
> 
> /* [Check the path...]
>  * @note Prior to version 1.6 this function did not check but only
>  * assumed that @a path was a valid UTF-8 string. */
> svn_error_t *
> svn_path_check_valid(const char *path, apr_pool_t *pool);
> 
> /* Like svn_path_check_valid() except @a path need not be a valid
>  * UTF-8 string. */
> svn_error_t *
> svn_path__check_valid_except_utf8(const char *path, apr_pool_t *pool);
> 
> (Note that the language here is "need not be valid UTF-8" rather than
> "assume it's valid but do not check".)
> 
> Making sense?
> 
> - Julian
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Issue #2748: non-UTF-8 filenames in the repository

Posted by Julian Foad <ju...@btopenworld.com>.
On Wed, 2008-09-17 at 15:42 +0300, Daniel Shahaf wrote:
> Patch for issue #2748 ("clients can create non UTF-8 filenames in the 
> repository").  It prevents non-UTF-8 paths from entering the repository, 
> but it doesn't affect existing files in existing repositories, svnsync,
> or 'svnadmin load'.

That sounds great as a functional change.

I have a question about one of the API changes...

> I'm running 'make check' now, and I'll commit later today or tomorrow if
> I don't hear anything.
> 
> Daniel
> 
> [[[
> Validate in libsvn_repos that paths added to the repository are valid UTF-8.
> This fixes issue #2748.
> 
> TODO: update callers of svn_path_check_valid
> 
> * subversion/libsvn_repos/commit.c
>   (add_directory, add_file):
>     Validate incoming paths for UTF-8 using svn_path_check_valid2().
> 
> * subversion/include/svn_path.h
>   (svn_path_check_valid2):  New.
>   (svn_path_check_valid):   Deprecate.
> 
> * subversion/libsvn_subr/path.c
>   (utf_impl.h):  Include.
>   (svn_path_check_valid2):  New.
>   (svn_path_check_valid):   Deprecate.
> 
> * subversion/tests/libsvn_repos/repos-test.c
>   (prop_validation_commit_with_revprop): Renamed to...
>   (commit_path_with_revprops):  ... this.
>     Also, add KIND parameter, and make PROP_KEY optional.
>   (prop_validation):
>     Track rename and extension of prop_validation_commit_with_revprop().
>   (paths_are_UTF_8):  New test.
>   (test_funcs):  Run paths_are_UTF_8 as PASS.
> ]]]

[...]
> Index: subversion/include/svn_path.h
> ===================================================================
> --- subversion/include/svn_path.h	(revision 33124)
> +++ subversion/include/svn_path.h	(working copy)
> @@ -437,16 +437,27 @@ svn_path_is_ancestor(const char *path1, const char
>   * a repository.  There may be other, OS-specific, limitations on
>   * what paths can be represented in a working copy.
>   *
> - * ASSUMPTION: @a path is a valid UTF-8 string.  This function does
> - * not check UTF-8 validity.
> + * When @a assume_utf8 is @c TRUE, assume that @a path is a valid
> + * UTF-8 string and do not check UTF-8 validity.
[...]
> -svn_error_t *svn_path_check_valid(const char *path, apr_pool_t *pool);
> +svn_error_t *
> +svn_path_check_valid2(const char *path, svn_boolean_t assume_utf8,
> +                      apr_pool_t *pool);

This is ugly! Our main "validate a path" API should not have an option
for allowing invalid paths.

When an API says it assumes and does not check something, I understand
that to mean it's a requirement on the caller, not that it's permissible
to violate the assumption. I understand "does not check" as being a note
about the current implementation, to reinforce the message that it's the
caller's responsibility.

May I suggest something like this:

  - Change the implementation of svn_path_check_valid() to validate for
UTF-8. (I see this as enforcing a requirement, so a backward-compatible
change even though some callers will be bitten by it.)

  - Any callers that were doing their own UTF-8 validation prior to
calling this: remove that, as it will now be redundant.

  - Change the callers that we know might need to handle non-UTF8 paths
(such as the ones that are reading from a possibly-invalid repository
history) to handle an error returned by this newly strengthened
validation. When they encounter this error, they should call a private
semi-validation function that behaves like the old version of
svn_path_check_valid().

/* [Check the path...]
 * @note Prior to version 1.6 this function did not check but only
 * assumed that @a path was a valid UTF-8 string. */
svn_error_t *
svn_path_check_valid(const char *path, apr_pool_t *pool);

/* Like svn_path_check_valid() except @a path need not be a valid
 * UTF-8 string. */
svn_error_t *
svn_path__check_valid_except_utf8(const char *path, apr_pool_t *pool);

(Note that the language here is "need not be valid UTF-8" rather than
"assume it's valid but do not check".)

Making sense?

- Julian



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Issue #2748: non-UTF-8 filenames in the repository

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
C. Michael Pilato wrote on Wed, 17 Sep 2008 at 11:05 -0400:
> Daniel Shahaf wrote:
> > But, in this case, when *should* svn_path_check_valid() be used?  Why
> > does it check for control characters -- which of its callers need this
> > check?
> 

Thanks for the long explanation -- but it answers a lot more than I asked; 
I really only tried to understand why it disallowed just control 
characters and not other things (e.g., why it chose not to forbid colons 
in filenames).  I already understood the "FS allows more than higher 
layers allow" point.

Thanks,

Daniel

> There are two different set of requirements in the mix here.
> 
> libsvn_fs doesn't care about control characters, nor does it have any reason
> to.  It's just a versioned filesystem, right?  It doesn't have hooks, or
> print output, or speak XML.  In fact, it doesn't use the paths provided it
> in any way that doesn't involve its own virtual storage system.  The only
> reason it has the one little can't-have-a-null-byte rule is because without
> it we couldn't pass C strings around, and custom counted strings would be a
> drag to maintain.
> 
> The *rest* of Subversion cares, though.  You can't pass control characters
> over our XML WebDAV reports.  You can't store them in XML .svn/entries files
> (back when we had such).  They look ugly in screen output.  That's why the
> Subversion *client* layers protect against such things.  And, arguably,
> mod_dav_svn and svnserve (as entry points to the Subversion system) should
> be performing similar checks of their network input.
> 
> This duality has always existed in Subversion, and it makes perfect sense.
> That's the beauty of modularized code and solid APIs.  Sure, you can use the
> FS APIs to inject paths into your filesystem that the rest of Subversion
> will croak on, but that's an understood risk.  What we want to disallow are:
> 
>    * Using the FS APIs to introduce paths that violate the FS constraints
> 
>    * Using higher-level Subversion access points to introduce paths that
>      violate the requirements of those higher-level Subversion layers.
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Issue #2748: non-UTF-8 filenames in the repository

Posted by "C. Michael Pilato" <cm...@collab.net>.
Daniel Shahaf wrote:
> C. Michael Pilato wrote on Wed, 17 Sep 2008 at 10:44 -0400:
>> Daniel Shahaf wrote:
>>> (And I'll also fix the comments in svn_fs.h to say explicitly that
>>> control characters aren't allowed; svn_path_check_valid() already
>>> forbids them.)
>> Hrm... control characters *are* allowed, though.  What you see in svn_fs.h
>> is the full set of requirements *by the FS layer* for its paths.  UTF-8 with
>> no 0-offset characters.  That's the whole story.  To add control characters
>> to the blacklist now is a violation of the API contract.  If that means that
>> svn_path_check_valid() isn't the right function to use for this validation
>> -- or that it needs a new boolean flag that toggles the checks for control
>> characters -- so be it.
>>
> 
> But, in this case, when *should* svn_path_check_valid() be used?  Why
> does it check for control characters -- which of its callers need this
> check?

There are two different set of requirements in the mix here.

libsvn_fs doesn't care about control characters, nor does it have any reason
to.  It's just a versioned filesystem, right?  It doesn't have hooks, or
print output, or speak XML.  In fact, it doesn't use the paths provided it
in any way that doesn't involve its own virtual storage system.  The only
reason it has the one little can't-have-a-null-byte rule is because without
it we couldn't pass C strings around, and custom counted strings would be a
drag to maintain.

The *rest* of Subversion cares, though.  You can't pass control characters
over our XML WebDAV reports.  You can't store them in XML .svn/entries files
(back when we had such).  They look ugly in screen output.  That's why the
Subversion *client* layers protect against such things.  And, arguably,
mod_dav_svn and svnserve (as entry points to the Subversion system) should
be performing similar checks of their network input.

This duality has always existed in Subversion, and it makes perfect sense.
That's the beauty of modularized code and solid APIs.  Sure, you can use the
FS APIs to inject paths into your filesystem that the rest of Subversion
will croak on, but that's an understood risk.  What we want to disallow are:

   * Using the FS APIs to introduce paths that violate the FS constraints

   * Using higher-level Subversion access points to introduce paths that
     violate the requirements of those higher-level Subversion layers.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand


Re: [PATCH] Issue #2748: non-UTF-8 filenames in the repository

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
C. Michael Pilato wrote on Wed, 17 Sep 2008 at 10:44 -0400:
> Daniel Shahaf wrote:
> > (And I'll also fix the comments in svn_fs.h to say explicitly that
> > control characters aren't allowed; svn_path_check_valid() already
> > forbids them.)
> 
> Hrm... control characters *are* allowed, though.  What you see in svn_fs.h
> is the full set of requirements *by the FS layer* for its paths.  UTF-8 with
> no 0-offset characters.  That's the whole story.  To add control characters
> to the blacklist now is a violation of the API contract.  If that means that
> svn_path_check_valid() isn't the right function to use for this validation
> -- or that it needs a new boolean flag that toggles the checks for control
> characters -- so be it.
> 

But, in this case, when *should* svn_path_check_valid() be used?  Why
does it check for control characters -- which of its callers need this
check?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Issue #2748: non-UTF-8 filenames in the repository

Posted by "C. Michael Pilato" <cm...@collab.net>.
Daniel Shahaf wrote:
> C. Michael Pilato wrote on Wed, 17 Sep 2008 at 10:12 -0400:
>> Daniel Shahaf wrote:
>>> Patch for issue #2748 ("clients can create non UTF-8 filenames in the 
>>> repository").  It prevents non-UTF-8 paths from entering the repository, 
>>> but it doesn't affect existing files in existing repositories, svnsync,
>>> or 'svnadmin load'.
>>>
>>> I'm running 'make check' now, and I'll commit later today or tomorrow if
>>> I don't hear anything.
>>>
>>> Daniel
>>>
>>> [[[
>>> Validate in libsvn_repos that paths added to the repository are valid UTF-8.
>>> This fixes issue #2748.
>> These validations (which are a good idea) belong in the lowest layer that
>> dictates the requirement, in this case, the FS layer.
>>
>>
> 
> I hadn't noticed that requirement in FS (but found it now, in svn_fs.h).
> I'll move the checks -- they should still affect only new files/directories,
> as far as I can tell.  (And I'll also fix the comments in svn_fs.h to say
> explicitly that control characters aren't allowed; svn_path_check_valid()
> already forbids them.)

Hrm... control characters *are* allowed, though.  What you see in svn_fs.h
is the full set of requirements *by the FS layer* for its paths.  UTF-8 with
no 0-offset characters.  That's the whole story.  To add control characters
to the blacklist now is a violation of the API contract.  If that means that
svn_path_check_valid() isn't the right function to use for this validation
-- or that it needs a new boolean flag that toggles the checks for control
characters -- so be it.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand


Re: [PATCH] Issue #2748: non-UTF-8 filenames in the repository

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
C. Michael Pilato wrote on Wed, 17 Sep 2008 at 10:12 -0400:
> Daniel Shahaf wrote:
> > Patch for issue #2748 ("clients can create non UTF-8 filenames in the 
> > repository").  It prevents non-UTF-8 paths from entering the repository, 
> > but it doesn't affect existing files in existing repositories, svnsync,
> > or 'svnadmin load'.
> > 
> > I'm running 'make check' now, and I'll commit later today or tomorrow if
> > I don't hear anything.
> > 
> > Daniel
> > 
> > [[[
> > Validate in libsvn_repos that paths added to the repository are valid UTF-8.
> > This fixes issue #2748.
> 
> These validations (which are a good idea) belong in the lowest layer that
> dictates the requirement, in this case, the FS layer.
> 
> 

I hadn't noticed that requirement in FS (but found it now, in svn_fs.h).
I'll move the checks -- they should still affect only new files/directories,
as far as I can tell.  (And I'll also fix the comments in svn_fs.h to say
explicitly that control characters aren't allowed; svn_path_check_valid()
already forbids them.)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Issue #2748: non-UTF-8 filenames in the repository

Posted by "C. Michael Pilato" <cm...@collab.net>.
Daniel Shahaf wrote:
> Patch for issue #2748 ("clients can create non UTF-8 filenames in the 
> repository").  It prevents non-UTF-8 paths from entering the repository, 
> but it doesn't affect existing files in existing repositories, svnsync,
> or 'svnadmin load'.
> 
> I'm running 'make check' now, and I'll commit later today or tomorrow if
> I don't hear anything.
> 
> Daniel
> 
> [[[
> Validate in libsvn_repos that paths added to the repository are valid UTF-8.
> This fixes issue #2748.

These validations (which are a good idea) belong in the lowest layer that
dictates the requirement, in this case, the FS layer.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand


Re: [PATCH] Issue #2748: non-UTF-8 filenames in the repository

Posted by Philip Martin <ph...@codematters.co.uk>.
Daniel Shahaf <d....@daniel.shahaf.name> writes:

> My original reason was that the current contract actively promises that
> it *won't* check validity:
>
>      * ASSUMPTION: @a path is a valid UTF-8 string.  This function does
>      * not check UTF-8 validity.
>
>> Is it because the function may be fed input from existing repositories
>> which isn't valid UTF-8?
>> 
>
> Well, yes, being nice to existing invalid filenames is a consideration.
>
> Another is that this function is used all over the code -- including by
> svn_wc_add3(), svn_fs_make_file(), and others.  Changing the semantics
> in all these places may have unexpected side effects.

It sounds like it would be better to add calls to svn_utf__is_valid in
the places that need to check.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Issue #2748: non-UTF-8 filenames in the repository

Posted by Jens Seidel <je...@users.sourceforge.net>.
On Wed, Sep 17, 2008 at 04:46:38PM +0300, Daniel Shahaf wrote:
> Stefan Sperling wrote on Wed, 17 Sep 2008 at 15:17 +0200:
> > On Wed, Sep 17, 2008 at 03:42:21PM +0300, Daniel Shahaf wrote:
> > > Patch for issue #2748 ("clients can create non UTF-8 filenames in the 
> > > repository").  It prevents non-UTF-8 paths from entering the repository, 
> > > but it doesn't affect existing files in existing repositories, svnsync,
> > > or 'svnadmin load'.
> > > 
> > > I'm running 'make check' now, and I'll commit later today or tomorrow if
> > > I don't hear anything.
> > 
> > Drive-by question:
> > 
> > I thought we always handle strings in UTF-8 internally.
> > So why not just make svn_path_check_valid check for UTF-8 by default?
> > 
> 
> My original reason was that the current contract actively promises that
> it *won't* check validity:
> 
>      * ASSUMPTION: @a path is a valid UTF-8 string.  This function does
>      * not check UTF-8 validity.

There is *no* way to determine the encoding of a path. As far as I know
most Linux filesystems such as ext2/3 do not have a encoding field in
inodes or consider path as UTF-8.

If you create a filename in latin1 encoding containing 8bit characters
(so it may be an invalid UTF8 sequence) it's still possible that the
some path is later interpreted as UTF8 (because the locale setting
changed (e.g. by another user)). This results in

svn: Valid UTF-8 data
(hex: 65 69 6e 66)
followed by invalid UTF-8 sequence
(hex: fc 67 65 6e)

dependent on the current locale.

Jens

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Issue #2748: non-UTF-8 filenames in the repository

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Stefan Sperling wrote on Wed, 17 Sep 2008 at 15:17 +0200:
> On Wed, Sep 17, 2008 at 03:42:21PM +0300, Daniel Shahaf wrote:
> > Patch for issue #2748 ("clients can create non UTF-8 filenames in the 
> > repository").  It prevents non-UTF-8 paths from entering the repository, 
> > but it doesn't affect existing files in existing repositories, svnsync,
> > or 'svnadmin load'.
> > 
> > I'm running 'make check' now, and I'll commit later today or tomorrow if
> > I don't hear anything.
> 
> Drive-by question:
> 
> I thought we always handle strings in UTF-8 internally.
> So why not just make svn_path_check_valid check for UTF-8 by default?
> 

My original reason was that the current contract actively promises that
it *won't* check validity:

     * ASSUMPTION: @a path is a valid UTF-8 string.  This function does
     * not check UTF-8 validity.

> Is it because the function may be fed input from existing repositories
> which isn't valid UTF-8?
> 

Well, yes, being nice to existing invalid filenames is a consideration.

Another is that this function is used all over the code -- including by
svn_wc_add3(), svn_fs_make_file(), and others.  Changing the semantics
in all these places may have unexpected side effects.

    include/svn_path.h|449 col 1| svn_path_check_valid2(const char *path, svn_boolean_t assume_utf8,
    include/svn_path.h|453 col 15| * Similar to svn_path_check_valid2(), but with @a assume_utf8 set to @c TRUE.
    include/svn_path.h|459 col 1| svn_path_check_valid(const char *path, apr_pool_t *pool);
    libsvn_client/add.c|592 col 11| SVN_ERR(svn_path_check_valid(path, pool));
    libsvn_client/commit.c|188 col 11| SVN_ERR(svn_path_check_valid(path, pool));
    libsvn_client/commit.c|294 col 11| SVN_ERR(svn_path_check_valid(path, pool));
    libsvn_client/copy.c|640 col 15| SVN_ERR(svn_path_check_valid(path, pool));
    libsvn_fs/fs-loader.c|869 col 11| SVN_ERR(svn_path_check_valid(path, pool));
    libsvn_fs/fs-loader.c|883 col 11| SVN_ERR(svn_path_check_valid(to_path, pool));
    libsvn_fs/fs-loader.c|953 col 11| SVN_ERR(svn_path_check_valid(path, pool));
    libsvn_repos/commit.c|299 col 11| SVN_ERR(svn_path_check_valid2(path, FALSE, pool));
    libsvn_repos/commit.c|447 col 11| SVN_ERR(svn_path_check_valid2(path, FALSE, pool));
    libsvn_subr/path.c|1465 col 1| svn_path_check_valid2(const char *path, svn_boolean_t assume_utf8,
    libsvn_subr/path.c|1495 col 1| svn_path_check_valid(const char *path, apr_pool_t *pool)
    libsvn_subr/path.c|1497 col 10| return svn_path_check_valid2(path, TRUE, pool);
    libsvn_wc/adm_ops.c|1395 col 11| SVN_ERR(svn_path_check_valid(path, pool));
    tests/libsvn_subr/path-test.c|893 col 16| *msg = "test svn_path_check_valid";
    tests/libsvn_subr/path-test.c|900 col 26| svn_error_t *err = svn_path_check_valid(tests[i].path, pool);
    tests/libsvn_subr/path-test.c|907 col 13| "svn_path_check_valid (%s) returned %s instead of %s",

Daniel

> Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Issue #2748: non-UTF-8 filenames in the repository

Posted by Stefan Sperling <st...@elego.de>.
On Wed, Sep 17, 2008 at 03:42:21PM +0300, Daniel Shahaf wrote:
> Patch for issue #2748 ("clients can create non UTF-8 filenames in the 
> repository").  It prevents non-UTF-8 paths from entering the repository, 
> but it doesn't affect existing files in existing repositories, svnsync,
> or 'svnadmin load'.
> 
> I'm running 'make check' now, and I'll commit later today or tomorrow if
> I don't hear anything.

Drive-by question:

I thought we always handle strings in UTF-8 internally.
So why not just make svn_path_check_valid check for UTF-8 by default?

Is it because the function may be fed input from existing repositories
which isn't valid UTF-8?

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org