git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frank Lichtenheld <frank@lichtenheld.de>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org, Martin Langhoff <martin.langhoff@gmail.com>,
	Frank Lichtenheld <frank@lichtenheld.de>
Subject: [PATCH] cvsserver: Limit config parser to needed options
Date: Sun, 13 May 2007 02:16:24 +0200	[thread overview]
Message-ID: <11790153841188-git-send-email-frank@lichtenheld.de> (raw)
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

  reply	other threads:[~2007-05-13  0:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-11 23:35 [PATCH] t9400: Use the repository config and nothing else Junio Hamano
2007-05-12 16:28 ` Frank Lichtenheld
2007-05-12 16:31   ` Junio C Hamano
2007-05-12 17:21     ` Junio C Hamano
2007-05-12 19:36       ` Frank Lichtenheld
2007-05-12 19:30 ` [PATCH] cvsserver: Complete rewrite of the configuration parser Frank Lichtenheld
2007-05-12 19:59   ` Junio C Hamano
2007-05-12 21:31     ` Frank Lichtenheld
2007-05-12 22:43       ` Junio C Hamano
2007-05-13  0:16         ` Frank Lichtenheld [this message]
2007-05-13 19:16           ` [PATCH] cvsserver: Limit config parser to needed options Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11790153841188-git-send-email-frank@lichtenheld.de \
    --to=frank@lichtenheld.de \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=martin.langhoff@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).