~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/libsvn_subr/debug.c

  • Committer: Package Import Robot
  • Author(s): James McCoy, Peter Samuelson, James McCoy
  • Date: 2014-01-12 19:48:33 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20140112194833-w3axfwksn296jn5x
Tags: 1.8.5-1
[ Peter Samuelson ]
* New upstream release.  (Closes: #725787) Rediff patches:
  - Remove apr-abi1 (applied upstream), rename apr-abi2 to apr-abi
  - Remove loosen-sqlite-version-check (shouldn't be needed)
  - Remove java-osgi-metadata (applied upstream)
  - svnmucc prompts for a changelog if none is provided. (Closes: #507430)
  - Remove fix-bdb-version-detection, upstream uses "apu-config --dbm-libs"
  - Remove ruby-test-wc (applied upstream)
  - Fix “svn diff -r N file” when file has svn:mime-type set.
    (Closes: #734163)
  - Support specifying an encoding for mod_dav_svn's environment in which
    hooks are run.  (Closes: #601544)
  - Fix ordering of “svnadmin dump” paths with certain APR versions.
    (Closes: #687291)
  - Provide a better error message when authentication fails with an
    svn+ssh:// URL.  (Closes: #273874)
  - Updated Polish translations.  (Closes: #690815)

[ James McCoy ]
* Remove all traces of libneon, replaced by libserf.
* patches/sqlite_3.8.x_workaround: Upstream fix for wc-queries-test test
  failurse.
* Run configure with --with-apache-libexecdir, which allows removing part of
  patches/rpath.
* Re-enable auth-test as upstream has fixed the problem of picking up
  libraries from the environment rather than the build tree.
  (Closes: #654172)
* Point LD_LIBRARY_PATH at the built auth libraries when running the svn
  command during the build.  (Closes: #678224)
* Add a NEWS entry describing how to configure mod_dav_svn to understand
  UTF-8.  (Closes: #566148)
* Remove ancient transitional package, libsvn-ruby.
* Enable compatibility with Sqlite3 versions back to Wheezy.
* Enable hardening flags.  (Closes: #734918)
* patches/build-fixes: Enable verbose build logs.
* Build against the default ruby version.  (Closes: #722393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
   be used in release code. One of the reasons to avoid this code in release
26
26
   builds is that this code is not thread-safe. */
27
27
#include <stdarg.h>
 
28
#include <assert.h>
28
29
 
 
30
#include <apr_pools.h>
 
31
#include <apr_strings.h>
29
32
#include "svn_types.h"
 
33
#include "svn_string.h"
30
34
 
 
35
#ifndef SVN_DBG__PROTOTYPES
 
36
#define SVN_DBG__PROTOTYPES
 
37
#endif
31
38
#include "private/svn_debug.h"
32
39
 
33
40
 
 
41
#define DBG_FLAG "DBG: "
 
42
 
34
43
/* This will be tweaked by the preamble code.  */
 
44
static const char *debug_file = NULL;
 
45
static long debug_line = 0;
35
46
static FILE * volatile debug_output = NULL;
36
47
 
37
48
 
54
65
 
55
66
      if (slash == NULL)
56
67
        slash = strrchr(file, '\\');
57
 
      if (slash == NULL)
58
 
        slash = file;
 
68
      if (slash)
 
69
        debug_file = slash + 1;
59
70
      else
60
 
        ++slash;
61
 
 
62
 
      fprintf(output, "DBG: %s:%4ld: ", slash, line);
 
71
        debug_file = file;
63
72
    }
 
73
  debug_line = line;
64
74
}
65
75
 
66
76
 
67
 
void
68
 
svn_dbg__printf(const char *fmt, ...)
 
77
/* Print a formatted string using format FMT and argument-list AP,
 
78
 * prefixing each line of output with a debug header. */
 
79
static void
 
80
debug_vprintf(const char *fmt, va_list ap)
69
81
{
70
82
  FILE *output = debug_output;
71
 
  va_list ap;
 
83
  char prefix[80], buffer[1000];
 
84
  char *s = buffer;
 
85
  int n;
72
86
 
73
87
  if (output == NULL || quiet_mode())
74
88
    return;
75
89
 
 
90
  n = apr_snprintf(prefix, sizeof(prefix), DBG_FLAG "%s:%4ld: ",
 
91
                   debug_file, debug_line);
 
92
  assert(n < sizeof(prefix) - 1);
 
93
  n = apr_vsnprintf(buffer, sizeof(buffer), fmt, ap);
 
94
  assert(n < sizeof(buffer) - 1);
 
95
  do
 
96
    {
 
97
      char *newline = strchr(s, '\n');
 
98
      if (newline)
 
99
        *newline = '\0';
 
100
 
 
101
      fputs(prefix, output);
 
102
      fputs(s, output);
 
103
      fputc('\n', output);
 
104
 
 
105
      if (! newline)
 
106
        break;
 
107
      s = newline + 1;
 
108
    }
 
109
  while (*s);  /* print another line, except after a final newline */
 
110
}
 
111
 
 
112
 
 
113
void
 
114
svn_dbg__printf(const char *fmt, ...)
 
115
{
 
116
  va_list ap;
 
117
 
76
118
  va_start(ap, fmt);
77
 
  (void) vfprintf(output, fmt, ap);
78
 
  va_end(ap);
79
 
}
 
119
  debug_vprintf(fmt, ap);
 
120
  va_end(ap);
 
121
}
 
122
 
 
123
 
 
124
void
 
125
svn_dbg__print_props(apr_hash_t *props,
 
126
                     const char *header_fmt,
 
127
                     ...)
 
128
{
 
129
/* We only build this code if SVN_DEBUG is defined. */
 
130
#ifdef SVN_DEBUG
 
131
 
 
132
  apr_hash_index_t *hi;
 
133
  va_list ap;
 
134
 
 
135
  va_start(ap, header_fmt);
 
136
  debug_vprintf(header_fmt, ap);
 
137
  va_end(ap);
 
138
 
 
139
  if (props == NULL)
 
140
    {
 
141
      svn_dbg__printf("    (null)\n");
 
142
      return;
 
143
    }
 
144
 
 
145
  for (hi = apr_hash_first(apr_hash_pool_get(props), props); hi;
 
146
        hi = apr_hash_next(hi))
 
147
    {
 
148
      const char *name = svn__apr_hash_index_key(hi);
 
149
      svn_string_t *val = svn__apr_hash_index_val(hi);
 
150
 
 
151
      svn_dbg__printf("    '%s' -> '%s'\n", name, val->data);
 
152
    }
 
153
#endif /* SVN_DEBUG */
 
154
}
 
155