You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by pb...@apache.org on 2012/09/05 22:17:56 UTC
svn commit: r1381337 - in /subversion/branches/inheritable-props: ./ build/
build/generator/ build/generator/templates/ subversion/ subversion/include/
subversion/include/private/ subversion/libsvn_auth_gnome_keyring/
subversion/libsvn_client/ subversi...
Author: pburba
Date: Wed Sep 5 20:17:54 2012
New Revision: 1381337
URL: http://svn.apache.org/viewvc?rev=1381337&view=rev
Log:
On the inheritable-props branch: Sync with ^/subversion/trunk through
r1381334.
Removed:
subversion/branches/inheritable-props/build/strip-po-charset.py
Modified:
subversion/branches/inheritable-props/ (props changed)
subversion/branches/inheritable-props/build/generator/gen_win.py
subversion/branches/inheritable-props/build/generator/templates/build_locale.ezt
subversion/branches/inheritable-props/build/generator/templates/svn_locale.vcxproj.ezt
subversion/branches/inheritable-props/configure.ac
subversion/branches/inheritable-props/subversion/include/private/svn_debug.h
subversion/branches/inheritable-props/subversion/include/svn_config.h
subversion/branches/inheritable-props/subversion/include/svn_repos.h
subversion/branches/inheritable-props/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
subversion/branches/inheritable-props/subversion/libsvn_client/diff.c
subversion/branches/inheritable-props/subversion/libsvn_client/update.c
subversion/branches/inheritable-props/subversion/libsvn_ra_local/split_url.c
subversion/branches/inheritable-props/subversion/libsvn_repos/hooks.c
subversion/branches/inheritable-props/subversion/libsvn_repos/repos.c
subversion/branches/inheritable-props/subversion/libsvn_repos/repos.h
subversion/branches/inheritable-props/subversion/libsvn_subr/deprecated.c
subversion/branches/inheritable-props/subversion/libsvn_subr/nls.c
subversion/branches/inheritable-props/subversion/libsvn_subr/opt.c
subversion/branches/inheritable-props/subversion/libsvn_subr/opt.h
subversion/branches/inheritable-props/subversion/libsvn_subr/simple_providers.c
subversion/branches/inheritable-props/subversion/libsvn_subr/sysinfo.c
subversion/branches/inheritable-props/subversion/libsvn_subr/sysinfo.h
subversion/branches/inheritable-props/subversion/mod_dav_svn/dav_svn.h
subversion/branches/inheritable-props/subversion/mod_dav_svn/mod_dav_svn.c
subversion/branches/inheritable-props/subversion/mod_dav_svn/repos.c
subversion/branches/inheritable-props/subversion/svn/main.c
subversion/branches/inheritable-props/subversion/svn_private_config.hw
subversion/branches/inheritable-props/subversion/svnserve/serve.c
subversion/branches/inheritable-props/subversion/svnversion/svnversion.1
subversion/branches/inheritable-props/tools/dev/unix-build/Makefile.svn
subversion/branches/inheritable-props/tools/server-side/svnauthz-validate.c
subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.debian
subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.freebsd
subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.solaris
subversion/branches/inheritable-props/tools/server-side/svnpubsub/svnwcsub.py
Propchange: subversion/branches/inheritable-props/
------------------------------------------------------------------------------
Merged /subversion/trunk:r1379554-1381334
Modified: subversion/branches/inheritable-props/build/generator/gen_win.py
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/build/generator/gen_win.py?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/build/generator/gen_win.py (original)
+++ subversion/branches/inheritable-props/build/generator/gen_win.py Wed Sep 5 20:17:54 2012
@@ -1615,7 +1615,6 @@ class POFile:
"Item class for holding po file info"
def __init__(self, base):
self.po = base + '.po'
- self.spo = base + '.spo'
self.mo = base + '.mo'
# MSVC paths always use backslashes regardless of current platform
Modified: subversion/branches/inheritable-props/build/generator/templates/build_locale.ezt
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/build/generator/templates/build_locale.ezt?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/build/generator/templates/build_locale.ezt (original)
+++ subversion/branches/inheritable-props/build/generator/templates/build_locale.ezt Wed Sep 5 20:17:54 2012
@@ -22,11 +22,8 @@ cd ..\..\..\subversion\po
mkdir ..\..\%1\mo
set exitcode=0
[for pofiles]echo Running msgfmt on [pofiles.po]...
-python ..\..\build\strip-po-charset.py [pofiles.po] [pofiles.spo]
+msgfmt.exe -c -o ..\..\%1\mo\[pofiles.mo] [pofiles.po]
if errorlevel 1 goto err
-msgfmt.exe -c -o ..\..\%1\mo\[pofiles.mo] [pofiles.spo]
-if errorlevel 1 goto err
-del [pofiles.spo]
[end]
goto end
@rem **************************************************************************
Modified: subversion/branches/inheritable-props/build/generator/templates/svn_locale.vcxproj.ezt
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/build/generator/templates/svn_locale.vcxproj.ezt?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/build/generator/templates/svn_locale.vcxproj.ezt (original)
+++ subversion/branches/inheritable-props/build/generator/templates/svn_locale.vcxproj.ezt Wed Sep 5 20:17:54 2012
@@ -32,7 +32,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
[for platforms][for configs] <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='[configs]|[platforms]'" Label="Configuration">
- <ConfigurationType>Utility</ConfigurationType>
+ <ConfigurationType>Makefile</ConfigurationType>
<CLRSupport>false</CLRSupport>
<PlatformToolset>[toolset_version]</PlatformToolset>
</PropertyGroup>
Modified: subversion/branches/inheritable-props/configure.ac
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/configure.ac?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/configure.ac (original)
+++ subversion/branches/inheritable-props/configure.ac Wed Sep 5 20:17:54 2012
@@ -501,7 +501,7 @@ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
CPPFLAGS="$old_CPPFLAGS"
-dnl D-Bus (required for support for KWallet and GNOME Keyring) -------------------
+dnl D-Bus (required for support for KWallet) -------------------
if test -n "$PKG_CONFIG"; then
AC_MSG_CHECKING([for D-Bus .pc file])
@@ -570,31 +570,27 @@ if test "$with_gnome_keyring" != "no"; t
if test "$svn_enable_shared" = "yes"; then
if test "$APR_HAS_DSO" = "yes"; then
if test -n "$PKG_CONFIG"; then
- if test "$HAVE_DBUS" = "yes"; then
- AC_MSG_CHECKING([for GLib and GNOME Keyring .pc files])
- if $PKG_CONFIG --exists glib-2.0 gnome-keyring-1; then
+ AC_MSG_CHECKING([for GLib and GNOME Keyring .pc files])
+ if $PKG_CONFIG --exists glib-2.0 gnome-keyring-1; then
+ AC_MSG_RESULT([yes])
+ old_CPPFLAGS="$CPPFLAGS"
+ SVN_GNOME_KEYRING_INCLUDES="`$PKG_CONFIG --cflags glib-2.0 gnome-keyring-1`"
+ CPPFLAGS="$CPPFLAGS $SVN_GNOME_KEYRING_INCLUDES"
+ AC_CHECK_HEADER(gnome-keyring.h, with_gnome_keyring=yes, with_gnome_keyring=no)
+ AC_MSG_CHECKING([for GNOME Keyring])
+ if test "$with_gnome_keyring" = "yes"; then
AC_MSG_RESULT([yes])
- old_CPPFLAGS="$CPPFLAGS"
- SVN_GNOME_KEYRING_INCLUDES="$DBUS_CPPFLAGS `$PKG_CONFIG --cflags glib-2.0 gnome-keyring-1`"
- CPPFLAGS="$CPPFLAGS $SVN_GNOME_KEYRING_INCLUDES"
- AC_CHECK_HEADER(gnome-keyring.h, with_gnome_keyring=yes, with_gnome_keyring=no)
- AC_MSG_CHECKING([for GNOME Keyring])
- if test "$with_gnome_keyring" = "yes"; then
- AC_MSG_RESULT([yes])
- AC_DEFINE([SVN_HAVE_GNOME_KEYRING], [1],
- [Is GNOME Keyring support enabled?])
- CPPFLAGS="$old_CPPFLAGS"
- SVN_GNOME_KEYRING_LIBS="$DBUS_LIBS `$PKG_CONFIG --libs glib-2.0 gnome-keyring-1`"
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([cannot find GNOME Keyring])
- fi
+ AC_DEFINE([SVN_HAVE_GNOME_KEYRING], [1],
+ [Is GNOME Keyring support enabled?])
+ CPPFLAGS="$old_CPPFLAGS"
+ SVN_GNOME_KEYRING_LIBS="`$PKG_CONFIG --libs glib-2.0 gnome-keyring-1`"
else
AC_MSG_RESULT([no])
- AC_MSG_ERROR([cannot find GLib and GNOME Keyring .pc files])
+ AC_MSG_ERROR([cannot find GNOME Keyring])
fi
else
- AC_MSG_ERROR([cannot find D-Bus])
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([cannot find GLib and GNOME Keyring .pc files])
fi
else
AC_MSG_ERROR([cannot find pkg-config])
Modified: subversion/branches/inheritable-props/subversion/include/private/svn_debug.h
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/include/private/svn_debug.h?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/include/private/svn_debug.h (original)
+++ subversion/branches/inheritable-props/subversion/include/private/svn_debug.h Wed Sep 5 20:17:54 2012
@@ -31,7 +31,9 @@
### remain in the code. at that point, we can rejigger this header. */
#ifdef SVN_DEBUG
-#include <stdio.h>
+#define APR_WANT_STDIO
+#include <apr_want.h>
+#include <apr_hash.h>
#ifdef __cplusplus
extern "C" {
Modified: subversion/branches/inheritable-props/subversion/include/svn_config.h
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/include/svn_config.h?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/include/svn_config.h (original)
+++ subversion/branches/inheritable-props/subversion/include/svn_config.h Wed Sep 5 20:17:54 2012
@@ -131,12 +131,12 @@ typedef struct svn_config_t svn_config_t
#define SVN_CONFIG_OPTION_AUTHZ_DB "authz-db"
/** @since New in 1.7. */
#define SVN_CONFIG_OPTION_FORCE_USERNAME_CASE "force-username-case"
+/** @since New in 1.8. */
+#define SVN_CONFIG_OPTION_HOOKS_ENV "hooks-env"
#define SVN_CONFIG_SECTION_SASL "sasl"
#define SVN_CONFIG_OPTION_USE_SASL "use-sasl"
#define SVN_CONFIG_OPTION_MIN_SSF "min-encryption"
#define SVN_CONFIG_OPTION_MAX_SSF "max-encryption"
-/** @since New in 1.8. */
-#define SVN_CONFIG_SECTION_HOOKS_ENV "hooks-env"
/* For repository password database */
#define SVN_CONFIG_SECTION_USERS "users"
Modified: subversion/branches/inheritable-props/subversion/include/svn_repos.h
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/include/svn_repos.h?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/include/svn_repos.h (original)
+++ subversion/branches/inheritable-props/subversion/include/svn_repos.h Wed Sep 5 20:17:54 2012
@@ -778,16 +778,25 @@ const char *
svn_repos_post_unlock_hook(svn_repos_t *repos,
apr_pool_t *pool);
-/** Set the environment that @a repos's hooks will inherit to @a hooks_env,
- * a hash table where keys and values represent names and values of environment
- * variables. @a hooks_env must live at least as long as @a repos.
+/** Set the environment that @a repos's hooks will inherit.
+ * The environment is specified in a file at @a hooks_env_path.
+ * If @a hooks_env_path is @c NULL, the file is searched at its
+ * default location in the repository. If @a hooks_env_path is
+ * not absolute, it specifies a path relative to the parent of
+ * the file's default location in the repository.
*
- * If this function is not called, hooks will run in an empty environment.
+ * The @a result_pool should be the same pool that @a repos was allocated in.
+ * The @a scratch_pool is used for temporary allocations.
+ *
+ * If this function is not called, or if the file does not list any
+ * environment variables, hooks will run in an empty environment.
*
* @since New in 1.8. */
-void
+svn_error_t *
svn_repos_hooks_setenv(svn_repos_t *repos,
- apr_hash_t *hooks_env);
+ const char *hooks_env_path,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/** @} */
Modified: subversion/branches/inheritable-props/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c Wed Sep 5 20:17:54 2012
@@ -38,7 +38,6 @@
#include "svn_private_config.h"
#include <glib.h>
-#include <dbus/dbus.h>
#include <gnome-keyring.h>
Modified: subversion/branches/inheritable-props/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_client/diff.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_client/diff.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_client/diff.c Wed Sep 5 20:17:54 2012
@@ -1044,6 +1044,9 @@ diff_content_changed(const char *path,
subpool, subpool));
SVN_ERR(svn_stream_copy3(stream, svn_stream_disown(errstream, subpool),
NULL, NULL, subpool));
+
+ /* We have a printed a diff for this path, mark it as visited. */
+ mark_path_as_visited(diff_cmd_baton, path);
}
else /* use libsvn_diff to generate the diff */
{
Modified: subversion/branches/inheritable-props/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_client/update.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_client/update.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_client/update.c Wed Sep 5 20:17:54 2012
@@ -214,6 +214,9 @@ update_internal(svn_revnum_t *result_rev
SVN_CONFIG_CATEGORY_CONFIG,
APR_HASH_KEY_STRING) : NULL;
+ if (result_rev)
+ *result_rev = SVN_INVALID_REVNUM;
+
/* An unknown depth can't be sticky. */
if (depth == svn_depth_unknown)
depth_is_sticky = FALSE;
Modified: subversion/branches/inheritable-props/subversion/libsvn_ra_local/split_url.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_ra_local/split_url.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_ra_local/split_url.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_ra_local/split_url.c Wed Sep 5 20:17:54 2012
@@ -74,5 +74,8 @@ svn_ra_local__split_URL(svn_repos_t **re
- svn_path_component_count(repos_root_dirent));
*repos_url = urlbuf->data;
+ /* Configure hook script environment variables. */
+ SVN_ERR(svn_repos_hooks_setenv(*repos, NULL, pool, pool));
+
return SVN_NO_ERROR;
}
Modified: subversion/branches/inheritable-props/subversion/libsvn_repos/hooks.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_repos/hooks.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_repos/hooks.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_repos/hooks.c Wed Sep 5 20:17:54 2012
@@ -215,6 +215,7 @@ run_hook_cmd(svn_string_t **result,
svn_error_t *err;
apr_proc_t cmd_proc = {0};
apr_pool_t *cmd_pool;
+ apr_hash_t *hook_env = NULL;
if (result)
{
@@ -234,8 +235,19 @@ run_hook_cmd(svn_string_t **result,
* destroy in order to clean up the stderr pipe opened for the process. */
cmd_pool = svn_pool_create(pool);
+ /* Check if a custom environment is defined for this hook, or else
+ * whether a default environment is defined. */
+ if (hooks_env)
+ {
+ hook_env = apr_hash_get(hooks_env, name, APR_HASH_KEY_STRING);
+ if (hook_env == NULL)
+ hook_env = apr_hash_get(hooks_env,
+ SVN_REPOS__HOOKS_ENV_DEFAULT_SECTION,
+ APR_HASH_KEY_STRING);
+ }
+
err = svn_io_start_cmd3(&cmd_proc, ".", cmd, args,
- env_from_env_hash(hooks_env, pool, pool),
+ env_from_env_hash(hook_env, pool, pool),
FALSE, FALSE, stdin_handle, result != NULL,
null_handle, TRUE, NULL, cmd_pool);
if (!err)
Modified: subversion/branches/inheritable-props/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_repos/repos.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_repos/repos.c Wed Sep 5 20:17:54 2012
@@ -34,6 +34,7 @@
#include "svn_repos.h"
#include "svn_hash.h"
#include "svn_version.h"
+#include "svn_config.h"
#include "private/svn_repos_private.h"
#include "private/svn_subr_private.h"
@@ -166,13 +167,6 @@ svn_repos_post_revprop_change_hook(svn_r
pool);
}
-void
-svn_repos_hooks_setenv(svn_repos_t *repos,
- apr_hash_t *hooks_env)
-{
- repos->hooks_env = hooks_env;
-}
-
static svn_error_t *
create_repos_dir(const char *path, apr_pool_t *pool)
{
@@ -1041,6 +1035,13 @@ create_conf(svn_repos_t *repos, apr_pool
"### \"none\" (to compare usernames as-is without case conversion, which" NL
"### is the default behavior)." NL
"# force-username-case = none" NL
+"### The hooks-env options specifies a path to the hook script environment " NL
+"### configuration file. This option overrides the per-repository default" NL
+"### and can be used to configure the hook script environment for multiple " NL
+"### repositories in a single file, if an absolute path is specified." NL
+"### Unless you specify an absolute path, the file's location is relative" NL
+"### to the directory containing this file." NL
+"# hooks-env = " SVN_REPOS__CONF_HOOKS_ENV NL
"" NL
"[sasl]" NL
"### This option specifies whether you want to use the Cyrus SASL" NL
@@ -1055,17 +1056,7 @@ create_conf(svn_repos_t *repos, apr_pool
"### to the effective key length for encryption (e.g. 128 means 128-bit" NL
"### encryption). The values below are the defaults." NL
"# min-encryption = 0" NL
-"# max-encryption = 256" NL
-"" NL
-"[hooks-env]" NL
-"### Options in this section define environment variables for use by" NL
-"### hook scripts run by svnserve." NL
-#ifdef WIN32
-"# PATH = C:\\Program Files\\Subversion\\bin" NL
-#else
-"# PATH = /bin:/sbin:/usr/bin:/usr/sbin" NL
-#endif
-"# LC_CTYPE = en_US.UTF-8" NL;
+"# max-encryption = 256" NL;
SVN_ERR_W(svn_io_file_create(svn_repos_svnserve_conf(repos, pool),
svnserve_conf_contents, pool),
@@ -1132,6 +1123,129 @@ create_conf(svn_repos_t *repos, apr_pool
_("Creating authz file"));
}
+ {
+ static const char * const hooks_env_contents =
+"### This file is an example hook script environment configuration file." NL
+"### Hook scripts run in an empty environment by default." NL
+"### As shown below each section defines environment variables for a" NL
+"### particular hook script. The [default] section defines environment" NL
+"### variables for all hook scripts, unless overridden by a hook-specific" NL
+"### section." NL
+"" NL
+"### This example configures a UTF-8 locale for all hook scripts, so that " NL
+"### special characters, such as umlauts, may be printed to stderr." NL
+"### If UTF-8 is used with a mod_dav_svn server, the SVNUseUTF8 option must" NL
+"### also be set to 'yes' in httpd.conf." NL
+"### With svnserve, the LANG environment variable of the svnserve process" NL
+"### must be set to the same value as given here." NL
+"[default]" NL
+"# LANG = en_US.UTF-8" NL
+"" NL
+"### This sets the PATH environment variable for the pre-commit hook." NL
+"# [pre-commit]" NL
+"# PATH = /usr/local/bin:/usr/bin:/usr/sbin" NL;
+
+ SVN_ERR_W(svn_io_file_create(svn_dirent_join(repos->conf_path,
+ SVN_REPOS__CONF_HOOKS_ENV,
+ pool),
+ hooks_env_contents, pool),
+ _("Creating hooks-env file"));
+ }
+
+ return SVN_NO_ERROR;
+}
+
+/* Baton for parse_hooks_env_option. */
+struct parse_hooks_env_option_baton {
+ /* The name of the section being parsed. If not the default section,
+ * the section name should match the name of a hook to which the
+ * options apply. */
+ const char *section;
+ apr_hash_t *hooks_env;
+} parse_hooks_env_option_baton;
+
+/* An implementation of svn_config_enumerator2_t.
+ * Set environment variable NAME to value VALUE in the environment for
+ * all hooks (in case the current section is the default section),
+ * or the hook with the name corresponding to the current section's name. */
+static svn_boolean_t
+parse_hooks_env_option(const char *name, const char *value,
+ void *baton, apr_pool_t *pool)
+{
+ struct parse_hooks_env_option_baton *bo = baton;
+ apr_pool_t *result_pool = apr_hash_pool_get(bo->hooks_env);
+ apr_hash_t *hook_env;
+
+ hook_env = apr_hash_get(bo->hooks_env, bo->section, APR_HASH_KEY_STRING);
+ if (hook_env == NULL)
+ {
+ hook_env = apr_hash_make(result_pool);
+ apr_hash_set(bo->hooks_env, apr_pstrdup(result_pool, bo->section),
+ APR_HASH_KEY_STRING, hook_env);
+ }
+ apr_hash_set(hook_env, apr_pstrdup(result_pool, name),
+ APR_HASH_KEY_STRING, apr_pstrdup(result_pool, value));
+
+ return TRUE;
+}
+
+struct parse_hooks_env_section_baton {
+ svn_config_t *cfg;
+ apr_hash_t *hooks_env;
+} parse_hooks_env_section_baton;
+
+/* An implementation of svn_config_section_enumerator2_t. */
+static svn_boolean_t
+parse_hooks_env_section(const char *name, void *baton, apr_pool_t *pool)
+{
+ struct parse_hooks_env_section_baton *b = baton;
+ struct parse_hooks_env_option_baton bo;
+
+ bo.section = name;
+ bo.hooks_env = b->hooks_env;
+
+ (void)svn_config_enumerate2(b->cfg, name, parse_hooks_env_option, &bo, pool);
+
+ return TRUE;
+}
+
+/* Parse the hooks env file for this repository. */
+static svn_error_t *
+parse_hooks_env(svn_repos_t *repos,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_config_t *cfg;
+ int n;
+ struct parse_hooks_env_section_baton b;
+
+ SVN_ERR(svn_config_read2(&cfg, local_abspath, FALSE, TRUE, scratch_pool));
+ b.cfg = cfg;
+ b.hooks_env = apr_hash_make(result_pool);
+ n = svn_config_enumerate_sections2(cfg, parse_hooks_env_section, &b,
+ scratch_pool);
+ if (n > 0)
+ repos->hooks_env = b.hooks_env;
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_repos_hooks_setenv(svn_repos_t *repos,
+ const char *hooks_env_path,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ if (hooks_env_path == NULL)
+ hooks_env_path = svn_dirent_join(repos->conf_path,
+ SVN_REPOS__CONF_HOOKS_ENV, scratch_pool);
+ else if (!svn_dirent_is_absolute(hooks_env_path))
+ hooks_env_path = svn_dirent_join(repos->conf_path, hooks_env_path,
+ scratch_pool);
+
+ SVN_ERR(parse_hooks_env(repos, hooks_env_path, result_pool, scratch_pool));
+
return SVN_NO_ERROR;
}
@@ -1151,6 +1265,7 @@ create_svn_repos_t(const char *path, apr
repos->hook_path = svn_dirent_join(path, SVN_REPOS__HOOK_DIR, pool);
repos->lock_path = svn_dirent_join(path, SVN_REPOS__LOCK_DIR, pool);
repos->repository_capabilities = apr_hash_make(pool);
+ repos->hooks_env = NULL;
return repos;
}
Modified: subversion/branches/inheritable-props/subversion/libsvn_repos/repos.h
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_repos/repos.h?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_repos/repos.h (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_repos/repos.h Wed Sep 5 20:17:54 2012
@@ -85,6 +85,11 @@ extern "C" {
/* The extension added to the names of example hook scripts. */
#define SVN_REPOS__HOOK_DESC_EXT ".tmpl"
+/* The file which contains a custom set of environment variables
+ * passed inherited to hook scripts, in the repository conf directory. */
+#define SVN_REPOS__CONF_HOOKS_ENV "hooks-env"
+/* The name of the default section in the hooks-env config file. */
+#define SVN_REPOS__HOOKS_ENV_DEFAULT_SECTION "default"
/* The configuration file for svnserve, in the repository conf directory. */
#define SVN_REPOS__CONF_SVNSERVE_CONF "svnserve.conf"
@@ -142,7 +147,15 @@ struct svn_repos_t
apr_hash_t *repository_capabilities;
/* The environment inherited to hook scripts. If NULL, hooks run
- * in an empty environment. */
+ * in an empty environment.
+ *
+ * This is a nested hash table.
+ * The entry with name SVN_REPOS__HOOKS_ENV_DEFAULT_SECTION contains the
+ * default environment for all hooks in form of an apr_hash_t with keys
+ * and values describing the names and values of environment variables.
+ * Defaults can be overridden by an entry matching the name of a hook.
+ * E.g. an entry with the name SVN_REPOS__HOOK_PRE_COMMIT provides the
+ * environment specific to the pre-commit hook. */
apr_hash_t *hooks_env;
};
Modified: subversion/branches/inheritable-props/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_subr/deprecated.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_subr/deprecated.c Wed Sep 5 20:17:54 2012
@@ -604,8 +604,11 @@ svn_opt_print_help(apr_getopt_t *os,
}
}
else if (print_version) /* just --version */
- SVN_ERR(svn_opt__print_version_info(pgm_name, version_footer,
- quiet, FALSE, pool));
+ {
+ SVN_ERR(svn_opt__print_version_info(pgm_name, version_footer,
+ svn_opt__get_version_info(pool),
+ quiet, FALSE, pool));
+ }
else if (os && !targets->nelts) /* `-h', `--help', or `help' */
svn_opt_print_generic_help(header,
cmd_table,
Modified: subversion/branches/inheritable-props/subversion/libsvn_subr/nls.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_subr/nls.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_subr/nls.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_subr/nls.c Wed Sep 5 20:17:54 2012
@@ -121,10 +121,12 @@ svn_nls_init(void)
#else /* ! WIN32 */
bindtextdomain(PACKAGE_NAME, SVN_LOCALE_DIR);
}
+#endif /* WIN32 */
+
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");
#endif /* HAVE_BIND_TEXTDOMAIN_CODESET */
-#endif /* WIN32 */
+
#endif /* ENABLE_NLS */
return err;
Modified: subversion/branches/inheritable-props/subversion/libsvn_subr/opt.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_subr/opt.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_subr/opt.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_subr/opt.c Wed Sep 5 20:17:54 2012
@@ -1102,28 +1102,50 @@ svn_opt__arg_canonicalize_path(const cha
return SVN_NO_ERROR;
}
+
+const svn_opt__version_info_t *
+svn_opt__get_version_info(apr_pool_t *pool)
+{
+ svn_opt__version_info_t *info = apr_pcalloc(pool, sizeof(*info));
+
+ info->version_number = SVN_VER_NUMBER;
+ info->version_string = SVN_VERSION;
+ info->build_date = __DATE__;
+ info->build_time = __TIME__;
+ info->build_host = SVN_BUILD_HOST;
+ info->copyright = apr_pstrdup
+ (pool, _("Copyright (C) 2012 The Apache Software Foundation.\n"
+ "This software consists of contributions made by many "
+ "people; see the NOTICE\n"
+ "file for more information.\n"
+ "Subversion is open source software, see "
+ "http://subversion.apache.org/\n"));
+ info->runtime_host = svn_sysinfo__canonical_host(pool);
+ info->runtime_osname = svn_sysinfo__release_name(pool);
+ info->linked_libs = svn_sysinfo__linked_libs(pool);
+ info->loaded_libs = svn_sysinfo__loaded_libs(pool);
+
+ return info;
+}
+
+
svn_error_t *
svn_opt__print_version_info(const char *pgm_name,
const char *footer,
+ const svn_opt__version_info_t *info,
svn_boolean_t quiet,
svn_boolean_t verbose,
apr_pool_t *pool)
{
if (quiet)
- return svn_cmdline_printf(pool, "%s\n", SVN_VER_NUMBER);
+ return svn_cmdline_printf(pool, "%s\n", info->version_number);
SVN_ERR(svn_cmdline_printf(pool, _("%s, version %s\n"
" compiled %s, %s on %s\n\n"),
- pgm_name, SVN_VERSION, __DATE__, __TIME__,
- SVN_BUILD_HOST));
- SVN_ERR(svn_cmdline_fputs(
- _("Copyright (C) 2012 The Apache Software Foundation.\n"
- "This software consists of contributions made by many "
- "people; see the NOTICE\n"
- "file for more information.\n"
- "Subversion is open source software, see "
- "http://subversion.apache.org/\n\n"),
- stdout, pool));
+ pgm_name, info->version_string,
+ info->build_date, info->build_time,
+ info->build_host));
+ SVN_ERR(svn_cmdline_printf(pool, "%s\n", info->copyright));
if (footer)
{
@@ -1132,38 +1154,64 @@ svn_opt__print_version_info(const char *
if (verbose)
{
- const char *const host = svn_sysinfo__canonical_host(pool);
- const char *const relname = svn_sysinfo__release_name(pool);
- const char *const slibs = svn_sysinfo__linked_libs(pool);
- const char *const dlibs = svn_sysinfo__loaded_libs(pool);
-
SVN_ERR(svn_cmdline_fputs(_("System information:\n\n"), stdout, pool));
- if (relname)
- SVN_ERR(svn_cmdline_printf(pool, _("* running on %s\n"
- " - %s\n"),
- host, relname));
- else
- SVN_ERR(svn_cmdline_printf(pool, _("* running on %s\n"), host));
+ SVN_ERR(svn_cmdline_printf(pool, _("* running on %s\n"),
+ info->runtime_host));
+ if (info->runtime_osname)
+ {
+ SVN_ERR(svn_cmdline_printf(pool, _(" - %s\n"),
+ info->runtime_osname));
+ }
- if (slibs)
+ if (info->linked_libs && info->linked_libs->nelts)
{
+ const svn_sysinfo__linked_lib_t *lib;
+ int i;
+
SVN_ERR(svn_cmdline_fputs(_("* linked dependencies:\n"),
stdout, pool));
- SVN_ERR(svn_cmdline_fputs(slibs, stdout, pool));
+ for (i = 0; i < info->linked_libs->nelts; ++i)
+ {
+ lib = &APR_ARRAY_IDX(info->linked_libs, i,
+ svn_sysinfo__linked_lib_t);
+ if (lib->runtime_version)
+ SVN_ERR(svn_cmdline_printf(pool,
+ " - %s %s (compiled with %s)\n",
+ lib->name,
+ lib->runtime_version,
+ lib->compiled_version));
+ else
+ SVN_ERR(svn_cmdline_printf(pool,
+ " - %s %s (static)\n",
+ lib->name,
+ lib->compiled_version));
+ }
}
- if (dlibs)
+ if (info->loaded_libs && info->loaded_libs->nelts)
{
+ const svn_sysinfo__loaded_lib_t *lib;
+ int i;
+
SVN_ERR(svn_cmdline_fputs(_("* loaded shared libraries:\n"),
stdout, pool));
- SVN_ERR(svn_cmdline_fputs(dlibs, stdout, pool));
+ for (i = 0; i < info->loaded_libs->nelts; ++i)
+ {
+ lib = &APR_ARRAY_IDX(info->loaded_libs, i,
+ svn_sysinfo__loaded_lib_t);
+ if (lib->version)
+ SVN_ERR(svn_cmdline_printf(pool,
+ " - %s (%s)\n",
+ lib->name, lib->version));
+ else
+ SVN_ERR(svn_cmdline_printf(pool, " - %s\n", lib->name));
+ }
}
}
return SVN_NO_ERROR;
}
-
svn_error_t *
svn_opt_print_help4(apr_getopt_t *os,
const char *pgm_name,
@@ -1195,8 +1243,11 @@ svn_opt_print_help4(apr_getopt_t *os,
}
}
else if (print_version) /* just --version */
- SVN_ERR(svn_opt__print_version_info(pgm_name, version_footer,
- quiet, verbose, pool));
+ {
+ SVN_ERR(svn_opt__print_version_info(pgm_name, version_footer,
+ svn_opt__get_version_info(pool),
+ quiet, verbose, pool));
+ }
else if (os && !targets->nelts) /* `-h', `--help', or `help' */
svn_opt_print_generic_help2(header,
cmd_table,
Modified: subversion/branches/inheritable-props/subversion/libsvn_subr/opt.h
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_subr/opt.h?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_subr/opt.h (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_subr/opt.h Wed Sep 5 20:17:54 2012
@@ -24,15 +24,47 @@
#ifndef SVN_LIBSVN_SUBR_OPT_H
#define SVN_LIBSVN_SUBR_OPT_H
+#include <apr_tables.h>
#include "svn_opt.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-/* Print version info for PGM_NAME. If QUIET is true, print in
- * brief. Else if QUIET is not true, print the version more
- * verbosely, and if FOOTER is non-null, print it following the
+
+/* This structure stores the available information about the version,
+ * build and runtime environment of the Subversion client libraries.
+ */
+typedef struct svn_opt__version_info_t svn_opt__version_info_t;
+struct svn_opt__version_info_t
+{
+ const char *version_number; /* version number */
+ const char *version_string; /* version string */
+ const char *build_date; /* compilation date */
+ const char *build_time; /* compilation time */
+ const char *build_host; /* nuild canonical host name */
+ const char *copyright; /* vopyright notice */
+ const char *runtime_host; /* runtime canonical host name */
+ const char *runtime_osname; /* running OS release name */
+
+ /* Array svn_sysinfo__linked_lib_t describing dependent libraries */
+ const apr_array_header_t *linked_libs;
+
+ /* Array of svn_sysinfo__loaded_lib_t describing loaded shared libraries */
+ const apr_array_header_t *loaded_libs;
+};
+
+
+/* Return version information for the running program, allocated from POOL.
+ *
+ * Use POOL for temporary allocations.
+ */
+const svn_opt__version_info_t *
+svn_opt__get_version_info(apr_pool_t *pool);
+
+/* Print version version info for PGM_NAME to the console. If QUIET is
+ * true, print in brief. Else if QUIET is not true, print the version
+ * more verbosely, and if FOOTER is non-null, print it following the
* version information. If VERBOSE is true, print running system info.
*
* Use POOL for temporary allocations.
@@ -40,6 +72,7 @@ extern "C" {
svn_error_t *
svn_opt__print_version_info(const char *pgm_name,
const char *footer,
+ const svn_opt__version_info_t *info,
svn_boolean_t quiet,
svn_boolean_t verbose,
apr_pool_t *pool);
Modified: subversion/branches/inheritable-props/subversion/libsvn_subr/simple_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_subr/simple_providers.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_subr/simple_providers.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_subr/simple_providers.c Wed Sep 5 20:17:54 2012
@@ -475,6 +475,10 @@ svn_auth__simple_creds_cache_set(svn_boo
/* Save credentials to disk. */
err = svn_config_write_auth_data(creds_hash, SVN_AUTH_CRED_SIMPLE,
realmstring, config_dir, pool);
+ if (err)
+ *saved = FALSE;
+
+ /* ### return error? */
svn_error_clear(err);
return SVN_NO_ERROR;
Modified: subversion/branches/inheritable-props/subversion/libsvn_subr/sysinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_subr/sysinfo.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_subr/sysinfo.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_subr/sysinfo.c Wed Sep 5 20:17:54 2012
@@ -36,12 +36,16 @@
#include <apr_lib.h>
#include <apr_pools.h>
#include <apr_file_info.h>
+#include <apr_signal.h>
#include <apr_strings.h>
+#include <apr_thread_proc.h>
#include <apr_version.h>
#include <apu_version.h>
#include "svn_ctype.h"
#include "svn_error.h"
+#include "svn_io.h"
+#include "svn_string.h"
#include "svn_utf.h"
#include "private/svn_sqlite.h"
@@ -58,20 +62,25 @@
#endif
#if HAVE_UNAME
-static const char* canonical_host_from_uname(apr_pool_t *pool);
-static const char* release_name_from_uname(apr_pool_t *pool);
+static const char *canonical_host_from_uname(apr_pool_t *pool);
+# ifndef SVN_HAVE_MACOS_PLIST
+static const char *release_name_from_uname(apr_pool_t *pool);
+# endif
#endif
#ifdef WIN32
-static const char * win32_canonical_host(apr_pool_t *pool);
-static const char * win32_release_name(apr_pool_t *pool);
-static const char * win32_shared_libs(apr_pool_t *pool);
+static const char *win32_canonical_host(apr_pool_t *pool);
+static const char *win32_release_name(apr_pool_t *pool);
+static const apr_array_header_t *win32_shared_libs(apr_pool_t *pool);
#endif /* WIN32 */
#ifdef SVN_HAVE_MACOS_PLIST
static const char *macos_release_name(apr_pool_t *pool);
#endif /* SVN_HAVE_MACOS_PLIST */
+#if LINUX
+static const char *linux_release_name(apr_pool_t *pool);
+#endif
const char *
svn_sysinfo__canonical_host(apr_pool_t *pool)
@@ -91,8 +100,10 @@ svn_sysinfo__release_name(apr_pool_t *po
{
#ifdef WIN32
return win32_release_name(pool);
-#elif SVN_HAVE_MACOS_PLIST
+#elif defined(SVN_HAVE_MACOS_PLIST)
return macos_release_name(pool);
+#elif LINUX
+ return linux_release_name(pool);
#elif HAVE_UNAME
return release_name_from_uname(pool);
#else
@@ -100,30 +111,35 @@ svn_sysinfo__release_name(apr_pool_t *po
#endif
}
-const char *
+const apr_array_header_t *
svn_sysinfo__linked_libs(apr_pool_t *pool)
{
- const char *apr_ver =
- apr_psprintf(pool, "APR %s (compiled with %s)",
- apr_version_string(), APR_VERSION_STRING);
- const char *apr_util_ver =
- apr_psprintf(pool, "APR-Util %s (compiled with %s)",
- apu_version_string(), APU_VERSION_STRING);
- const char *sqlite_ver =
+ svn_sysinfo__linked_lib_t *lib;
+ apr_array_header_t *array = apr_array_make(pool, 3, sizeof(*lib));
+
+ lib = &APR_ARRAY_PUSH(array, svn_sysinfo__linked_lib_t);
+ lib->name = "APR";
+ lib->compiled_version = APR_VERSION_STRING;
+ lib->runtime_version = apr_pstrdup(pool, apr_version_string());
+
+ lib = &APR_ARRAY_PUSH(array, svn_sysinfo__linked_lib_t);
+ lib->name = "APR-Util";
+ lib->compiled_version = APU_VERSION_STRING;
+ lib->runtime_version = apr_pstrdup(pool, apu_version_string());
+
+ lib = &APR_ARRAY_PUSH(array, svn_sysinfo__linked_lib_t);
+ lib->name = "SQLite";
+ lib->compiled_version = apr_pstrdup(pool, svn_sqlite__compiled_version());
#ifdef SVN_SQLITE_INLINE
- apr_psprintf(pool, "SQLite %s (amalgamated)",
- svn_sqlite__runtime_version());
+ lib->runtime_version = NULL;
#else
- apr_psprintf(pool, "SQLite %s (compiled with %s)",
- svn_sqlite__runtime_version(),
- svn_sqlite__compiled_version());
+ lib->runtime_version = apr_pstrdup(pool, svn_sqlite__runtime_version());
#endif
- return apr_psprintf(pool, " - %s\n - %s\n - %s\n",
- apr_ver, apr_util_ver, sqlite_ver);
+ return array;
}
-const char *
+const apr_array_header_t *
svn_sysinfo__loaded_libs(apr_pool_t *pool)
{
#ifdef WIN32
@@ -198,6 +214,7 @@ canonical_host_from_uname(apr_pool_t *po
return apr_psprintf(pool, "%s-%s-%s%s", machine, vendor, sysname, sysver);
}
+# ifndef SVN_HAVE_MACOS_PLIST
/* Generate a release name from the uname(3) info, effectively
returning "`uname -s` `uname -r`". */
static const char *
@@ -235,9 +252,277 @@ release_name_from_uname(apr_pool_t *pool
}
return NULL;
}
+# endif /* !SVN_HAVE_MACOS_PLIST */
#endif /* HAVE_UNAME */
+#if LINUX
+/* Split a stringbuf into a key/value pair.
+ Return the key, leaving the striped value in the stringbuf. */
+static const char *
+stringbuf_split_key(svn_stringbuf_t *buffer, char delim)
+{
+ char *key;
+ char *end;
+
+ end = strchr(buffer->data, delim);
+ if (!end)
+ return NULL;
+
+ svn_stringbuf_strip_whitespace(buffer);
+ key = buffer->data;
+ end = strchr(key, delim);
+ *end = '\0';
+ buffer->len = 1 + end - key;
+ buffer->data = end + 1;
+ svn_stringbuf_strip_whitespace(buffer);
+
+ return key;
+}
+
+/* Parse `/usr/bin/lsb_rlease --all` */
+static const char *
+lsb_release(apr_pool_t *pool)
+{
+ static const char *const args[3] =
+ {
+ "/usr/bin/lsb_release",
+ "--all",
+ NULL
+ };
+
+ const char *distributor = NULL;
+ const char *description = NULL;
+ const char *release = NULL;
+ const char *codename = NULL;
+
+ apr_proc_t lsbproc;
+ svn_stream_t *lsbinfo;
+ svn_error_t *err;
+
+ /* Run /usr/bin/lsb_release --all < /dev/null 2>/dev/null */
+ {
+ apr_file_t *stdin_handle;
+ apr_file_t *stdout_handle;
+
+ err = svn_io_file_open(&stdin_handle, SVN_NULL_DEVICE_NAME,
+ APR_READ, APR_OS_DEFAULT, pool);
+ if (!err)
+ err = svn_io_file_open(&stdout_handle, SVN_NULL_DEVICE_NAME,
+ APR_WRITE, APR_OS_DEFAULT, pool);
+ if (!err)
+ err = svn_io_start_cmd3(&lsbproc, NULL, args[0], args, NULL, FALSE,
+ FALSE, stdin_handle,
+ TRUE, NULL,
+ FALSE, stdout_handle,
+ pool);
+ if (err)
+ {
+ svn_error_clear(err);
+ return NULL;
+ }
+ }
+
+ /* Parse the output and try to populate the */
+ lsbinfo = svn_stream_from_aprfile2(lsbproc.out, TRUE, pool);
+ if (lsbinfo)
+ {
+ for (;;)
+ {
+ svn_boolean_t eof = FALSE;
+ svn_stringbuf_t *line;
+ const char *key;
+
+ err = svn_stream_readline(lsbinfo, &line, "\n", &eof, pool);
+ if (err || eof)
+ break;
+
+ key = stringbuf_split_key(line, ':');
+ if (!key)
+ continue;
+
+ if (0 == svn_cstring_casecmp(key, "Distributor ID"))
+ distributor = line->data;
+ else if (0 == svn_cstring_casecmp(key, "Description"))
+ description = line->data;
+ else if (0 == svn_cstring_casecmp(key, "Release"))
+ release = line->data;
+ else if (0 == svn_cstring_casecmp(key, "Codename"))
+ codename = line->data;
+ }
+ svn_stream_close(lsbinfo);
+ if (err)
+ {
+ svn_error_clear(err);
+ apr_proc_kill(&lsbproc, SIGKILL);
+ return NULL;
+ }
+ }
+
+ /* Reap the child process */
+ err = svn_io_wait_for_cmd(&lsbproc, "", NULL, NULL, pool);
+ if (err)
+ {
+ svn_error_clear(err);
+ return NULL;
+ }
+
+ if (description)
+ return apr_psprintf(pool, "%s%s%s%s", description,
+ (codename ? " (" : ""),
+ (codename ? codename : ""),
+ (codename ? ")" : ""));
+ if (distributor)
+ return apr_psprintf(pool, "%s%s%s%s%s%s", distributor,
+ (release ? " " : ""),
+ (release ? release : ""),
+ (codename ? " (" : ""),
+ (codename ? codename : ""),
+ (codename ? ")" : ""));
+
+ return NULL;
+}
+
+/* Read the whole contents of a file. */
+static svn_stringbuf_t *
+read_file_contents(const char *filename, apr_pool_t *pool)
+{
+ svn_error_t *err;
+ svn_stringbuf_t *buffer;
+
+ err = svn_stringbuf_from_file2(&buffer, filename, pool);
+ if (err)
+ {
+ svn_error_clear(err);
+ return NULL;
+ }
+
+ return buffer;
+}
+
+/* Strip everything but the first line from a stringbuf. */
+static void
+stringbuf_first_line_only(svn_stringbuf_t *buffer)
+{
+ char *eol = strchr(buffer->data, '\n');
+ if (eol)
+ {
+ *eol = '\0';
+ buffer->len = 1 + eol - buffer->data;
+ }
+ svn_stringbuf_strip_whitespace(buffer);
+}
+
+/* Look at /etc/redhat_release to detect RHEL/Fedora/CentOS. */
+static const char *
+redhat_release(apr_pool_t *pool)
+{
+ svn_stringbuf_t *buffer = read_file_contents("/etc/redhat-release", pool);
+ if (buffer)
+ {
+ stringbuf_first_line_only(buffer);
+ return buffer->data;
+ }
+ return NULL;
+}
+
+/* Look at /etc/SuSE-release to detect non-LSB SuSE. */
+static const char *
+suse_release(apr_pool_t *pool)
+{
+ const char *release = NULL;
+ const char *codename = NULL;
+
+ svn_stringbuf_t *buffer = read_file_contents("/etc/SuSE-release", pool);
+ svn_stringbuf_t *line;
+ svn_stream_t *stream;
+ svn_boolean_t eof;
+ svn_error_t *err;
+ if (!buffer)
+ return NULL;
+
+ stream = svn_stream_from_stringbuf(buffer, pool);
+ err = svn_stream_readline(stream, &line, "\n", &eof, pool);
+ if (err || eof)
+ {
+ svn_error_clear(err);
+ return NULL;
+ }
+
+ svn_stringbuf_strip_whitespace(line);
+ release = line->data;
+
+ for (;;)
+ {
+ const char *key;
+
+ err = svn_stream_readline(stream, &line, "\n", &eof, pool);
+ if (err || eof)
+ {
+ svn_error_clear(err);
+ break;
+ }
+
+ key = stringbuf_split_key(line, '=');
+ if (!key)
+ continue;
+
+ if (0 == strncmp(key, "CODENAME", 8))
+ codename = line->data;
+ }
+
+ return apr_psprintf(pool, "%s%s%s%s",
+ release,
+ (codename ? " (" : ""),
+ (codename ? codename : ""),
+ (codename ? ")" : ""));
+}
+
+/* Look at /etc/debian_version to detect non-LSB Debian. */
+static const char *
+debian_release(apr_pool_t *pool)
+{
+ svn_stringbuf_t *buffer = read_file_contents("/etc/debian_version", pool);
+ if (!buffer)
+ return NULL;
+
+ stringbuf_first_line_only(buffer);
+ return apr_pstrcat(pool, "Debian ", buffer->data, NULL);
+}
+
+/* Try to find the Linux distribution name, or return info from uname. */
+static const char *
+linux_release_name(apr_pool_t *pool)
+{
+ const char *uname_release = release_name_from_uname(pool);
+
+ /* Try anything that has /usr/bin/lsb_release.
+ Covers, for example, Debian, Ubuntu and SuSE. */
+ const char *release_name = lsb_release(pool);
+
+ /* Try RHEL/Fedora/CentOS */
+ if (!release_name)
+ release_name = redhat_release(pool);
+
+ /* Try Non-LSB SuSE */
+ if (!release_name)
+ release_name = suse_release(pool);
+
+ /* Try non-LSB Debian */
+ if (!release_name)
+ release_name = debian_release(pool);
+
+ if (!release_name)
+ return uname_release;
+
+ if (!uname_release)
+ return release_name;
+
+ return apr_psprintf(pool, "%s [%s]", release_name, uname_release);
+}
+#endif /* LINUX */
+
+
#ifdef WIN32
typedef DWORD (WINAPI *FNGETNATIVESYSTEMINFO)(LPSYSTEM_INFO);
typedef BOOL (WINAPI *FNENUMPROCESSMODULES) (HANDLE, HMODULE, DWORD, LPDWORD);
@@ -513,12 +798,12 @@ file_version_number(const wchar_t *filen
}
/* List the shared libraries loaded by the current process. */
-static const char *
+static const apr_array_header_t *
win32_shared_libs(apr_pool_t *pool)
{
+ apr_array_header_t *array = NULL;
wchar_t buffer[MAX_PATH + 1];
HMODULE *handles = enum_loaded_modules(pool);
- char *libinfo = "";
HMODULE *module;
for (module = handles; module && *module; ++module)
@@ -532,25 +817,27 @@ win32_shared_libs(apr_pool_t *pool)
filename = wcs_to_utf8(buffer, pool);
if (filename)
{
+ svn_sysinfo__loaded_lib_t *lib;
char *truename;
+
if (0 == apr_filepath_merge(&truename, "", filename,
APR_FILEPATH_NATIVE
| APR_FILEPATH_TRUENAME,
pool))
filename = truename;
- if (version)
- libinfo = apr_pstrcat(pool, libinfo, " - ", filename,
- " (", version, ")\n", NULL);
- else
- libinfo = apr_pstrcat(pool, libinfo, " - ", filename,
- "\n", NULL);
+
+ if (!array)
+ {
+ array = apr_array_make(pool, 32, sizeof(*lib));
+ }
+ lib = &APR_ARRAY_PUSH(array, svn_sysinfo__loaded_lib_t);
+ lib->name = filename;
+ lib->version = version;
}
}
}
- if (*libinfo)
- return libinfo;
- return NULL;
+ return array;
}
#endif /* WIN32 */
Modified: subversion/branches/inheritable-props/subversion/libsvn_subr/sysinfo.h
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_subr/sysinfo.h?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_subr/sysinfo.h (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_subr/sysinfo.h Wed Sep 5 20:17:54 2012
@@ -25,11 +25,13 @@
#define SVN_LIBSVN_SUBR_SYSINFO_H
#include <apr_pools.h>
+#include <apr_tables.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
+
/* Return a canonical name similar to the output of config.guess,
* identifying the running system.
*
@@ -44,20 +46,39 @@ const char *svn_sysinfo__canonical_host(
*/
const char *svn_sysinfo__release_name(apr_pool_t *pool);
-/* Return a description of the link-time and run-time versions of
- * dependent libraries.
+/* Describes a linked dependency library */
+typedef struct svn_sysinfo__linked_lib_t svn_sysinfo__linked_lib_t;
+struct svn_sysinfo__linked_lib_t
+{
+ const char *name; /* library name */
+ const char *compiled_version; /* compile-time version string */
+ const char *runtime_version; /* run-time version string (optional) */
+};
+
+/* Return an array of svn_sysinfo__linked_lib_t of descriptions of the
+ * link-time and run-time versions of dependent libraries, or NULL of
+ * the info is not available.
*
* All allocations are done in POOL.
*/
-const char *svn_sysinfo__linked_libs(apr_pool_t *pool);
+const apr_array_header_t *svn_sysinfo__linked_libs(apr_pool_t *pool);
-/* Return a string containing a list of shared libraries loaded by the
- * running process, including their versions where applicable, or NULL
- * if the information is not available.
+/* Describes a loaded shared library */
+typedef struct svn_sysinfo__loaded_lib_t svn_sysinfo__loaded_lib_t;
+struct svn_sysinfo__loaded_lib_t
+{
+ const char *name; /* library name */
+ const char *version; /* library version (optional) */
+};
+
+/* Return an array of svn_sysinfo__loaded_lib_t of descriptions of
+ * shared libraries loaded by the running process, including their
+ * versions where applicable, or NULL if the information is not
+ * available.
*
* All allocations are done in POOL.
*/
-const char *svn_sysinfo__loaded_libs(apr_pool_t *pool);
+const apr_array_header_t *svn_sysinfo__loaded_libs(apr_pool_t *pool);
#ifdef __cplusplus
}
Modified: subversion/branches/inheritable-props/subversion/mod_dav_svn/dav_svn.h
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/mod_dav_svn/dav_svn.h?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/mod_dav_svn/dav_svn.h (original)
+++ subversion/branches/inheritable-props/subversion/mod_dav_svn/dav_svn.h Wed Sep 5 20:17:54 2012
@@ -389,7 +389,7 @@ const char *dav_svn__get_root_dir(reques
int dav_svn__get_compression_level(void);
/* Return the hook script environment parsed from the configuration. */
-apr_hash_t *dav_svn__get_hooks_env(request_rec *r);
+const char *dav_svn__get_hooks_env(request_rec *r);
/** For HTTP protocol v2, these are the new URIs and URI stubs
returned to the client in our OPTIONS response. They all depend
Modified: subversion/branches/inheritable-props/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/mod_dav_svn/mod_dav_svn.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/branches/inheritable-props/subversion/mod_dav_svn/mod_dav_svn.c Wed Sep 5 20:17:54 2012
@@ -96,7 +96,7 @@ typedef struct dir_conf_t {
enum conf_flag txdelta_cache; /* whether to enable txdelta caching */
enum conf_flag fulltext_cache; /* whether to enable fulltext caching */
enum conf_flag revprop_cache; /* whether to enable revprop caching */
- apr_hash_t *hooks_env; /* environment for hook scripts */
+ const char *hooks_env; /* path to hook script env config file */
} dir_conf_t;
@@ -550,43 +550,9 @@ SVNUseUTF8_cmd(cmd_parms *cmd, void *con
static const char *
SVNHooksEnv_cmd(cmd_parms *cmd, void *config, const char *arg1)
{
- apr_array_header_t *var;
-
- var = svn_cstring_split(arg1, "=", TRUE, cmd->pool);
- if (var && var->nelts >= 2)
- {
- dir_conf_t *conf = config;
- const char *name;
- const char *val;
-
- if (! conf->hooks_env)
- conf->hooks_env = apr_hash_make(cmd->pool);
-
- name = apr_pstrdup(apr_hash_pool_get(conf->hooks_env),
- APR_ARRAY_IDX(var, 0, const char *));
-
- /* Special case for values which contain '='. */
- if (var->nelts > 2)
- {
- svn_stringbuf_t *buf;
- int i;
-
- buf = svn_stringbuf_create(APR_ARRAY_IDX(var, 1, const char *),
- cmd->pool);
- for (i = 2; i < var->nelts; i++)
- {
- svn_stringbuf_appendbyte(buf, '=');
- svn_stringbuf_appendcstr(buf, APR_ARRAY_IDX(var, i, const char *));
- }
-
- val = apr_pstrdup(apr_hash_pool_get(conf->hooks_env), buf->data);
- }
- else
- val = apr_pstrdup(apr_hash_pool_get(conf->hooks_env),
- APR_ARRAY_IDX(var, 1, const char *));
+ dir_conf_t *conf = config;
- apr_hash_set(conf->hooks_env, name, APR_HASH_KEY_STRING, val);
- }
+ conf->hooks_env = svn_dirent_internal_style(arg1, cmd->pool);
return NULL;
}
@@ -878,7 +844,7 @@ dav_svn__get_compression_level(void)
return svn__compression_level;
}
-apr_hash_t *
+const char *
dav_svn__get_hooks_env(request_rec *r)
{
dir_conf_t *conf;
@@ -1136,10 +1102,12 @@ static const command_rec cmds[] =
"use UTF-8 as native character encoding (default is ASCII)."),
/* per directory/location */
- AP_INIT_ITERATE("SVNHooksEnv", SVNHooksEnv_cmd, NULL,
- ACCESS_CONF|RSRC_CONF,
- "Set the environment of hook scripts via any number of "
- "VAR=VAL arguments (the default hook environment is empty)."),
+ AP_INIT_TAKE1("SVNHooksEnv", SVNHooksEnv_cmd, NULL,
+ ACCESS_CONF|RSRC_CONF,
+ "Sets the path to the configuration file for the environment "
+ "of hook scripts. If not absolute, the path is relative to "
+ "the repository's conf directory (by default the hooks-env "
+ "file in the repository is used)."),
{ NULL }
};
Modified: subversion/branches/inheritable-props/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/mod_dav_svn/repos.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/mod_dav_svn/repos.c (original)
+++ subversion/branches/inheritable-props/subversion/mod_dav_svn/repos.c Wed Sep 5 20:17:54 2012
@@ -2217,8 +2217,9 @@ get_resource(request_rec *r,
HTTP_INTERNAL_SERVER_ERROR, r);
}
- /* Configure the hooks environment, if not empty. */
- svn_repos_hooks_setenv(repos->repos, dav_svn__get_hooks_env(r));
+ /* Configure hook script environment variables. */
+ svn_repos_hooks_setenv(repos->repos, dav_svn__get_hooks_env(r),
+ r->connection->pool, r->pool);
}
/* cache the filesystem object */
Modified: subversion/branches/inheritable-props/subversion/svn/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/svn/main.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/svn/main.c (original)
+++ subversion/branches/inheritable-props/subversion/svn/main.c Wed Sep 5 20:17:54 2012
@@ -506,8 +506,8 @@ const svn_opt_subcommand_desc2_t svn_cl_
"history.\n"
"usage: copy SRC[@REV]... DST\n"
"\n"
- "When copying multiple sources, they will be added as children of DST,\n"
- "which must be a directory.\n"
+ " When copying multiple sources, they will be added as children of DST,\n"
+ " which must be a directory.\n"
"\n"
" SRC and DST can each be either a working copy (WC) path or URL:\n"
" WC -> WC: copy and schedule for addition (with history)\n"
@@ -516,11 +516,11 @@ const svn_opt_subcommand_desc2_t svn_cl_
" URL -> URL: complete server-side copy; used to branch and tag\n"
" All the SRCs must be of the same type.\n"
"\n"
- "WARNING: For compatibility with previous versions of Subversion,\n"
- "copies performed using two working copy paths (WC -> WC) will not\n"
- "contact the repository. As such, they may not, by default, be able\n"
- "to propagate merge tracking information from the source of the copy\n"
- "to the destination.\n"),
+ " WARNING: For compatibility with previous versions of Subversion,\n"
+ " copies performed using two working copy paths (WC -> WC) will not\n"
+ " contact the repository. As such, they may not, by default, be able\n"
+ " to propagate merge tracking information from the source of the copy\n"
+ " to the destination.\n"),
{'r', 'q', opt_ignore_externals, opt_parents, SVN_CL__LOG_MSG_OPTIONS} },
{ "delete", svn_cl__delete, {"del", "remove", "rm"}, N_
@@ -1086,8 +1086,8 @@ const svn_opt_subcommand_desc2_t svn_cl_
("Move and/or rename something in working copy or repository.\n"
"usage: move SRC... DST\n"
"\n"
- "When moving multiple sources, they will be added as children of DST,\n"
- "which must be a directory.\n"
+ " When moving multiple sources, they will be added as children of DST,\n"
+ " which must be a directory.\n"
"\n"
" Note: this subcommand is equivalent to a 'copy' and 'delete'.\n"
" Note: the --revision option has no use and is deprecated.\n"
@@ -1164,7 +1164,7 @@ const svn_opt_subcommand_desc2_t svn_cl_
" 2. Edits unversioned remote prop on repos revision.\n"
" TARGET only determines which repository to access.\n"
"\n"
- "See 'svn help propset' for more on setting properties.\n"),
+ " See 'svn help propset' for more on setting properties.\n"),
{'r', opt_revprop, SVN_CL__LOG_MSG_OPTIONS, opt_force} },
{ "propget", svn_cl__propget, {"pget", "pg"}, N_
Modified: subversion/branches/inheritable-props/subversion/svn_private_config.hw
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/svn_private_config.hw?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/svn_private_config.hw (original)
+++ subversion/branches/inheritable-props/subversion/svn_private_config.hw Wed Sep 5 20:17:54 2012
@@ -83,6 +83,7 @@
#include <libintl.h>
#define _(x) dgettext(PACKAGE_NAME, x)
#define Q_(x1, x2, n) dngettext(PACKAGE_NAME, x1, x2, n)
+#define HAVE_BIND_TEXTDOMAIN_CODESET
#else
#define _(x) (x)
#define Q_(x1, x2, n) (((n) == 1) ? x1 : x2)
Modified: subversion/branches/inheritable-props/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/svnserve/serve.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/svnserve/serve.c (original)
+++ subversion/branches/inheritable-props/subversion/svnserve/serve.c Wed Sep 5 20:17:54 2012
@@ -3077,24 +3077,6 @@ repos_path_valid(const char *path)
return TRUE;
}
-/* Callback which receives hook environment variables from the hook
- * environment configuration section,
- * An implementation of svn_config_enumerator2_t. */
-static svn_boolean_t
-hooks_env_conf_cb(const char *name,
- const char *value,
- void *baton,
- apr_pool_t *pool)
-{
- apr_hash_t *hooks_env = baton;
- apr_pool_t *hash_pool = apr_hash_pool_get(hooks_env);
-
- apr_hash_set(hooks_env, apr_pstrdup(hash_pool, name),
- APR_HASH_KEY_STRING, apr_pstrdup(hash_pool, value));
-
- return TRUE;
-}
-
/* Look for the repository given by URL, using ROOT as the virtual
* repository root. If we find one, fill in the repos, fs, cfg,
* repos_url, and fs_path fields of B. Set B->repos's client
@@ -3107,7 +3089,7 @@ static svn_error_t *find_repos(const cha
const apr_array_header_t *capabilities,
apr_pool_t *pool)
{
- const char *path, *full_path, *repos_root, *fs_path;
+ const char *path, *full_path, *repos_root, *fs_path, *hooks_env;
svn_stringbuf_t *url_buf;
/* Skip past the scheme and authority part. */
@@ -3185,16 +3167,12 @@ static svn_error_t *find_repos(const cha
"No access allowed to this repository",
b, conn, pool);
- /* If a hook environment has been configured, set it up. */
- if (svn_config_has_section(b->cfg, SVN_CONFIG_SECTION_HOOKS_ENV))
- {
- apr_hash_t *hooks_env = apr_hash_make(pool);
-
- svn_config_enumerate2(b->cfg, SVN_CONFIG_SECTION_HOOKS_ENV,
- hooks_env_conf_cb, hooks_env, pool);
-
- svn_repos_hooks_setenv(b->repos, hooks_env);
- }
+ /* Configure hook script environment variables. */
+ svn_config_get(b->cfg, &hooks_env, SVN_CONFIG_SECTION_GENERAL,
+ SVN_CONFIG_OPTION_HOOKS_ENV, NULL);
+ if (hooks_env)
+ hooks_env = svn_dirent_internal_style(hooks_env, pool);
+ svn_repos_hooks_setenv(b->repos, hooks_env, pool, pool);
return SVN_NO_ERROR;
}
Modified: subversion/branches/inheritable-props/subversion/svnversion/svnversion.1
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/svnversion/svnversion.1?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/svnversion/svnversion.1 (original)
+++ subversion/branches/inheritable-props/subversion/svnversion/svnversion.1 Wed Sep 5 20:17:54 2012
@@ -26,7 +26,7 @@
svnversion \- Produce a compact version number for a working copy.
.SH SYNOPSIS
.TP
-\fBsvnversion\fP [\fIwc_path\fP [\fItrail_url\fP]]
+\fBsvnversion\fP [\fIoptions\fP] [\fIwc_path\fP [\fItrail_url\fP]]
.SH OVERVIEW
Subversion is a version control system, which allows you to keep old
versions of files and directories (usually source code), keep a log of
Modified: subversion/branches/inheritable-props/tools/dev/unix-build/Makefile.svn
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/tools/dev/unix-build/Makefile.svn?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/tools/dev/unix-build/Makefile.svn (original)
+++ subversion/branches/inheritable-props/tools/dev/unix-build/Makefile.svn Wed Sep 5 20:17:54 2012
@@ -862,6 +862,8 @@ endif
> $(CYRUS_SASL_SRCDIR)/lib/dlopen.c.patched
mv $(CYRUS_SASL_SRCDIR)/lib/dlopen.c.patched \
$(CYRUS_SASL_SRCDIR)/lib/dlopen.c
+ # Fix a weird autotools error about missing cmulocal dir
+ (cd $(CYRUS_SASL_SRCDIR)/saslauthd/ && ln -sf ../cmulocal)
touch $@
# configure cyrus-sasl
Modified: subversion/branches/inheritable-props/tools/server-side/svnauthz-validate.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/tools/server-side/svnauthz-validate.c?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/tools/server-side/svnauthz-validate.c (original)
+++ subversion/branches/inheritable-props/tools/server-side/svnauthz-validate.c Wed Sep 5 20:17:54 2012
@@ -28,32 +28,56 @@
*
*/
+#include "svn_cmdline.h"
+#include "svn_dirent_uri.h"
+#include "svn_opt.h"
#include "svn_pools.h"
#include "svn_repos.h"
-#include "svn_cmdline.h"
+#include "svn_utf.h"
+
+enum {
+ OPT_USERNAME = SVN_OPT_FIRST_LONGOPT_ID,
+ OPT_PATH,
+ OPT_REPOS
+};
+
+static int
+usage(const char *argv0)
+{
+ printf("Usage: %s FILE [--username USER [--path FSPATH] [--repository REPOS_NAME]]\n\n", argv0);
+ printf("Loads the authz file at FILE and validates its syntax.\n"
+ "Optionally prints the access available to USER for FSPATH in\n"
+ "repository with authz name REPOS_NAME. If FSPATH is omitted, reports\n"
+ "whether USER has any access at all.\n"
+ "Returns:\n"
+ " 0 when syntax is OK.\n"
+ " 1 when syntax is invalid.\n"
+ " 2 operational error\n");
+ return 2;
+}
int
main(int argc, const char **argv)
{
apr_pool_t *pool;
svn_error_t *err;
+ apr_status_t apr_err;
svn_authz_t *authz;
- const char *authz_file;
-
- if (argc != 2 && argc != 4 && argc != 5)
+ apr_getopt_t *os;
+ const apr_getopt_option_t options[] =
{
- printf("Usage: %s FILE [USER PATH [REPOS_NAME]]\n\n", argv[0]);
- printf("Loads the authz file at FILE and validates its syntax.\n"
- "Optionally reports the access available to USER for PATH in\n"
- "repository REPOS_NAME.\n"
- "Returns:\n"
- " 0 when syntax is OK.\n"
- " 1 when syntax is invalid.\n"
- " 2 operational error\n");
- return 2;
- }
-
- authz_file = argv[1];
+ {"username", OPT_USERNAME, 1, ("the authenticated username")},
+ {"path", OPT_PATH, 1, ("path within the repository")},
+ {"repository", OPT_REPOS, 1, ("repository authz name")},
+ {0, 0, 0, 0}
+ };
+ struct {
+ const char *authz_file;
+ const char *username;
+ const char *fspath;
+ const char *repos_name;
+ } opts;
+ opts.username = opts.fspath = opts.repos_name = NULL;
/* Initialize the app. Send all error messages to 'stderr'. */
if (svn_cmdline_init(argv[0], stderr) != EXIT_SUCCESS)
@@ -61,16 +85,69 @@ main(int argc, const char **argv)
pool = svn_pool_create(NULL);
+ /* Repeat svn_cmdline__getopt_init() inline. */
+ apr_err = apr_getopt_init(&os, pool, argc, argv);
+ if (apr_err)
+ return svn_cmdline_handle_exit_error(
+ svn_error_wrap_apr(apr_err,
+ ("Error initializing command line arguments")),
+ pool, "svn-rep-sharing-stats: ");
+
+ os->interleave = 1;
+ while (1)
+ {
+ int opt;
+ const char *arg;
+ apr_status_t status = apr_getopt_long(os, options, &opt, &arg);
+ if (APR_STATUS_IS_EOF(status))
+ break;
+ if (status != APR_SUCCESS)
+ {
+ return usage(argv[0]);
+ }
+ switch (opt)
+ {
+ case OPT_USERNAME:
+ /* ### TODO: UTF-8? */
+ opts.username = arg;
+ break;
+ case OPT_PATH:
+ /* ### TODO: UTF-8? */
+ opts.fspath = arg;
+ break;
+ case OPT_REPOS:
+ opts.repos_name = arg;
+ break;
+ default:
+ return usage(argv[0]);
+ }
+ }
+
+ /* Exactly 1 non-option argument, and no --repository/--path
+ unless --username. */
+ if (os->ind + 1 != argc || (!opts.username && (opts.fspath || opts.repos_name)))
+ {
+ return usage(argv[0]);
+ }
+
+ /* Grab AUTHZ_FILE from argv. */
+ SVN_INT_ERR(svn_utf_cstring_to_utf8(&opts.authz_file, os->argv[os->ind],
+ pool));
+ opts.authz_file = svn_dirent_internal_style(opts.authz_file, pool);
+
/* Read the access file and validate it. */
- err = svn_repos_authz_read(&authz, authz_file, TRUE, pool);
+ err = svn_repos_authz_read(&authz, opts.authz_file, TRUE, pool);
- if (!err && (argc == 4 || argc == 5))
+ /* Optionally, print the access a USER has to a given PATH in REPOS.
+ PATH and REPOS may be NULL. */
+ if (!err && opts.username)
{
- const char *user = argv[2], *path = argv[3];
- const char *repos = argc == 5 ? argv[4] : "";
+ const char *user = opts.username;
+ const char *path = opts.fspath;
+ const char *repos = opts.repos_name;
svn_boolean_t read_access, write_access;
- if (path[0] != '/')
+ if (path && path[0] != '/')
path = apr_pstrcat(pool, "/", path, NULL);
err = svn_repos_authz_check_access(authz, repos, path, user,
@@ -81,12 +158,9 @@ main(int argc, const char **argv)
svn_authz_read, &read_access,
pool);
if (!err)
- printf("user '%s' has %s access to '%s'%s%s\n",
- user,
- write_access ? "rw" : read_access ? "r" : "no",
- path,
- repos[0] ? "in repository " : "",
- repos);
+ printf("%s\n",
+ write_access ? "rw" : read_access ? "r" : "no"
+ );
}
svn_pool_destroy(pool);
Modified: subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.debian
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.debian?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.debian (original)
+++ subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.debian Wed Sep 5 20:17:54 2012
@@ -24,6 +24,7 @@ SVNWCSUB_CMD="/opt/svnpubsub/svnwcsub.py
--logfile=${svnwcsub_logfile} \
--pidfile=${pidfile} \
--uid=${svnwcsub_user} --gid=${svnwcsub_group} \
+ --umask=002 \
${svnwcsub_config} "
RETVAL=0
Modified: subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.freebsd
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.freebsd?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.freebsd (original)
+++ subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.freebsd Wed Sep 5 20:17:54 2012
@@ -33,6 +33,7 @@ command_args="--daemon \
--logfile=${svnwcsub_logfile} \
--pidfile=${pidfile} \
--uid=${svnwcsub_user} --gid=${svnwcsub_group} \
- --umask=002 ${svnwcsub_config}"
+ --umask=002 \
+ ${svnwcsub_config}"
run_rc_command "$1"
Modified: subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.solaris
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.solaris?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.solaris (original)
+++ subversion/branches/inheritable-props/tools/server-side/svnpubsub/rc.d/svnwcsub.solaris Wed Sep 5 20:17:54 2012
@@ -14,8 +14,8 @@ SVNWCSUB_CMD="/usr/local/svnpubsub/svnwc
--daemon \
--logfile=${svnwcsub_logfile} \
--pidfile=${pidfile} \
- --umask=002 \
--uid=${svnwcsub_user} --gid=${svnwcsub_group} \
+ --umask=002 \
${svnwcsub_config}"
RETVAL=0
Modified: subversion/branches/inheritable-props/tools/server-side/svnpubsub/svnwcsub.py
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/tools/server-side/svnpubsub/svnwcsub.py?rev=1381337&r1=1381336&r2=1381337&view=diff
==============================================================================
--- subversion/branches/inheritable-props/tools/server-side/svnpubsub/svnwcsub.py (original)
+++ subversion/branches/inheritable-props/tools/server-side/svnpubsub/svnwcsub.py Wed Sep 5 20:17:54 2012
@@ -258,7 +258,7 @@ class BackgroundWorker(threading.Thread)
dotrevision = os.path.join(wc.path, '.revision')
try:
os.unlink(dotrevision)
- except IOError, e:
+ except OSError, e:
if e.errno != errno.ENOENT:
raise
open(dotrevision, 'w').write(info['Revision'])