Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mod_dav_svn: Use mod_dav's DAVBasePath setting #28

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

notroj
Copy link
Contributor

@notroj notroj commented Feb 7, 2025

mod_dav_svn: Use mod_dav's DAVBasePath setting to determine the
repository root path, allowing SVN to be configured via LocationMatch like:

 <LocationMatch ^/repos/svn(.*)>
    DAV svn
    SVNParentPath /srv/repos
    DAVBasePath /repos
 </LocationMatch>

by mapping URL path "/repos/svnfoo" to the filesystem path of "/srv/repos/svnfoo". This partially addresses issues like SVN-4790 (with minimal added complexity), though does not provide as much flexibility as discussed in SVN-2679.

* subversion/mod_dav_svn/mod_dav_svn.c (dav_svn__get_root_dir): Retrieve and return the setting from DavBasePath via dav_get_base_path() where that API is available and DavBasePath is configured. (dav_svn__translate_name): Use dav_svn__get_root_dir() to determine the repos root for the same reason.

Note this mod_dav API is only present in httpd trunk (currently).

@notroj
Copy link
Contributor Author

notroj commented Feb 7, 2025

The arm64 test failure here is interesting, it is likely to be unrelated to the code change. The arm64 support in GHA is new/experimental so it might be something random but the tests have failed twice.

