Julian Foad wrote on Thu, Feb 17, 2022 at 22:20:17 +0000:
> Proposed fix: in "text base sync" phase, ignore auth error while
> fetching any text base; continue with trying to fetch the rest.
> 
> That works in terms of the test case passing.
> 
> Can anyone think of issues with this approach, not limited to:
> 
> - Other error codes that should be ignored at the sync stage (because
> the operation ends up not actually needing that particular text base)?

301 redirects?

"Revision requested is newer than my HEAD revision" in DAV proxy setups?

> - Problems or better handling of the inherent race condition between the
> sync and the main operation?

What race condition is that?  The change to authz happened before the
sync, not between the sync and the main operation.

More below.

Julian Foad wrote on Fri, Feb 18, 2022 at 17:00:02 +0000:
> I committed the proposed fix in r1898184:
> [[[
> On the 'pristines-on-demand-on-mwf' branch: fix authz_tests.py 31.
> 
> This test runs an 'update' after read access permission has been removed
> from a repository path. The text base sync code errored out when it
> tried to download this text base.
> 
> We fix it by making the text base sync code ignore authorization errors,
> leaving any such base unfetched and continuing to try the others.
> ...
> * subversion/libsvn_wc/wc_db_textbase.c
>   (svn_wc__db_textbase_sync): If read access is unauthorized, ignore the
>     error and continue even though we failed to fetch the textbase.
> ]]]

This seems to have regressed the failure mode of «svn cat iota@BASE»
when iota is locally-modified and has no read access.

To reproduce:

[[[
#!/bin/sh

: ${svn:=svn}
svn="$svn --username=h --password=h --no-auth-cache"

rm -rf r wc
svnadmin create r
printf '%s\n' '[general]' 'anon-access = write' 'authz-db = authz' > 
r/conf/svnserve.conf
printf '%s\n' '[users]' 'h=h' > r/conf/passwd
printf '%s\n' '[/]' '* = rw' > r/conf/authz
svnserve --foreground -d -r r & pid=$!

$svn -q co svn://localhost wc --compatible-version=1.15 2>/dev/null ||
$svn -q co svn://localhost wc
cd wc
sqlite3 .svn/wc.db "PRAGMA user_version;"
echo "This is the file 'iota'." > iota
$svn -q add iota
$svn -q ci -m "r1: add iota"
$svn -q up
$svn cleanup
find .svn/pristine/ -type f -exec head -v -- {} +

# r2
printf '%s\n' '[/iota]' '* = ' >> ../r/conf/authz
echo >> "conflicting local mod" >> iota
$svn cat -r BASE iota@BASE

kill -9 $pid
exit
]]]

Output with trunk:

[[[
31
==> .svn/pristine/2c/2c0aa9014a0cd07f01795a333d82485ef6d083e2.svn-base <==
This is the file 'iota'.
This is the file 'iota'.
]]]

Output with pristines-on-demand-mwf@r1898184:

[[[
32
./subversion/svn/cat-cmd.c:88,
./subversion/svn/util.c:626,
./subversion/libsvn_client/cat.c:221,
./subversion/libsvn_client/textbase.c:106,
./subversion/libsvn_wc/textbase.c:553,
./subversion/libsvn_wc/textbase.c:514,
./subversion/libsvn_client/textbase.c:84,
./subversion/libsvn_ra_svn/client.c:1456,
./subversion/libsvn_ra_svn/client.c:249,
./subversion/libsvn_ra_svn/marshal.c:1875,
./subversion/svnserve/serve.c:132: (apr_err=SVN_ERR_RA_NOT_AUTHORIZED)
svn: E170001: Authorization failed
]]]

Output with pristines-on-demand-mwf@r1898216:

[[[
32
./subversion/svn/cat-cmd.c:88,
./subversion/svn/util.c:626,
./subversion/libsvn_client/cat.c:227,
./subversion/libsvn_client/cat.c:91: (apr_err=SVN_ERR_ILLEGAL_TARGET)
svn: E200009: '/scratch/tmp.uD2t1Qh9LB/wc/iota' has no pristine version until 
it is committed
]]]

Output with pristines-on-demand-mwf@r1898216 after changing the authz on
iota to «* = rw», or with authz disabled entirely (whether by commenting
it out in svnserve.conf or by checking out over file://):

[[[
32
This is the file 'iota'.
]]]

Cheers,

Daniel

Reply via email to