SVN::GetRootAndHead

35 views
Skip to first unread message

Daniel Sahlberg

unread,
Mar 9, 2024, 2:51:50 PMMar 9
to TortoiseSVN-dev
Hi,

In the users group, a user reported an error when starting View log from the repobrowser using a peg revision if the file had subsequently been deleted, see [1].

I have investigated and it seems SVN::GetRootAndHead is calling GetHeadRevision with a path (which potentially is deleted and thus the repository will return an error). A few lines above, the code has retrieved the root URL.

I've tried the following patch which seems to resolve the issue.

[[[
Index: SVN/SVN.cpp
===================================================================
--- SVN/SVN.cpp (revision 29681)
+++ SVN/SVN.cpp (working copy)
@@ -2806,7 +2806,7 @@
         }
         else
         {
-            rev = cachedProperties.GetHeadRevision(uuid, path);
+            rev = cachedProperties.GetHeadRevision(uuid, url);
             if ((rev == NO_REVISION) && (m_err == nullptr))
             {
                 CHooks::Instance().PreConnect(CTSVNPathList(path));
]]]

Any comments?

Kind regards,
Daniel



Stefan

unread,
Mar 9, 2024, 3:11:08 PMMar 9
to TortoiseSVN-dev
no objections from me.
The revision for the repo root is the same as for the path, but of course works for non-existing paths as well since the root is never deleted.

Daniel Sahlberg

unread,
Mar 10, 2024, 4:16:48 AMMar 10
to TortoiseSVN-dev
Thanks! Committed in r29682

Daniel Sahlberg

unread,
Apr 28, 2024, 2:48:03 PMApr 28
to TortoiseSVN-dev
So. That didn't turn out well at all (https://groups.google.com/g/tortoisesvn/c/IJuG6WvHTds). I've successfully reproduced the error.

Some quick debugging indicate that svn_client_open_ra_session2() now barf if the user doesn't have read access to the repository root. I've reproduced this using VisualSVN Server (it has an "implicit list folder permissions for parents of readable paths" that has to be disabled). I didn't dig all the way down to the server but I'm quite sure the server is returning a 403 on the root but a valid return code on the actual subdirectory.

I'm a bit at loss what to do here since we send the URL when establishing the ra session. If the URL doesn't exist anymore, we get an error. If we send in the root, we get another error. Any ideas?

Kind regards,
Daniel

Stefan

unread,
Apr 29, 2024, 1:28:26 PMApr 29
to TortoiseSVN-dev
would it work if we do both?

            rev = cachedProperties.GetHeadRevision(uuid, path);
            if ((rev == NO_REVISION) || (m_err != nullptr))
            {
                svn_error_clear(m_err);
                rev = cachedProperties.GetHeadRevision(uuid, url);
            }
I don't have a setup ready to test this. At least it would be better than before:
- if the path doesn't exist anymore, we try again with the root
- if root works, fine
- if root doesn't work either, it's no worse than before

Stefan

Daniel Sahlberg

unread,
May 1, 2024, 5:29:44 AMMay 1
to TortoiseSVN-dev on behalf of Stefan
Agree with you that it's no worse than before. It seems to work in my testing. I've committed as r29691.

I've also asked on the subversion dev@ mailing list.

Kind regards,
Daniel

Daniel Sahlberg

unread,
May 1, 2024, 2:04:50 PMMay 1
to TortoiseSVN-dev
Turned out to be my fault altogether, based in r29499. I've reverted everything and will circle back to the original project monitor issue. 
Reply all
Reply to author
Forward
0 new messages