[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

How to preserve err->apr_err error codes over the wire in ra_dav?

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Sat, 7 Aug 2010 22:24:38 +0300

<short version>
  In order to properly use the svn_ra_change_rev_prop2() API (on the
  'atomic-revprop') branch, I'd like to make it return a specific error code
  (over all RA layers) when the propchange fails due to the provided expected
  value not being the found value. (That's kinda the point of the new API.)

  To do so, I'd like to have mod_dav_svn transmit the error code it saw to
  ra_neon/ra_serf; currently it swallows the error code and I don't see yet
  how to unswallow it.

  I see from the code that this should be possible using <svn:error/> and
  <human-readable errcode="%d"/> tags, but I don't see yet how.
</short version>

Over all RA layers, I get the following error message:

"revprop 'flower' has unexpected value in filesystem"

Over ra_local and ra_svn, the error chain contains the original error code
(SVN_ERR_BAD_PROPERTY_VALUE, 125005):

[[[
% ./subversion/tests/cmdline/atomic-ra-revprop-change file://$PWD/subversion/tests/cmdline/svn-test-work/repositories/prop_tests-34 0 flower "( 11 old_value_p 11 wrong value 5 value 6 violet )" neon 1
subversion/libsvn_repos/fs-wrap.c:320: (apr_err=125005)
subversion/libsvn_fs_fs/fs_fs.c:609: (apr_err=125005)
subversion/libsvn_fs_fs/fs_fs.c:609: (apr_err=125005)
subversion/libsvn_fs_fs/fs_fs.c:7263: (apr_err=125005)
atomic-ra-revprop-change: revprop 'flower' has unexpected value in filesystem
zsh: exit 1 ./subversion/tests/cmdline/atomic-ra-revprop-change 0 flower neon 1
]]]
[[[
% ./subversion/tests/cmdline/atomic-ra-revprop-change svn://localhost/svn-test-work/repositories/prop_tests-34 0 flower "( 11 old_value_p 11 wrong value 5 value 6 violet )" neon 1
subversion/libsvn_ra_svn/client.c:855: (apr_err=210000)
subversion/svnserve/serve.c:1013: (apr_err=210000)
atomic-ra-revprop-change: Special code for wrapping server errors to report to client
subversion/libsvn_repos/fs-wrap.c:320: (apr_err=125005)
atomic-ra-revprop-change: revprop 'flower' has unexpected value in filesystem
subversion/libsvn_fs_fs/fs_fs.c:609: (apr_err=125005)
atomic-ra-revprop-change: revprop 'flower' has unexpected value in filesystem
subversion/libsvn_fs_fs/fs_fs.c:609: (apr_err=125005)
atomic-ra-revprop-change: revprop 'flower' has unexpected value in filesystem
subversion/libsvn_fs_fs/fs_fs.c:7263: (apr_err=125005)
atomic-ra-revprop-change: revprop 'flower' has unexpected value in filesystem
zsh: exit 1 ./subversion/tests/cmdline/atomic-ra-revprop-change 0 flower neon 1
]]]

That's good.

However, over ra_neon and ra_serf, while the the error chain contains the
original message text, the only error codes available are
SVN_ERR_RA_DAV_REQUEST_FAILED and SVN_ERR_RA_DAV_PROPPATCH_FAILED:

[[[
% ./subversion/tests/cmdline/atomic-ra-revprop-change http://localhost:8081/trunk1/svn-test-work/repositories/prop_tests-34 0 flower "( 11 old_value_p 11 wrong value 5 value 6 violet )" neon 1
subversion/tests/cmdline/atomic-ra-revprop-change.c:199: (apr_err=175002)
subversion/libsvn_ra_neon/fetch.c:1209: (apr_err=175002)
atomic-ra-revprop-change: DAV request failed; it's possible that the repository's pre-revprop-change hook either failed or is non-existent
subversion/libsvn_ra_neon/props.c:1231: (apr_err=175008)
atomic-ra-revprop-change: At least one property change failed; repository is unchanged
subversion/libsvn_ra_neon/util.c:1506: (apr_err=175002)
subversion/libsvn_ra_neon/util.c:212: (apr_err=175002)
atomic-ra-revprop-change: Error setting property 'flower':
revprop 'flower' has unexpected value in filesystem
zsh: exit 1 ./subversion/tests/cmdline/atomic-ra-revprop-change 0 flower neon 1
]]]
[[[
% ./subversion/tests/cmdline/atomic-ra-revprop-change http://localhost:8081/trunk1/svn-test-work/repositories/prop_tests-34 0 flower "( 11 old_value_p 11 wrong value 5 value 6 violet )" serf 1
subversion/tests/cmdline/atomic-ra-revprop-change.c:199: (apr_err=175002)
subversion/libsvn_ra_serf/commit.c:2352: (apr_err=175002)
atomic-ra-revprop-change: DAV request failed; it's possible that the repository's pre-revprop-change hook either failed or is non-existent
subversion/libsvn_ra_serf/commit.c:229: (apr_err=175008)
atomic-ra-revprop-change: At least one property change failed; repository is unchanged
subversion/libsvn_ra_serf/util.c:1041: (apr_err=175002)
atomic-ra-revprop-change:
revprop 'flower' has unexpected value in filesystem
subversion/libsvn_ra_serf/commit.c:229: (apr_err=175002)
atomic-ra-revprop-change: PROPPATCH of '/trunk1/svn-test-work/repositories/prop_tests-34/!svn/rev/0': 207 Multi-Status
zsh: exit 1 ./subversion/tests/cmdline/atomic-ra-revprop-change 0 flower serf 1
]]]

Is it possible to make mod_dav_svn allow another (specific) apr_err error
code to be passed over the wire to the client? I'd like the error chain on
the ra_neon/ra_serf side to contain SVN_ERR_BAD_PROPERTY_VALUE (125005).

Looking at `egrep 'apr_err = |svn_error_create' libsvn_ra_neon/*`[1] tells me
that the answer should involve ELEM_svn_error (svn:error) and
ELEM_human_readable (<human-readable errcode="%d"/>).

Hints, please?

Thanks,

Daniel

[1] libsvn_ra_neon/util.c:start_err_element() contains the only relevant match.
Received on 2010-08-07 21:27:03 CEST

This is an archived mail posted to the Subversion Dev mailing list.