W: subversion/svn/commit-cmd.c:185,
W: subversion/libsvn_client/commit.c:1096,
W: subversion/libsvn_client/commit.c:156: (apr_err=SVN_ERR_WC_CORRUPT_TEXT_BASE)
W: svn: E155017: Commit failed (details follow):
W: subversion/libsvn_client/commit.c:1000,
W: subversion/libsvn_client/commit_util.c:1949,
W: subversion/libsvn_wc/adm_crawler.c:1220: (apr_err=SVN_ERR_WC_CORRUPT_TEXT_BASE)
W: svn: E155017: Working copy text base is corrupt
W: subversion/libsvn_subr/checksum.c:688: (apr_err=SVN_ERR_CHECKSUM_MISMATCH)
W: svn: E200014: Checksum mismatch for text base of '/home/runner/work/subversion/subversion/subversion/tests/cmdline/svn-test-work/working_copies/merge_reintegrate_tests-11/A/D/H/omega':
W:    expected:  fe4ec8bdd3d2056db4f55b474a10fadc
W:      actual:  d41d8cd98f00b204e9800998ecf8427e
W: 
W: subversion/libsvn_subr/checksum.c:688: (apr_err=SVN_ERR_COMPOSED_ERROR)
W: svn: E200042: Additional errors:
W: subversion/libsvn_ra_serf/commit.c:2104,
W: subversion/libsvn_ra_serf/util.c:1035,
W: subversion/libsvn_ra_serf/util.c:984,
W: subversion/libsvn_ra_serf/util.c:949,
W: subversion/libsvn_ra_serf/util.c:1648,
W: subversion/libsvn_ra_serf/util.c:1580,
W: subversion/libsvn_ra_serf/commit.c:2011,
W: subversion/libsvn_wc/adm_crawler.c:1054,
W: subversion/libsvn_subr/stream.c:228,
W: subversion/libsvn_subr/stream.c:260,
W: subversion/libsvn_subr/stream.c:637,
W: subversion/libsvn_subr/stream.c:260,
W: subversion/libsvn_subr/stream.c:1476,
W: subversion/libsvn_subr/stream.c:228,
W: subversion/libsvn_subr/stream.c:260,
W: subversion/libsvn_wc/adm_crawler.c:933,
W: subversion/libsvn_subr/stream.c:228,
W: subversion/libsvn_subr/stream.c:260,
W: subversion/libsvn_subr/stream.c:1476,
W: subversion/libsvn_subr/stream.c:228,
W: subversion/libsvn_subr/stream.c:260,
W: subversion/libsvn_wc/wc_db_pristine.c:290: (apr_err=SVN_ERR_STREAM_SEEK_NOT_SUPPORTED)
W: svn: E140003: Stream doesn't support seeking
W: CWD: /home/runner/work/subversion/subversion/subversion/tests/cmdline
W: EXCEPTION: Failure: Command failed: "/home/runner/work/subversion/subversion/subversion/svn/svn ci svn-test-work/working_copies/merge_reintegrate_tests-11 -m ..."; exit code 1
Traceback (most recent call last):
  File "/home/runner/work/subversion/subversion/subversion/tests/cmdline/svntest/main.py", line 1986, in run
    rc = self.pred.run(sandbox)
  File "/home/runner/work/subversion/subversion/subversion/tests/cmdline/svntest/testcase.py", line 258, in run
    return self._delegate.run(sandbox)
  File "/home/runner/work/subversion/subversion/subversion/tests/cmdline/svntest/testcase.py", line 178, in run
    result = self.func(sandbox)
  File "/home/runner/work/subversion/subversion/subversion/tests/cmdline/merge_reintegrate_tests.py", line 1542, in multiple_reintegrates_from_the_same_branch
    expected_disk, expected_status = set_up_branch(sbox)
  File "/home/runner/work/subversion/subversion/subversion/tests/cmdline/svntest/mergetrees.py", line 349, in set_up_branch
    actions.run_and_verify_commit(wc_dir, expected_output, expected_status)
  File "/home/runner/work/subversion/subversion/subversion/tests/cmdline/svntest/actions.py", line 1535, in run_and_verify_commit
    exit_code, output, errput = run_and_verify_svn(None, expected_stderr,
  File "/home/runner/work/subversion/subversion/subversion/tests/cmdline/svntest/actions.py", line 339, in run_and_verify_svn
    return run_and_verify_svn2(expected_stdout, expected_stderr,
  File "/home/runner/work/subversion/subversion/subversion/tests/cmdline/svntest/actions.py", line 378, in run_and_verify_svn2
    exit_code, out, err = main.run_svn(want_err, *varargs)
  File "/home/runner/work/subversion/subversion/subversion/tests/cmdline/svntest/main.py", line 857, in run_svn
    return run_command(svn_binary, error_expected, False,
  File "/home/runner/work/subversion/subversion/subversion/tests/cmdline/svntest/main.py", line 457, in run_command
    return run_command_stdin(command, error_expected, 0, binary_mode,
  File "/home/runner/work/subversion/subversion/subversion/tests/cmdline/svntest/main.py", line 691, in run_command_stdin
    raise Failure('Command failed: "' + brief_command +
svntest.Failure: Command failed: "/home/runner/work/subversion/subversion/subversion/svn/svn ci svn-test-work/working_copies/merge_reintegrate_tests-11 -m ..."; exit code 1
FAIL:  merge_reintegrate_tests.py 11: multiple reintegrates create self-referential

repository root path, allowing SVN to be configured via LocationMatch
like:

 <LocationMatch ^/repos/svn(.*)>
    DAV svn
    SVNParentPath /srv/repos
    DAVBasePath /repos
 </LocationMatch>

by mapping URL path "/repos/svnfoo" to the filesystem path of
"/srv/repos/svnfoo". This partially addresses issues like SVN-4790
(with minimal added complexity), though does not provide as much
flexibility as discussed in SVN-2679.

* subversion/mod_dav_svn/mod_dav_svn.c
  (dav_svn__get_root_dir): Retrieve and return the setting from
  DavBasePath via dav_get_base_path() where that API is available
  and DavBasePath is configured.
  (dav_svn__translate_name): Use dav_svn__get_root_dir() to determine
  the repos root for the same reason.
  Try to capture tests.log if the tests fail.
@notroj notroj force-pushed the mod_dav_svn-use-davbasepath branch from e53e4f6 to 3fbe60a Compare February 14, 2025 10:55
Copy link
Collaborator

@dsahlberg-apache-org dsahlberg-apache-org left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builds and tests complete successfully with HTTPD 2.4.58.
Have not tested with HTTPD trunk and I don't think we have a test case for LocationMatch anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already added something very similar in r1923964/r1923965, didn't notice this was already included in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah great, looks perfect.

@@ -781,6 +781,15 @@ const char *
dav_svn__get_root_dir(request_rec *r)
{
dir_conf_t *conf;
const char *base;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason why base isn't declared within the #if block?

If compiled with < 20211221.28, there is a compiler warning about an unused variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks good catch!

@MarsrockEarth
Copy link

MarsrockEarth commented Feb 21, 2025 via email

@notroj
Copy link
Contributor Author

notroj commented Feb 24, 2025

Builds and tests complete successfully with HTTPD 2.4.58. Have not tested with HTTPD trunk and I don't think we have a test case for LocationMatch anyway.

Yeah, I will add a CI workflow against an HTTPD trunk build to get this tested, it'd be a useful thing to have anyway.

@dsahlberg-apache-org
Copy link
Collaborator

@notroj Do you want to add the CI workflow before you commit this or can we go ahead and commit and close the PR?

@MarsrockEarth
Copy link

MarsrockEarth commented Mar 14, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants