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

[PATCH] cvsserver: Limit config parser to needed options

From
Frank Lichtenheld <frank@lichtenheld.de>
Date
May 13, 2007, 00:16 UTC
Message-ID
<11790153841188-git-send-email-frank@lichtenheld.de>
In-Reply-To
<7v3b21wtlf.fsf@assigned-by-dhcp.cox.net>

Change the configuration parser so that it ignores everything except for ^gitcvs.((ext|pserver).)? This greatly reduces the risk of failing while parsing some unknown and irrelevant config option.

The bug that triggered this change was that the parsing doesn't handle sections that have a subsection and a variable with the same name.

While this bug still remains, all remaining causes can be attributed to user error, since there are no defined variables gitcvs.ext and gitcvs.pserver.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
---
 git-cvsserver.perl |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 3e7bf5b..a07c725 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -183,9 +183,9 @@ sub req_Root
     }
     foreach my $line ( @gitvars )
     {
-        next unless ( $line =~ /^(.*?)\.(.*?)(?:\.(.*?))?=(.*)$/ );
-        unless ($3) {
-            $cfg->{$1}{$2} = $4;
+        next unless ( $line =~ /^(gitcvs)\.(?:(ext|pserver)\.)?([\w-]+)=(.*)$/ );
+        unless ($2) {
+            $cfg->{$1}{$3} = $4;
         } else {
             $cfg->{$1}{$2}{$3} = $4;
         }
-- 
1.5.1.4
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 11 in “t9400: Use the repository config and nothing else.”
  1. t9400: Use the repository config and nothing else.Junio Hamano, May 11, 2007
  2. Frank LichtenheldMay 12, 2007
  3. Junio C HamanoMay 12, 2007
  4. Junio C HamanoMay 12, 2007
  5. Frank LichtenheldMay 12, 2007
  6. cvsserver: Complete rewrite of the configuration parserFrank Lichtenheld, May 12, 2007
  7. Junio C HamanoMay 12, 2007
  8. Frank LichtenheldMay 12, 2007
  9. Junio C HamanoMay 12, 2007
  10. cvsserver: Limit config parser to needed optionsFrank Lichtenheld, May 13, 2007
  11. Junio C HamanoMay 13, 2007

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.