kfogel_at_tigris.org wrote:
> Author: kfogel
> Date: Thu Jan 31 20:15:40 2008
> New Revision: 29127
>
> Log:
> Fix issue #3026: _svn and .svn are silently ignored as file arguments.
>
> Patch by: Augie Fackler: <durin42_at_gmail.com>
> (Test by me.)
>
> First, create some new infrastructure:e
>
> * subversion/include/svn_error_codes.h
> (SVN_ERR_RESERVED_FILENAME_SPECIFIED): New error code for when reserved file
> arguments are encountered.
>
> * subversion/libsvn_wc/adm_files.c:
> (svn_wc_set_adm_dir): Updated comment to reflect the change of location for
> the other code block.
>
> * subversion/include/svn_opt.h:
> (svn_opt_args_to_target_array3): New function prototype.
>
> * subversion/libsvn_subr/opt.c:
> (svn_opt_args_to_target_array3): New function. Behaves like
> svn_opt_args_to_target_array2 except this one returns errors instead of
> silently ignoring reserved file names.
>
> (svn_opt_args_to_target_array2): Reimplemented to wrap
> svn_opt_args_to_target_array2 but filter out any error about reserved
> filenames.
>
> * subversion/svn/cl.h:
> (svn_cl__args_to_target_array_print_reserved): New function prototype.
>
> * subversion/svn/util.c:
> (svn_cl_args_to_target_array_print_reserved): New function. Convenience
> function to wrap svn_opt_args_to_target_array_3 and print any errors about
> reserved filenames to stderr before returning.
>
> * subversion/bindings/swig/core.i:
> (svn_opt_args_to_target_array3): Ignore this function as well.
>
> Then update all the relevant callers:
>
> * subversion/svn/update-cmd.c:
> (svn_cl__propdel): Use svn_opt_args_to_target_array3 instead of
> svn_opt_args_to_target_array2 so that reserved filenames exit with error.
>
> * subversion/svn/merge-cmd.c:
> (svn_cl__merge): Use svn_cl__args_to_target_array_print_reserved instead of
> svn_opt_args_to_target_array2 so that reserved filenames aren't silently
> ignored.
>
> * subversion/svn/propdel-cmd.c:
> (svn_cl__propdel): Same.
>
> * subversion/svn/checkout-cmd.c:
> (svn_cl__checkout): Same.
>
> * subversion/svn/move-cmd.c:
> (svn_cl__move): Same.
>
> * subversion/svn/mkdir-cmd.c:
> (svn_cl__mkdir): Same.
>
> * subversion/svn/cat-cmd.c:
> (svn_cl__cat): Same.
>
> * subversion/svn/revert-cmd.c:
> (svn_cl__revert): Same.
>
> * subversion/svn/diff-cmd.c:
> (svn_cl__diff): Same.
>
> * subversion/svn/copy-cmd.c:
> (svn_cl__copy): Same.
>
> * subversion/svn/mergeinfo-cmd.c:
> (svn_cl__mergeinfo): Same.
>
> * subversion/svn/list-cmd.c:
> (svn_cl__list): Same.
>
> * subversion/svn/blame-cmd.c:
> (svn_cl__blame): Same.
>
> * subversion/svn/propget-cmd.c:
> (svn_cl__propget): Same.
>
> * subversion/svn/changelist-cmd.c:
> (svn_cl__changelist): Same.
>
> * subversion/svn/propdel-cmd.c:
> (svn_cl__propdel): Same.
>
> * subversion/svn/log-cmd.c:
> (svn_cl__log): Same.
>
> * subversion/svn/resolved-cmd.c:
> (svn_cl__resloved): Same.
>
> * subversion/svn/cleanup-cmd.c:
> (svn_cl__cleanup): Same.
>
> * subversion/svn/commit-cmd.c:
> (svn_cl__commit): Same.
>
> * subversion/svn/add-cmd.c:
> (svn_cl__add): Same.
>
> * subversion/svn/propset-cmd.c:
> (svn_cl__propset): Same.
>
> * subversion/svn/switch-cmd.c:
> (svn_cl__switch): Same.
>
> * subversion/svn/delete-cmd.c:
> (svn_cl__delete): Same.
>
> * subversion/svn/import-cmd.c:
> (svn_cl__import): Same.
>
> * subversion/svn/proplist-cmd.c:
> (svn_cl__proplist): Same.
>
> * subversion/svn/export-cmd.c:
> (svn_cl__export): Same.
>
> * subversion/svn/propdel-cmd.c:
> (svn_cl__propdel): Same.
>
> * subversion/svn/status-cmd.c:
> (svn_cl__status): Same.
>
> * subversion/svn/propedit-cmd.c:
> (svn_cl__propdel): Same.
>
> * subversion/svn/lock-cmd.c:
> (svn_cl__lock): Same.
>
> * subversion/svn/info-cmd.c:
> (svn_cl__info): Same.
>
> * subversion/svn/unlock-cmd.c:
> (svn_cl__unlock): Same.
>
> Finally, add a test:
>
> * subversion/tests/cmdline/special_tests.py
> (warn_on_reserved_name): New test.
> (test_list): Run it.
>
>
> Modified:
> trunk/subversion/bindings/swig/core.i
> trunk/subversion/include/svn_error_codes.h
> trunk/subversion/include/svn_opt.h
> trunk/subversion/libsvn_subr/opt.c
> trunk/subversion/libsvn_wc/adm_files.c
> trunk/subversion/svn/add-cmd.c
> trunk/subversion/svn/blame-cmd.c
> trunk/subversion/svn/cat-cmd.c
> trunk/subversion/svn/changelist-cmd.c
> trunk/subversion/svn/checkout-cmd.c
> trunk/subversion/svn/cl.h
> trunk/subversion/svn/cleanup-cmd.c
> trunk/subversion/svn/commit-cmd.c
> trunk/subversion/svn/copy-cmd.c
> trunk/subversion/svn/delete-cmd.c
> trunk/subversion/svn/diff-cmd.c
> trunk/subversion/svn/export-cmd.c
> trunk/subversion/svn/import-cmd.c
> trunk/subversion/svn/info-cmd.c
> trunk/subversion/svn/list-cmd.c
> trunk/subversion/svn/lock-cmd.c
> trunk/subversion/svn/log-cmd.c
> trunk/subversion/svn/merge-cmd.c
> trunk/subversion/svn/mergeinfo-cmd.c
> trunk/subversion/svn/mkdir-cmd.c
> trunk/subversion/svn/move-cmd.c
> trunk/subversion/svn/propdel-cmd.c
> trunk/subversion/svn/propedit-cmd.c
> trunk/subversion/svn/propget-cmd.c
> trunk/subversion/svn/proplist-cmd.c
> trunk/subversion/svn/propset-cmd.c
> trunk/subversion/svn/resolved-cmd.c
> trunk/subversion/svn/revert-cmd.c
> trunk/subversion/svn/status-cmd.c
> trunk/subversion/svn/switch-cmd.c
> trunk/subversion/svn/unlock-cmd.c
> trunk/subversion/svn/update-cmd.c
> trunk/subversion/svn/util.c
> trunk/subversion/tests/cmdline/special_tests.py
>
> Modified: trunk/subversion/bindings/swig/core.i
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/bindings/swig/core.i?pathrev=29127&r1=29126&r2=29127
> ==============================================================================
> --- trunk/subversion/bindings/swig/core.i (original)
> +++ trunk/subversion/bindings/swig/core.i Thu Jan 31 20:15:40 2008
> @@ -680,6 +680,7 @@
> %ignore svn_commit_info_dup;
>
> %ignore svn_opt_args_to_target_array2;
> +%ignore svn_opt_args_to_target_array3;
> %ignore svn_opt_parse_num_args;
> %ignore svn_opt_parse_all_args;
> #endif
>
> Modified: trunk/subversion/include/svn_error_codes.h
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/include/svn_error_codes.h?pathrev=29127&r1=29126&r2=29127
> ==============================================================================
> --- trunk/subversion/include/svn_error_codes.h (original)
> +++ trunk/subversion/include/svn_error_codes.h Thu Jan 31 20:15:40 2008
> @@ -1124,6 +1124,10 @@
> SVN_ERRDEF(SVN_ERR_UNKNOWN_CHANGELIST,
> SVN_ERR_MISC_CATEGORY_START + 24,
> "Unknown changelist")
> +
> + SVN_ERRDEF(SVN_ERR_RESERVED_FILENAME_SPECIFIED,
> + SVN_ERR_MISC_CATEGORY_START + 25,
> + "Reserved directory name in command line arguments")
>
> /* command-line client errors */
>
>
> Modified: trunk/subversion/include/svn_opt.h
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/include/svn_opt.h?pathrev=29127&r1=29126&r2=29127
> ==============================================================================
> --- trunk/subversion/include/svn_opt.h (original)
> +++ trunk/subversion/include/svn_opt.h Thu Jan 31 20:15:40 2008
> @@ -490,6 +490,18 @@
> apr_array_header_t *known_targets,
> apr_pool_t *pool);
>
> +/**
> + * This is the same as svn_opt_args_to_target_array2() except that it returns
> + * errors when a path has the same name as a working copy directory.
> + *
> + * @since New in 1.5.
> + */
> +svn_error_t *
> +svn_opt_args_to_target_array3(apr_array_header_t **targets_p,
> + apr_getopt_t *os,
> + apr_array_header_t *known_targets,
> + apr_pool_t *pool);
The comment says 'errors' but this returns a single svn_error_t. Does it stop
at the first path that has the same name as a working copy or continue
processing the rest of the list? Does it return the first or last path that has
an error?
And shouldn't the comment not refer to svn_opt_args_to_target_array2() since
this is version 3? Version 2 should refer to version 3 instead.
Regards,
Blair
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-02-01 18:12:07 CET