Checkout Tools
  • last updated 4 hours ago
Constraints: committers
Constraints: files
Constraints: dates

Changeset 1496007 is being indexed.

Fix issue #4383, "Subversion 1.8.0 crash when WC path is symlink (regression)".

In 1.7, if a working copy root was found through a symlink, WCROOT->abspath

was set to the symlink itself, rather than the target of the symlink.

In 1.8.0, WCROOT->abspath is set to the symlink target instead.

It turns out that at least one caller relies on the 1.7 behaviour.

It computes relative paths within the working copy like this:

local_relpath = svn_dirent_skip_ancestor(wcroot->abspath, local_abspath);

and blindly uses the returned value as a path. If local_abspath is not a

child of wcroot->abspath, the skip_ancestor() function returns NULL.

So 1.8.0 ended up crashing with a NULL deref when updating working copies

through symlinks.

* subversion/libsvn_wc/wc_db_wcroot.c

(svn_wc__db_wcroot_parse_local_abspath): Restore 1.7 behaviour from the

caller's point of view. When a working copy root is found through a

symlink, ensure that WCROOT->ABSPATH is set to the symlink itself,

rather than its target.

* subversion/tests/cmdline/

(update_through_unversioned_symlink): New test. Without the above fix,

this test fails with a crash when exclusive WC locking is disabled, and

fails with an SQLITE_BUSY error when exclusive WC locking is enabled.

Reported by: Lev Serebryakov <>

  1. … 1 more file in changeset.
