~ubuntu-branches/ubuntu/precise/subversion/precise-security

« back to all changes in this revision

Viewing changes to subversion/libsvn_wc/questions.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2011-11-16 16:08:09 UTC
  • mfrom: (0.4.9 sid)
  • Revision ID: package-import@ubuntu.com-20111116160809-rmpcubpjittx9u6c
Tags: 1.6.17dfsg-2ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Create pot file on build.
  - Build a python-subversion-dbg package.
  - Build-depend on default-jre-headless/-jdk.
  - Do not apply java-build patch.
  - debian/rules: Manually create the doxygen output directory, otherwise
    we get weird build failures when running parallel builds.
  - Disable the serf backend because serf is in universe.
* Sync up python-subversion-dbg control fields with python-subversion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
#include "private/svn_wc_private.h"
44
44
#include "private/svn_sqlite.h"
45
45
 
46
 
#define SVN_WC_NG_CHECK_ENV_VAR "SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_CHECK_FOR_WC_NG"
47
 
 
48
 
static svn_error_t *
49
 
is_inside_wc_ng(const char *abspath,
50
 
                const char *target_path,
51
 
                int *wc_format,
52
 
                apr_pool_t *pool)
53
 
{
54
 
  svn_node_kind_t kind;
55
 
  const char *wc_db_path;
56
 
  char *wc_ng_check_env_var;
57
 
  svn_error_t *err;
58
 
 
59
 
  wc_ng_check_env_var = getenv(SVN_WC_NG_CHECK_ENV_VAR);
60
 
  if (wc_ng_check_env_var &&
61
 
      apr_strnatcasecmp(wc_ng_check_env_var, "yes") == 0)
62
 
    return SVN_NO_ERROR; /* Allow skipping for testing */
63
 
 
64
 
  wc_db_path = svn_path_join_many(pool, abspath, SVN_WC_ADM_DIR_NAME,
65
 
                                  "wc.db", NULL);
66
 
  err = svn_io_check_path(wc_db_path, &kind, pool);
67
 
  if (err)
68
 
    {
69
 
      svn_error_clear(err);
70
 
      return SVN_NO_ERROR;
71
 
    }
72
 
 
73
 
  if (kind == svn_node_file)
74
 
    {
75
 
      /* This value is completely bogus, but it is much higher than 1.6 will
76
 
         have any prayer of reading. */
77
 
      *wc_format = 9999;
78
 
 
79
 
      return svn_error_createf(SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
80
 
         _("The path '%s' appears to be part of a Subversion 1.7 or greater\n"
81
 
           "working copy rooted at '%s'.\n"
82
 
           "Please upgrade your Subversion client to use this working copy."
83
 
           ),
84
 
         svn_path_local_style(target_path, pool),
85
 
         svn_path_local_style(abspath, pool));
86
 
    }
87
 
 
88
 
  if (svn_dirent_is_root(abspath, strlen(abspath)))
89
 
    return SVN_NO_ERROR;
90
 
  else
91
 
    return is_inside_wc_ng(svn_path_dirname(abspath, pool), target_path,
92
 
                           wc_format, pool);
93
 
}
94
 
 
95
 
 
96
46
/* ### todo: make this compare repository too?  Or do so in parallel
97
47
   code.  */
98
48
svn_error_t *
146
96
  else if (err)
147
97
    return err;
148
98
 
149
 
  /* Let's check for the future. */
150
 
  if (*wc_format == 0)
151
 
    {
152
 
      const char *abspath;
153
 
 
154
 
      SVN_ERR(svn_path_get_absolute(&abspath, path, pool));
155
 
      SVN_ERR(is_inside_wc_ng(abspath, path, wc_format, pool));
156
 
    }
157
 
 
158
99
  if (*wc_format > 0)
159
100
    {
160
101
      /* If we managed to read the format file we assume that we