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

« back to all changes in this revision

Viewing changes to subversion/libsvn_wc/workqueue.c

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include <apr_pools.h>
25
25
 
 
26
#include "svn_private_config.h"
26
27
#include "svn_types.h"
27
28
#include "svn_pools.h"
28
29
#include "svn_dirent_uri.h"
37
38
#include "conflicts.h"
38
39
#include "translate.h"
39
40
 
40
 
#include "svn_private_config.h"
 
41
#include "private/svn_io_private.h"
41
42
#include "private/svn_skel.h"
42
43
 
43
44
 
142
143
 
143
144
  SVN_ERR(svn_wc__db_base_remove(db, local_abspath,
144
145
                                 FALSE /* keep_as_working */,
145
 
                                 TRUE /* queue_deletes */,
146
 
                                 FALSE /* remove_locks */,
 
146
                                 SVN_IS_VALID_REVNUM(not_present_rev), FALSE,
147
147
                                 not_present_rev,
148
148
                                 NULL, NULL, scratch_pool));
149
149
 
395
395
  const char *entries_path;
396
396
  const char *format_path;
397
397
  const char *wcroot_abspath;
398
 
  const char *adm_path;
399
 
  const char *temp_path;
400
398
  svn_error_t *err;
401
399
 
402
400
  err = svn_wc__wipe_postupgrade(wri_abspath, FALSE,
410
408
  SVN_ERR(svn_wc__db_get_wcroot(&wcroot_abspath, db, wri_abspath,
411
409
                                scratch_pool, scratch_pool));
412
410
 
413
 
  adm_path = svn_wc__adm_child(wcroot_abspath, NULL, scratch_pool);
414
411
  entries_path = svn_wc__adm_child(wcroot_abspath, SVN_WC__ADM_ENTRIES,
415
412
                                   scratch_pool);
416
413
  format_path = svn_wc__adm_child(wcroot_abspath, SVN_WC__ADM_FORMAT,
421
418
     ### The order may matter for some sufficiently old clients.. but
422
419
     ### this code only runs during upgrade after the files had been
423
420
     ### removed earlier during the upgrade. */
424
 
  SVN_ERR(svn_io_write_unique(&temp_path, adm_path, SVN_WC__NON_ENTRIES_STRING,
 
421
  SVN_ERR(svn_io_write_atomic(format_path, SVN_WC__NON_ENTRIES_STRING,
425
422
                              sizeof(SVN_WC__NON_ENTRIES_STRING) - 1,
426
 
                              svn_io_file_del_none, scratch_pool));
427
 
  SVN_ERR(svn_io_file_rename(temp_path, format_path, scratch_pool));
 
423
                              NULL, scratch_pool));
428
424
 
429
 
  SVN_ERR(svn_io_write_unique(&temp_path, adm_path, SVN_WC__NON_ENTRIES_STRING,
 
425
  SVN_ERR(svn_io_write_atomic(entries_path, SVN_WC__NON_ENTRIES_STRING,
430
426
                              sizeof(SVN_WC__NON_ENTRIES_STRING) - 1,
431
 
                              svn_io_file_del_none, scratch_pool));
432
 
  SVN_ERR(svn_io_file_rename(temp_path, entries_path, scratch_pool));
 
427
                              NULL, scratch_pool));
433
428
 
434
429
  return SVN_NO_ERROR;
435
430
}
474
469
  apr_hash_t *keywords;
475
470
  const char *temp_dir_abspath;
476
471
  svn_stream_t *dst_stream;
477
 
  const char *dst_abspath;
478
472
  apr_int64_t val;
479
473
  const char *wcroot_abspath;
480
474
  const char *source_abspath;
577
571
  /* Translate to a temporary file. We don't want the user seeing a partial
578
572
     file, nor let them muck with it while we translate. We may also need to
579
573
     get its TRANSLATED_SIZE before the user can monkey it.  */
580
 
  SVN_ERR(svn_stream_open_unique(&dst_stream, &dst_abspath,
581
 
                                 temp_dir_abspath,
582
 
                                 svn_io_file_del_none,
583
 
                                 scratch_pool, scratch_pool));
 
574
  SVN_ERR(svn_stream__create_for_install(&dst_stream, temp_dir_abspath,
 
575
                                         scratch_pool, scratch_pool));
584
576
 
585
577
  /* Copy from the source to the dest, translating as we go. This will also
586
578
     close both streams.  */
589
581
                           scratch_pool));
590
582
 
591
583
  /* All done. Move the file into place.  */
592
 
 
593
 
  {
594
 
    svn_error_t *err;
595
 
 
596
 
    err = svn_io_file_rename(dst_abspath, local_abspath, scratch_pool);
597
 
 
598
 
    /* With a single db we might want to install files in a missing directory.
599
 
       Simply trying this scenario on error won't do any harm and at least
600
 
       one user reported this problem on IRC. */
601
 
    if (err && APR_STATUS_IS_ENOENT(err->apr_err))
602
 
      {
603
 
        svn_error_t *err2;
604
 
 
605
 
        err2 = svn_io_make_dir_recursively(svn_dirent_dirname(local_abspath,
606
 
                                                              scratch_pool),
607
 
                                           scratch_pool);
608
 
 
609
 
        if (err2)
610
 
          /* Creating directory didn't work: Return all errors */
611
 
          return svn_error_trace(svn_error_compose_create(err, err2));
612
 
        else
613
 
          /* We could create a directory: retry install */
614
 
          svn_error_clear(err);
615
 
 
616
 
        SVN_ERR(svn_io_file_rename(dst_abspath, local_abspath, scratch_pool));
617
 
      }
618
 
    else
619
 
      SVN_ERR(err);
620
 
  }
 
584
  /* With a single db we might want to install files in a missing directory.
 
585
     Simply trying this scenario on error won't do any harm and at least
 
586
     one user reported this problem on IRC. */
 
587
  SVN_ERR(svn_stream__install_stream(dst_stream, local_abspath,
 
588
                                     TRUE /* make_parents*/, scratch_pool));
621
589
 
622
590
  /* Tweak the on-disk file according to its properties.  */
623
591
#ifndef WIN32
1047
1015
svn_wc__wq_build_dir_install(svn_skel_t **work_item,
1048
1016
                             svn_wc__db_t *db,
1049
1017
                             const char *local_abspath,
1050
 
                             apr_pool_t *scratch_pool,
1051
 
                             apr_pool_t *result_pool)
 
1018
                             apr_pool_t *result_pool,
 
1019
                             apr_pool_t *scratch_pool)
1052
1020
{
1053
1021
  const char *local_relpath;
1054
1022
 
1138
1106
  SVN_ERR(svn_wc__db_from_relpath(&local_abspath, db, wri_abspath,
1139
1107
                                  local_relpath, scratch_pool, scratch_pool));
1140
1108
 
1141
 
  SVN_ERR(svn_wc__db_read_conflict(&conflicts, db, local_abspath,
 
1109
  SVN_ERR(svn_wc__db_read_conflict(&conflicts, NULL, NULL, db, local_abspath,
1142
1110
                                   scratch_pool, scratch_pool));
1143
1111
 
1144
1112
  SVN_ERR(svn_wc__conflict_read_prop_conflict(&prejfile_abspath,
1147
1115
                                              scratch_pool, scratch_pool));
1148
1116
 
1149
1117
  if (arg1->next != NULL)
1150
 
    prop_conflict_skel = arg1->next;
 
1118
    prop_conflict_skel = arg1->next; /* Before Subversion 1.9 */
1151
1119
  else
1152
 
    SVN_ERR_MALFUNCTION();  /* ### wc_db can't provide it ... yet.  */
 
1120
    prop_conflict_skel = NULL; /* Read from DB */
1153
1121
 
1154
1122
  /* Construct a property reject file in the temporary area.  */
1155
1123
  SVN_ERR(svn_wc__create_prejfile(&tmp_prejfile_abspath,
1156
1124
                                  db, local_abspath,
1157
1125
                                  prop_conflict_skel,
 
1126
                                  cancel_func, cancel_baton,
1158
1127
                                  scratch_pool, scratch_pool));
1159
1128
 
1160
1129
  /* ... and atomically move it into place.  */
1170
1139
svn_wc__wq_build_prej_install(svn_skel_t **work_item,
1171
1140
                              svn_wc__db_t *db,
1172
1141
                              const char *local_abspath,
1173
 
                              svn_skel_t *conflict_skel,
 
1142
                              /*svn_skel_t *conflict_skel,*/
1174
1143
                              apr_pool_t *result_pool,
1175
1144
                              apr_pool_t *scratch_pool)
1176
1145
{
1177
1146
  const char *local_relpath;
1178
1147
  *work_item = svn_skel__make_empty_list(result_pool);
1179
1148
 
1180
 
  /* ### gotta have this, today  */
1181
 
  SVN_ERR_ASSERT(conflict_skel != NULL);
1182
 
 
1183
1149
  SVN_ERR(svn_wc__db_to_relpath(&local_relpath, db, local_abspath,
1184
1150
                                local_abspath, result_pool, scratch_pool));
1185
1151
 
1186
 
  if (conflict_skel != NULL)
1187
 
    svn_skel__prepend(conflict_skel, *work_item);
 
1152
  /* ### In Subversion 1.7 and 1.8 we created a legacy property conflict skel
 
1153
         here:
 
1154
    if (conflict_skel != NULL)
 
1155
      svn_skel__prepend(conflict_skel, *work_item);
 
1156
   */
1188
1157
  svn_skel__prepend_str(local_relpath, *work_item, result_pool);
1189
1158
  svn_skel__prepend_str(OP_PREJ_INSTALL, *work_item, result_pool);
1190
1159
 
1317
1286
    /* Check if we should combine with a property conflict... */
1318
1287
    svn_skel_t *conflicts;
1319
1288
 
1320
 
    SVN_ERR(svn_wc__db_read_conflict(&conflicts, db, local_abspath,
 
1289
    SVN_ERR(svn_wc__db_read_conflict(&conflicts, NULL, NULL, db, local_abspath,
1321
1290
                                     scratch_pool, scratch_pool));
1322
1291
 
1323
1292
    if (! conflicts)
1383
1352
    svn_skel_t *conflicts;
1384
1353
    apr_hash_t *prop_names;
1385
1354
 
1386
 
    SVN_ERR(svn_wc__db_read_conflict(&conflicts, db, local_abspath,
 
1355
    SVN_ERR(svn_wc__db_read_conflict(&conflicts, NULL, NULL,
 
1356
                                     db, local_abspath,
1387
1357
                                     scratch_pool, scratch_pool));
1388
1358
 
1389
1359
    if (! conflicts)
1520
1490
  {
1521
1491
    static int count = 0;
1522
1492
    const char *count_env_var = getenv("SVN_DEBUG_WORK_QUEUE");
1523
 
 
1524
 
    if (count_env_var && ++count == atoi(count_env_var))
 
1493
    int count_env_val;
 
1494
 
 
1495
    SVN_ERR(svn_cstring_atoi(&count_env_val, count_env_var));
 
1496
 
 
1497
    if (count_env_var && ++count == count_env_val)
1525
1498
      return svn_error_create(SVN_ERR_CANCELLED, NULL, "fake cancel");
1526
1499
  }
1527
1500
#endif