/[Apache-SVN]
ViewVC logotype

Revision 1847572


Jump to revision: Previous Next
Author: kotkov
Date: Tue Nov 27 18:10:01 2018 UTC (5 years, 4 months ago)
Changed paths: 2
Log Message:
fsfs: Fix SVN-4791, an issue with the DAG open_path() that was causing
unexpected SVN_ERR_FS_NOT_DIRECTORY errors when attempting to open a path
with `open_path_node_only | open_path_allow_null` flags.

The implication of this is that certain svn_fs_closest_copy() calls could be
returing unexpected errors as well.  For the end user, this means that such
errors were possible, for example, during certain `svn update`s.

The root cause of this behavior is the implementation of the optimization
within the open_path() routine.  The optimization attempts to do a cache
lookup of the prospective parent directory of the path to be opened.
If the cache lookup is successful, the parent node is assumed — but not
checked — to be a directory.  The absense of the check was causing
unexpected errors instead of returning `NULL` in a case where:

 - open_path() is called with `open_path_node_only | open_path_allow_null`
 - the path to be opened points to a non-existing path, but its parent path
   is a file
 - the DAG node of the "parent" file is cached

See https://lists.apache.org/thread.html/693a95b0da834387e78a7f08df2392b634397d32f37428c81c02f8c5@%3Cdev.subversion.apache.org%3E

* subversion/libsvn_fs_fs/tree.c
  (err_not_directory): New helper function factored out from...
  (open_path): ...here.  Check the kind of the DAG node for the prospective
   parent returned from cache in the `open_path_node_only` optimization.
   Handle the case where it is not a directory; utilize the new helper to
   construct the appropriate error.

* subversion/tests/libsvn_fs/fs-test.c
  (test_closest_copy_file_replaced_with_dir): New regression test.
  (test_funcs): Run new test.


Changed paths

Path Details
Directorysubversion/trunk/subversion/libsvn_fs_fs/tree.c modified , text changed
Directorysubversion/trunk/subversion/tests/libsvn_fs/fs-test.c modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26