Uploaded image for project: 'Subversion'
  1. Subversion
  2. SVN-2060

svn ls returns parent folder in some cases

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.1.x
    • Fix Version/s: 1.1.1
    • Component/s: libsvn_ra_neon
    • Labels:
      None

      Description

      As Karl Fogel asked me to do, I'm filing this as an issue here.
      
      Mentioned on the mailing list here:
      http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=78359
      
      Because I got a bug report for TSVN which I tried to fix I found that this is a
      bug in the Subversion library. So I'm reporting this here:
      
      If a directory contains "special" chars like öäü in it, 'svn ls' returns not
      only the contents of that directory, but the directory itself too.
      Example:
      
      http://localhost/svn/test/testparent/öäüÄÖÜ
      http://localhost/svn/test/testparent/öäüÄÖÜ/file1.txt
      
      now:
      svn ls http://localhost/svn/test/testparent
      returns
      öäüÄÖÜ
      
      as expected. But an
      svn ls http://localhost/svn/test/testparent/öäüÄÖÜ
      returns
      öäüÄÖÜ/
      file1.txt
      
      I also tried this with the 1.0.6 client, and there the the öäüÄÖÜ Folder in the
      second 'svn ls' isn't returned.
      (both tests against an RC3 Subversion server, running Apache 2.0.50)
      
      Don't know where and when this changed, but it should at least be consistend,
      i.e. either always return the requested folder or never.
      
      
      The answer to that from Philip Martin here:
      http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=78385
      
      There is an inconsistency with the alphabetic case used when URI
      encoding:
      
      Breakpoint 4, svn_ra_dav__get_dir (session_baton=0x8099d70, 
          path=0x40039131 "", revision=3, dirents=0xbffff80c, fetched_rev=0x0, 
          props=0x0, pool=0x808b1f8) at ../svn/subversion/libsvn_ra_dav/fetch.c:919
      919               if (strcmp(resource->url, stripped_final_url) == 0)
      (gdb) p resource->url
      $8 = 0x80a1248 "/obj/repo/!svn/bc/3/f%c3%a3o"
      (gdb) p stripped_final_url
      $9 = 0x80a22e0 "/obj/repo/!svn/bc/3/f%C3%A3o"
      
      strcmp will treat those URLs as different.
      
      Now Subversion's path.c:uri_escape() uses sprintf("%%%02X") so it should
      produce upper case, however the server sends lower case
      
      <?xml version="1.0" encoding="utf-8"?>
      <D:multistatus xmlns:D="DAV:"
      xmlns:ns1="http://subversion.tigris.org/xmlns/dav/" xmlns:ns0="DAV:">
      <D:response xmlns:lp1="DAV:" xmlns:lp2="http://subversion.tigris.org/xmlns/dav/">
      <D:href>/obj/repo/f%c3%a3o/</D:href>
      <D:propstat>
      <D:prop>
      
      I'm not sure where that gets produced, but Apache's util.c:c2x() uses
      c2x_table[] = "0123456789abcdef" so it could be that.
      
      A quick fix might be to make Subversion use lower case, a less fragile
      fix would be to compare URLs using a function that handles escape
      sequences that differ in case.
      
      --------------------------
      
      Note: this bug breaks every Subversion client out there which provides some sort
      of repository browsing using either 'svn ls' or the equivalent svn_client_ls()
      API. Not that it breaks in sense of crashing, but it gives a bad user impression
      when bogus folders are shown.
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                subversion-importer Subversion Importer
                Reporter:
                steveking Stefan Küng
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: