Page MenuHomeSoftware Heritage

svn: Ensure to quote URLs provided as parameters to client methods
ClosedPublic

Authored by anlambert on Oct 27 2022, 11:38 AM.

Details

Summary

URLs provided as parameters to subvertpy.client.Client methods must
be quoted or an assertion will be raised by libsvn otherwise.

Issue found while attempting to fix the loading of svn://tug.org/texlive

test_export.py
from urllib.parse import quote
import sys

from subvertpy import client
from subvertpy.ra import (
    Auth,
    RemoteAccess,
    get_simple_prompt_provider,
    get_username_provider,
)
auth_providers = [get_username_provider()]
client = client.Client(auth=Auth(auth_providers))

url = "svn://tug.org/texlive/trunk/Build/source/libs/teckit/docs/Calling TECkit from VB.doc"

if len(sys.argv) > 1 and sys.argv[1] == "quote":
    url = quote(url, safe=":/")

client.export(url, to="/tmp/export_test", rev=3455, peg_rev=3455, overwrite=True)
$ python test_export.py
python: ../subversion/libsvn_subr/dirent_uri.c:1562: uri_skip_ancestor: Assertion `svn_uri_is_canonical(child_uri, NULL)' failed.
Aborted
$ python test_export.py quote
$ echo $?
0

Diff Detail

Repository
rDLDSVN Subversion (SVN) loader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

anlambert edited the summary of this revision. (Show Details)

Build is green

Patch application report for D8786 (id=31660)

Rebasing onto 8c709079ce...

Current branch diff-target is up to date.
Changes applied before test
commit 63071d5af79dc064e1a704ba262ae2075906a812
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Oct 27 11:29:36 2022 +0200

    svn: Ensure to quote URLs provided as parameters to client methods
    
    URLs provided as parameters to subvertpy.client.Client methods must
    be quoted or an assertion will be raised by libsvn otherwise.

See https://jenkins.softwareheritage.org/job/DLDSVN/job/tests-on-diff/343/ for more details.

Build is green

Patch application report for D8786 (id=31668)

Rebasing onto 8c709079ce...

Current branch diff-target is up to date.
Changes applied before test
commit 255b07349179138f8ace89c1776868a6db1bd717
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Oct 27 11:29:36 2022 +0200

    svn: Ensure to quote URLs provided as parameters to client methods
    
    URLs provided as parameters to subvertpy.client.Client methods must
    be quoted or an assertion will be raised by libsvn otherwise.

See https://jenkins.softwareheritage.org/job/DLDSVN/job/tests-on-diff/344/ for more details.

Only quote spaces as svn will also raise an assertion if we quote other special characters.

Build is green

Patch application report for D8786 (id=31680)

Rebasing onto 8c709079ce...

Current branch diff-target is up to date.
Changes applied before test
commit c6d39b7bb70bb5896840a0fc22f8763d5d8b35cf
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Oct 27 11:29:36 2022 +0200

    svn: Ensure to quote URLs provided as parameters to client methods
    
    URLs provided as parameters to subvertpy.client.Client methods must
    be quoted when it contains space characters or an assertion will be
    raised by libsvn otherwise.

See https://jenkins.softwareheritage.org/job/DLDSVN/job/tests-on-diff/347/ for more details.

This revision is now accepted and ready to land.Oct 31 2022, 2:13 PM