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

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

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Wed, 17 Sep 2008 22:07:19 +0100

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_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-09-17 23:28:43 CEST

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.