* **/**

Run tools/dev/ to remove all trailing whitespace

before we branch 1.8, like we did before creating previous branches.

No functional changes.

  1. … 199 more files in changeset.
Don't error out with "svn: E200030: sqlite: no such table: nodes"

when opening old working copies and if compiled with SVN_DEBUG.

Instead, print a message advising an upgrade.

I found this problem while trying to use a format 18 WC with a trunk client.

* subversion/libsvn_wc/wc_db_wcroot.c

(svn_wc__db_wcroot_parse_local_abspath): Verification triggers don't

install properly with old WC format databases, so ignore sqlite errors

while installing the triggers. Allows old working copies in 1.7-dev

format to be upgraded to format 29 (at which point there is yet another

problem which I'll investigate next).

Use svn_hash_gets and svn_hash_puts.

* subversion/libsvn_wc/adm_crawler.c

* subversion/libsvn_wc/adm_ops.c

* subversion/libsvn_wc/conflicts.c

* subversion/libsvn_wc/copy.c

* subversion/libsvn_wc/deprecated.c

* subversion/libsvn_wc/diff_local.c

* subversion/libsvn_wc/entries.c

* subversion/libsvn_wc/externals.c

* subversion/libsvn_wc/info.c

* subversion/libsvn_wc/old-and-busted.c

* subversion/libsvn_wc/props.c

* subversion/libsvn_wc/revert.c

* subversion/libsvn_wc/status.c

* subversion/libsvn_wc/translate.c

* subversion/libsvn_wc/update_editor.c

* subversion/libsvn_wc/upgrade.c

* subversion/libsvn_wc/wc_db.c

* subversion/libsvn_wc/wc_db_update_move.c

* subversion/libsvn_wc/wc_db_wcroot.c

* subversion/libsvn_wc/workqueue.c

  1. … 19 more files in changeset.
Merge svn_kind_t into svn_node_kind_t, leaving only one public enumeration

that describes node kinds.

* subversion/include/svn_types.h (svn_kind_t): Removed.

All uses of svn_kind_t were replaced with svn_node_kind_t.

(svn_node_kind_t): New enumeration constant, svn_node_symlink.

Replaces all previous uses of svn_kind_symlink.

(svn__node_kind_from_kind): Removed. All call sites updated.

(svn__kind_from_node_kind): Removed. All call sites updated.

* subversion/libsvn_wc/tree_conflicts.c (node_kind_map):

Added comment about incompatible representation of svn_node_unknown.

* subversion/libsvn_wc/node.c (convert_db_kind_to_node_kind):

May be redundant, and comment is out of date. Added a note about that.

There are also a zillion changes in dependent files, and they all result

from the following renames:

svn_kind_t to svn_node_kind_t

svn_kind_none to svn_node_none

svn_kind_file to svn_node_file

svn_kind_dir to svn_node_dir

svn_kind_unknown to svn_node_unknown

svn_kind_symlink to svn_node_symlink

  1. … 65 more files in changeset.
Following up on the explicit 'svn upgrade' requirement, reinstate the option of

opening a wc.db without upgrading for the upgrade process itself. This allows the

upgrade code to use a limited subset of the wc_db api to avoid having to

reimplement code just for upgrades.

* subversion/libsvn_wc/upgrade.c

(bump_to_30): Obtain wc_db without upgrading to allow creating conflicts.

* subversion/libsvn_wc/wc_db.c



svn_wc__db_get_wcroot): Apply the same check for wcroots using a new macro.

* subversion/libsvn_wc/wc_db.h

(svn_wc__db_open): Rename argument. Update documentation.



svn_wc__db_get_wcroot): Document non-upgraded compatibility.

* subversion/libsvn_wc/wc_db_private.h

(svn_wc__db_t): Remove auto upgrade variable (always FALSE), and introduce

verify_format and exclusive.

(svn_wc__db_pdh_create_wcroot): Rename argument.


* subversion/libsvn_wc/wc_db_wcroot.c

(svn_wc__db_open): Initialize variables that affect opening db files.

(svn_wc__db_pdh_create_wcroot): Remove upgrade code. Only verify versions.

(svn_wc__db_wcroot_parse_local_abspath): Use config from db instead of

reparsing it from inside a loop. Update caller.

* subversion/tests/cmdline/

(upgrade_from_1_7): Rename to ...

(upgrade_from_1_7_conflict): ... this, update comment and remove XFail.

(test_list): Update reference.

* subversion/tests/libsvn_wc/entries-compat.c

(create_open): Update comment.

  1. … 6 more files in changeset.
* subversion/libsvn_wc/wc_db_wcroot.c

(try_symlink_as_dir): Don't bother clearing an error known to be SUCCESS.

Fix issue #4118 (wrong error message if wc.db is missing, or SQL error).

* subversion/libsvn_wc/wc_db_wcroot.c (svn_wc__db_wcroot_parse_local_abspath):

Handle several cases where we could not find a valid .svn/wc.db, but

.svn/entries is also obviously not valid for a pre-wc-ng working copy.

* subversion/tests/cmdline/

(status_with_various_degrees_of_broken_wc): New test case for the

failure modes detected by this change.

  1. … 1 more file in changeset.
Fix issue 4091, symlink-ness change causes spurious tree-conflict.

* subversion/libsvn_wc/update_editor.c

(close_file): Only flag symlink-ness conflict if locally modified.

* subversion/libsvn_wc/wc_db_wcroot.c

(svn_wc__db_wcroot_parse_local_abspath): Only close db if really opened.

* subversion/tests/cmdline/

(replace_symlinks): Deepcopy the r2 status for later use, remove XFAIL.

  1. … 2 more files in changeset.
* subversion/libsvn_wc/wc_db_wcroot.c

(svn_wc__db_wcroot_parse_local_abspath): If a working copy that requires an

upgrade is found when traversing upwards from a symlink, try to find a

supported working copy where the symlink points to instead.

Fixes the following tests when run within a 1.7 WC: 19: operate on symlink to wc 20: svnversion on symlink to wc

Disable automatic working copy upgrades. This has been discussed over and

over, with many people in the community indicating they prefer manual upgrades.

For now, this is a hard-coded default. There is no way to enable auto-upgrade.

And unfortunately there is no single knob to globally switch auto-upgrade on

and off in the code. Rather, function parameters have to be tweaked in various

places where a working copy database is opened.

Some parts of the upgrade code were written and tested exclusively for

upgrading from 1.6 and earlier working copy formats to wc-ng, and thus

needed small fixes to allow 'svn upgrade' to run wc-ng -> wn-ng format

bumps without crashing.

* subversion/libsvn_wc/adm_files.c

(svn_wc_create_tmp_file2): Don't auto-upgrade working copies.

* subversion/libsvn_wc/adm_ops.c

(svn_wc_get_pristine_copy_path): Don't auto-upgrade working copies.

* subversion/libsvn_wc/cleanup.c

(svn_wc_cleanup3): Don't auto-upgrade working copies.

* subversion/libsvn_wc/context.c

(svn_wc_context_create): Don't auto-upgrade working copies.

* subversion/libsvn_wc/lock.c

(pool_cleanup_locked, svn_wc_adm_open3, svn_wc_adm_probe_open3,

open_anchor): Don't auto-upgrade working copies.

* subversion/libsvn_wc/upgrade.c

(svn_wc__upgrade_sdb): Initialise *result_format before use if the

working copy is already at format SVN_WC__VERSION to prevent an assertion

during no-op upgrades of wc-ng working copies.

(is_old_wcroot): Remove Subversion version numbers from error messages.

It is now misleading to say that an upgrade is not possible because a

pre-1.7 working copy was found since 'svn upgrade' now runs on any format.

(svn_wc_upgrade): Handle upgrades from wc-ng-style working copies.

Enable auto-upgrade of the db during upgrades from pre-1.7 WCs to avoid

'svn upgrade' advising users to run 'svn upgrade'.

* subversion/libsvn_wc/wc_db.c

(svn_wc__db_bump_format): New helper function for wc-ng -> wc-ng upgrades.

Ensures that the upgrade target is a working copy root, and performs a

format bump of wcroot->sdb, which isn't exposed outside of the wc_db layer.

* subversion/libsvn_wc/wc_db.h

(svn_wc__db_bump_format): Declare.

* subversion/libsvn_wc/wc_db_wcroot.c

(svn_wc__db_pdh_create_wcroot): Properly handle the case where we do not

auto-upgrade and run into a working copy using an older format.

Previously, we ended up asserting in VERIFY_USABLE_WCROOT() somewhere

because no upgrade happened but no error was returned either. Instead,

return an error advising the user to upgrade the working copy.

* subversion/tests/cmdline/

(wc_is_too_old_regex): The error message matched by this regex has changed

in some cases, so adjust the regex accordingly.

(basic_upgrade): Expect slightly different error messages resulting from

above changes. The error code returned is unchanged, however.

(upgrade_tree_conflict_data, upgrade_from_format_28): These tests were

running 'svn status' and 'svn info' to trigger auto-upgrades. Make them

run 'svn upgrade' instead to keep them passing.

  1. … 9 more files in changeset.
Enable SQLite exclusive locking for the command line client as this is

a major performance gain for working copies on network disks. The

libraries default to shared locking for backward compatibility, the

command line client defaults to exclusive locking and a config setting

allows the user to override the command line client.

Addresses issue 4176.

* subversion/libsvn_wc/wc-queries.sql


* subversion/libsvn_wc/wc_db.c

(create_db): Add exclusive parameter.

(svn_wc__db_init): Get exclusive setting from config.

(svn_wc__db_upgrade_begin): Use exclusive locking.

* subversion/libsvn_wc/wc_db_private.h

(struct svn_wc__db_t): Make config non-const.

(svn_wc__db_util_open_db): Add exclusive parameter.

* subversion/libsvn_wc/wc_db_util.c

(svn_wc__db_util_open_db): Add exclusive parameter.

* subversion/libsvn_wc/wc_db.h

(svn_wc__db_open): Make config parameter non-const.

* subversion/libsvn_wc/wc_db_wcroot.c

(svn_wc__db_open): Make config parameter non-const.

(svn_wc__db_wcroot_parse_local_abspath): Get exclusive setting from

config, close unused SQLite handle when following a symlink.

* subversion/include/svn_client.h

(svn_client_create_context2): New.

(svn_client_create_context): Deprecate.

* subversion/libsvn_client/ctx.c

(svn_client_create_context2): Add config hash parameter, pass config

to WC context.

(svn_client_create_context): Call new version.

* subversion/include/svn_config.h



* subversion/libsvn_subr/config_file.c

(svn_config_ensure): Add [working-copy] section.

* subversion/svn/main.c

(sub_main): Get config hash earlier, pass to client context, set

exclusive locking if client does not already set it, move log

message checking later.

* subversion/tests/libsvn_wc/utils.c

(svn_test__create_fake_wc): Use shared locking.

* subversion/tests/libsvn_wc/op-depth-test.c

(open_wc_db): Use shared locking.

  1. … 12 more files in changeset.
* subversion/libsvn_wc/wc_db_wcroot.c

(read_link_target): Error out on symlinks that point nowhere. Just in case.

* subversion/libsvn_wc/wc_db_wcroot.c

(read_link_target): Minor code simplification, no functional change.

Fix adding symlinks pointing at working copy roots to version control,

which had been broken since r1395027.

Fixes special_tests 23, "externals as symlink targets", which adds

a symlink pointing at an external. This test failed because the

symlink path itself was cached as WC root when adding the symlink

to the external's parent WC. The code then tried a propset on the

symlink path to set the svn:special prop and was redirected at the

external working copy which it didn't have a lock for.

We can fix this by never caching a symlink itself as a WC root but

caching the directory the symlink points to as a WC root instead.

* subversion/libsvn_wc/wc_db_wcroot.c

(read_link_target): New helper function to calculate the absolute path

of a symlink target.

(svn_wc__db_wcroot_parse_local_abspath): When retrying the scan through a

symlink, resolve the symlink and scan up from the link target, rather

than treating the symlink itself as a directory. If the symlink points

at a WC root, this prevents the symlink itself from being added to the

WC root cache -- the cache should only contain directories anyway.

* subversion/tests/cmdline/

(symlink_to_wc_basic): When operating on a WC through a symlink, we'll

now see the resolved symlink target path as Working Copy Root path

in 'svn info' output. Adjust test expectations accordingly. This test

was expecting to see the symlink itself as WC root path.

  1. … 1 more file in changeset.
Fix working copy access via a symlink which points to a working copy nested

within an unrelated working copy of an unsupported format.

This patch fixes special_tests 19 and 20 on the 1.7.x branch when run

within a format 30 working copy (backport nomination will follow).

To reproduce the problem fixed by this commit with just a trunk client:

- Check out a working copy WC1.

- Check out one nested working copy WC2 within WC1's root dir.

- Use sqlite3 to set "pragma user_version = 31" in WC1's .svn/wc.db.

- Create a symlink S within WC1 which points at WC2.

- Try to run 'svn status' on the symlink S.

* subversion/libsvn_wc/wc_db_wcroot.c

(svn_wc__db_wcroot_parse_local_abspath): If we find an unsupported working

copy after traversing upwards from a symlink, and the symlink points to

a directory, try to find a working copy at that directory instead.

Stat for ".svn" before statting ".svn/wc.db" and ".svn/entries" for an uncached

directory in a working copy. For any directory except the working copy root

this will return that this directory does not exist and avoid the two further


This reduces the time to run svn status on the root of my semi-network working

copy with Subversion trunk, branches: 1.5.x, 1.6.x and 1.7.x by about 20-30%.

(semi network = VM to host system using network protocols over virtual NIC)

* subversion/libsvn_wc/wc_db_wcroot.c

(svn_wc__db_wcroot_parse_local_abspath): Use a filestat on ".svn" to avoid

further filestats.

* subversion/libsvn_wc/wc_db_wcroot.c

(svn_wc__db_wcroot_parse_local_abspath): Revert r1340535.

* subversion/libsvn_wc/wc_db_wcroot.c

(svn_wc__db_wcroot_parse_local_abspath): The fact that we found a symlink

doesn't undo that we might have moved upwards before, so don't reset

this variable that would make us perform additional stats for entries


Purge trailing whitespace, in the spirit of r1138109.

  1. … 97 more files in changeset.
* subversion/libsvn_wc/wc_db_wcroot.c

(get_path_kind): Remove obsolete information in comment.

* subversion/libsvn_wc/wc_db_wcroot.c

(svn_wc__db_wcroot_parse_local_abspath): Following up on r1245935, allow a

few more errors to indicate that a node is unversioned.

When hunting for a wcroot through a symlink that points to a directory,

and a WC is found in a parent directory of the symlink, ignore non-conflicted

not-present or excluded nodes that overlap with the symlink.

This allows unversioned symlinks to redirect the wcroot search even

if 'invisible' nodes exist at the symlink's location in the parent WC.

The benefit of this hack is coherent behaviour for unversioned symlinks

pointing to externals, at least from the user's point of view.

Before this change, Subversion would error out with "path not found"

if an unversioned symlink was obstructing a, for instance, not-present

node, and this error magically disappeared after an update which removed

the not-present node.

Now, Subversion prefers using the external's wcroot unless there is

something important to show for the node corresponding to the symlink

in the parent WC. It is somewhat unfortunate that the decision about what

is important is made at a very low layer within the guts of libsvn_wc.

But I saw no better way of working around this. This hack will become

unnecessary once externals are moved into the parent's wc.db.

* subversion/libsvn_wc/wc_db_wcroot.c

(svn_wc__db_wcroot_parse_local_abspath): Ignore non-conflicted not-present

or excluded nodes beneath symlinks pointing at directories, for reasons

described above.

* subversion/libsvn_wc/wc_db_wcroot.c

(svn_wc__db_wcroot_parse_local_abspath): Add a comment about not-present

symlinks. They can cause 'svn info' to return with a "path not found" error,

even if there is an unversioned on-disk symlink that points to an external.

For issues #4102 and #4120, both describing problems with symlinks

pointing to externals with various operations (add/status/diff and more),

change the way we resolve working copy roots for symlinks.

* subversion/libsvn_wc/wc_db_private.h

(svn_wc__db_t): Use svn_kind_t rather than svn_node_kind_t in the

parse cache. This allows symlinks to be represented.

* subversion/libsvn_wc/wc_db_wcroot.c

(get_path_kind): Return svn_kind_t instead of svn_node_kind_t. This allows

symlinks to be represented. This function used to force symlinks to always

be treated like directories, which prevents symlinks pointing to externals

from being handled as part of the external's parent working copy.

(svn_wc__db_wcroot_parse_local_abspath): If we locate a wcroot via a

symlink that points to a directory, first treat the symlink like a

normal file, i.e. walk upwards from the symlink's parent dir.

If we find a db, and the symlink is versioned in it, use this DB.

Else, try again, this time treating the symlink like a directory,

which means we'll find a nested wcroot in case the symlink points

to a nested working copy (e.g. an external).

This strategy allows versioned symlinks pointing to externals to work

within the external's parent wc, and also allows unversioned symlinks

to point to nested WCs (this is required for our test suite).

I had to introduce a 'goto' here to avoid major refactoring :(

This function should probably be refactored in a later commit

to get rid of the 'goto'.

* subversion/tests/cmdline/

(externals_as_symlink_targets): Remove XFail marker.

  1. … 2 more files in changeset.
* subversion/libsvn_wc/wc_db_wcroot.c

(verify_no_work): Add a doc string.

Resolve a few related issues (issue #2557, #3987) that all occur because we

assumed that a directly referenced symlink is never a working copy root, while

-as these issues show- it can be.

* subversion/libsvn_wc/wc_db_wcroot.c

(get_path_kind): Reorder arguments to match convention. Set kind to directory

for symlinks to check them to be a working copy root.

(svn_wc__db_wcroot_parse_local_abspath): Update caller.

Followup to r1140505. Fix indentation.

* [everywhere]: Fix indentation fallout from the

svn_error_return() -> svn_error_trace() rename.

Patch by: Noorul Islam K M <noorul{_AT_}>

  1. … 37 more files in changeset.
Rename the 'svn_error_return' macro to 'svn_error_trace'.

See email thread "[RFC] Rename 'svn_error_return' to 'svn_error_trace'?" on

2011-06-23, <>.

* subversion/include/svn_error.h

(svn_error_return): Rename to svn_error_trace.

(SVN_ERR, svn_error_purge_tracing): Track the rename.

* [everywhere]: Track the rename.

  1. … 120 more files in changeset.
The semi-annual trailing whitespace cleansing ritual.

* everywhere:

for extsn in c h cpp java py pl rb; do

sed -i -e 's/[ \t]*$//' `find . -name "*.$extsn" | xargs grep '[ \t]$' -l`


  1. … 144 more files in changeset.