git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-cvsserver wart?

From
Cameron McBride <cameron.mcbride@gmail.com>
Date
May 26, 2006, 03:11 UTC
Message-ID
<dcedf5e20605252011v6738dc9dg3d4801144d3e9898@mail.gmail.com>
In-Reply-To
<46a038f90605251419kd45fbj419565eabdd63182@mail.gmail.com>
On 5/25/06, Martin Langhoff <martin.langhoff@gmail.com> wrote:
> On 5/26/06, Cameron McBride <cameron.mcbride@gmail.com> wrote:
> There's been some recent changes to cvsserver -- so version info is
> crucial. What git version are you using? Can you try with the lastest
> #master head from Junio? That's the latest and greatest...
sorry, my bad. This error was discovered using the git stable, v1.3.3.
 Grabbing the latest at git://git.kernel.org/pub/scm/git/git.git
showed the same problem.
> If that doesn't fix it, can you post the logs? I think you have to
> declare CVS_LOG=/tmp/cvslog or somesuch.

I'm assuming you mean the log from git-cvsserver (set via git/config with logfile=...)

Besides the log cutoff in the broken attempt, it appears the culprit is a lack of arguments being passed down as that is the only difference in the logs. Specifically, the working versions output 'Arguments : (something) ' which seemed to come from the req_Argument() subroutine around line 550 (in the case of newer CVS, the output is '--').

Anyhow, the error seems to be that $state->{args} is not getting initialized. In the newer version, there seemed to be additional uninitialized variables, e.g. $state->{prependdir}. These might be signs of some larger problem (where the $state isn't getting set properly).

To quiet it down and get it to run - a crude hack seemed to work (included below). I didn't test any of this much, nor do I really understand the whole of what's going on - my alterations just seemed to allow 'cvs up' to complete without errors or warnings from both clients. Not a very robust criteria, so please review.

Cameron
--
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 5ccca4f..a52e838 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -1702,6 +1702,7 @@ sub argsfromdir
 {
     my $updater = shift;

+    $state->{args} = [] unless defined($state->{args});
     $state->{args} = [] if ( scalar(@{$state->{args}}) == 1 and
$state->{args}[0] eq "." );

     return if ( scalar ( @{$state->{args}} ) > 1 );
@@ -1729,7 +1730,11 @@ sub argsfromdir
         foreach my $file ( @{$updater->gethead} )
         {
             next if ( $file->{filehash} eq "deleted" and not defined
( $state->{entries}{$file->{name}} ) );
-            next unless ( $file->{name} =~ s/^$state->{prependdir}// );
+            if( defined($state->{prependdir} ) )
+            {
+                $file->{name} =~ s/^$state->{prependdir}//;
+            }
+            next unless ( $file->{name} );
             push @{$state->{args}}, $file->{name};
         }
     }
@@ -1812,7 +1817,7 @@ sub filenamesplit
     ( $filepart, $dirpart ) = ( $2, $1 ) if ( $filename =~ /(.*)\/(.*)/ );
     $dirpart .= "/";

-    if ( $fixforlocaldir )
+    if ( $fixforlocaldir and defined($state->{prependdir}))
     {
         $dirpart =~ s/^$state->{prependdir}//;
     }
@@ -1832,7 +1837,10 @@ sub filecleanup
     }

     $filename =~ s/^\.\///g;
-    $filename = $state->{prependdir} . $filename;
+    if( defined($state->{prependdir}) )
+    {
+        $filename = $state->{prependdir} . $filename;
+    }
     return $filename;
 }
Previous: Martin LanghoffNext: Martin Langhoff
Message 3 of 8 in “git-cvsserver wart?”
  1. Cameron McBrideMay 25, 2006
  2. Martin LanghoffMay 25, 2006
  3. Cameron McBrideMay 26, 2006
  4. Martin LanghoffMay 26, 2006
  5. Cameron McBrideMay 26, 2006
  6. Cameron McBrideMay 26, 2006
  7. Martin LanghoffMay 26, 2006
  8. Cameron McBrideMay 26, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.