Fix issue #4440, "Subversion sets permissions on files, when it shouldn't"

* subversion/libsvn_subr/io.c
  (io_set_file_perms): Set the user read/write bits to make a file read/write,
   instead of merging in the default bits from the current umask.
   Merging bits from the current umask is a bad idea if the file's
   permissions are more restrictive than the umask implies.

Reported by: Attila Nagy


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537018 13f79535-47bb-0310-9956-ffa450edef68
When walking the base tree during update for crawling and bumping, do a tiny
bit more work in the query that handles all children of a directory to avoid
doing things in the later per node change.

This patch removes at least one query per node within an update, but as this
query is evaluated within an existing transaction this is not really
measurable on small working copies.

A followup patch will remove a more expensive query per node.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_SELECT_BASE_CHILDREN_INFO): Duplicate query to optimize for the case
    where we don't need the lock join.

* subversion/libsvn_wc/wc_db.c
  (base_get_children_info): New function, extracted from...
  (svn_wc__db_base_get_children_info): which now just calls
    base_get_children_info.

  (bump_node_revision): Call base_get_children_info to get the list of children
    and information about them in a single query. Move the operations that
    only apply to children and not to the update/switch root to the child loop.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537065 13f79535-47bb-0310-9956-ffa450edef68
* subversion/libsvn_wc/wc_db.c
  (bump_node_revision): Following up on r1537065, remove now duplicated
    handling of not present and server excluded nodes.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537066 13f79535-47bb-0310-9956-ffa450edef68
Following up on r1537065, remove a now unneeded query to read a node's base
information by passing some information that is already available in all
callers.

This removes one query on the NODES table for every node during the post
update revision bump. (And reduces the total time for the test suite with
about 2% for me)

* subversion/libsvn_wc/wc_db.c
  (bump_node_revision): Add arguments for the values originally obtained by a
    call to svn_wc__db_base_get_info_internal. Update recursive call, passing
    already available information. Remove exclude check for root that is
    already handled by callers.

  (bump_revisions_post_update): Update caller.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537071 13f79535-47bb-0310-9956-ffa450edef68
Make the srcdir option value easily accessible in all C tests.
Remove the existing workaround in config-test.

* subversion/tests/svn_test.h
  (svn_test_opts_t): add srcdir member

* subversion/tests/svn_test_main.c
  (main): actually process the already existing srcdir option

* subversion/tests/libsvn_subr/config-test.c
  (test_argc,
   test_argv,
   opt_def,
   srcdir,
   init_params): drop now obsolete globals & utils
  (test_text_retrieval,
   test_boolean_retrieval,
   test_has_section_case_insensitive,
   test_has_section_case_sensitive,
   test_has_option_case_sensitive, 
   test_stream_interface,
   test_read_only_mode): use srcdir from the options struct
  (test_funcs): pass options to everyone that needs them

git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537147 13f79535-47bb-0310-9956-ffa450edef68
* subversion/tests/svn_test_main.c
  (main): Convert the passed path to the Subversion canonical form before
    passing it to test functions.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537190 13f79535-47bb-0310-9956-ffa450edef68
Add regression test for the ZLib decompression problem identified in
ZLib 1.2.8 with assembly optimizations enabled.

This should make it easier for packagers to find out if they need to
fix their installation.

* subversion/tests/libsvn_subr/checksum-test.c
  (includes): Add zlib.h and svn_io.h.
  (zlib_expansion_test): New function.
  (test_funcs): Add zlib_expansion_test.

* subversion/tests/libsvn_subr/zlib.deflated
  Add the compressed version of an old Subversion CHANGES file that showcased
  the original compression problem.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537193 13f79535-47bb-0310-9956-ffa450edef68
* subversion/tests/libsvn_subr/checksum-test.c
  (zlib_expansion_test): Remove accidental duplicate variable definition,
    that broke the build on the Windows bots.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537221 13f79535-47bb-0310-9956-ffa450edef68
Construct paths in a proper way in the config tests.

* subversion/tests/libsvn_subr/config-test.c
  (includes): Add svn_dirent_uri.h.
  (test_text_retrieval,
   test_boolean_retrieval,
   test_has_section_case_insensitive,
   test_has_section_case_sensitive,
   test_has_option_case_sensitive,
   test_stream_interface,
   test_read_only_mode): Use svn_dirent_join to join paths.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537225 13f79535-47bb-0310-9956-ffa450edef68
* build.conf
  (checksum-test): Add zlib as dependency in an attempt to make the
    svn-x64-ubuntu-gcc bot happy en though libsvn_subr already links it.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537263 13f79535-47bb-0310-9956-ffa450edef68
Fix various issues with the config_pool object that came up during testing.

* subversion/libsvn_repos/config_pool.c
  (config_pool_cleanup,
   config_ref_cleanup): make sure only one thread acquires the cleanup token
  (config_by_url): use our specified hash function
  (svn_repos__config_pool_create): allocate in the right pool
  (svn_repos__config_pool_get): check the right pointer

git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537357 13f79535-47bb-0310-9956-ffa450edef68
Provide a comprehensive test for the config_pool API.

* subversion/tests/libsvn_repos
  svn:ignore temporary config files

* subversion/tests/libsvn_repos/repos-test.c
  (test_config_pool): new test
  (test_funcs): register it

git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537358 13f79535-47bb-0310-9956-ffa450edef68
mod_dav_svn: Fix crashes with other modules that don't expect r->filename
to be NULL (e.g. mod_wsgi).

* subversion/mod_dav_svn/mod_dav_svn.c
  (dav_svn__translate_name): Calculate a bogus path to put in r->filename
    of the form "svn:/path/to/repo/path/in/repo".


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537360 13f79535-47bb-0310-9956-ffa450edef68
Follow-up to r1537358: Fix - hopefully - tests on Windows.

* subversion/tests/libsvn_repos/repos-test.c
  (test_config_pool): prepend drive letter with a root slash

git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537364 13f79535-47bb-0310-9956-ffa450edef68
Update the repos tests to use proper path functions instead of apr_pstrcat to
avoid problems like those fixed in r1537364.

* subversion/tests/libsvn_repos/repos-test.c
  (in_repo_authz,
   in_repo_groups_authz,
   test_config_pool): Use proper uri and dirent functions instead of guessing.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537412 13f79535-47bb-0310-9956-ffa450edef68
Following up on r1537360, construct the bogus path in a different format to
avoid assertions in the dirent functions on Windows on repository paths that
can't be represented on disk.

* subversion/mod_dav_svn/mod_dav_svn.c
  (dav_svn__translate_name): Join components with '|'.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537415 13f79535-47bb-0310-9956-ffa450edef68
To make it easier to diagnose some possible remaining performance problems
compare in most cases equal but potentially relative paths first before
making them absolute and comparing again.

This avoids translating between character encodings, several transformations,
and in some cases potentially IO.

* subversion/mod_dav_svn/repos.c
  (copy_resource): Perform an initial string comparison before making the
    paths absolute, canonical, etc.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537440 13f79535-47bb-0310-9956-ffa450edef68
* subversion/libsvn_subr/io.c
  (svn_io_write_atomic): Properly delete the tempfile when the flush or rename
    fails and produce an easier to diagnose error.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537466 13f79535-47bb-0310-9956-ffa450edef68
* subversion/tests/libsvn_repos/repos-test.c
  (test_config_pool): Use a proper test directory to avoid trying to atomically
    flush on my network source drive, which sometimes fails.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537470 13f79535-47bb-0310-9956-ffa450edef68
Fixed a thinko in the JavaHL implementation of the Ev2 driver.

* subversion/bindings/javahl/native/CommitEditor.cpp
  (CommitEditor::alterDirectory, CommitEditor::alterFile): An empty
   property set must be passed on as an empty hash, not a NULL hash,
   since the latter means the props should be left alone.

* subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
  (SVNRemoteTests.testEditorDeleteFileProps): New test case for
   remote property deletion.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1537542 13f79535-47bb-0310-9956-ffa450edef68