Bug accessing file whose path starts with a dot

David O'Shea dcoshea at hotmail.com
Mon Oct 20 08:01:29 PDT 2003


Hi all,

cvsweb 2.0.6 running under Win32 Apache 2.0.44 and Cygwin Perl 5.8.0
(but I don't think those details are relevant) is failing to display a
file whose path starts with a '.'.  When I select the relevant CVS
Root and then in the table click on the directory starting with a '.'
('.profile.d/'), then select a file ('lynx.cfg') and click on the
version ('1.1.1.1') I get:

>>>
Error: Unexpected output from cvs co:
===================================================================
Checking out .profile.d/lynx.cfg RCS:
/home/doshea/profile-repository/.profile.d/lynx.cfg,v VERS: 1.1.1.1
<<<

The issue is that cvsweb seems to be trying to strip off any leading
'./', './/', './//', etc. from the filename shown after 'Checking out'
but it also strips a '.' by itself.  Here's my patch which also
improves the error message (which helped me to figure out the
problem):

>>>
--- cvsweb.cgi  2002-09-27 06:56:06.000000000 +1000
+++ /usr/Apache/Apache2/cgi-bin/cvsweb.cgi      2003-09-11
20:01:06.000000000 +1000
@@ -1861,15 +1862,15 @@

                if (/^Checking out (.*)$/) {
                        $filename = $1;
-                       $filename =~ s/^\.\/*//;
+                       $filename =~ s/^\.\/+//;
                }
                $cvsheader .= $_;
        }

        if ($filename ne $where) {
                fatal("500 Internal Error",
-                     'Unexpected output from cvs co: %s',
-                     $cvsheader);
+                     'Unexpected output from cvs co: %s (output says
"%s" but expected "%s")',
+                     $cvsheader, $filename, $where);
        }
        $| = 1;
<<<

I changed the regexp to match a '.' followed by one or more '/',
instead of zero or more '/' as it was previously.

Thanks,
David


More information about the freebsd-cvsweb mailing list