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

Fix a critical bug in git-cvsexportcommit.perl

From
LLLuke Lee <luke.yx.lee@gmail.com>
Date
Sep 24, 2014, 08:32 UTC
Message-ID
<wq8tquzz.fsf@gmail.com>

I fixed a long standing bug in git-cvsexportcommit.perl script which corrupt my Perl code several times. This time I figure it out. It's about keyword expansion. Take a simple example, a Perl code like this:

    printf "Perl/Tk $Tk::Version ($Tk::platform)\n";
will be incorrectly unexpand by git-cvsexportcommit.perl to:
    printf "Perl/Tk $Tk$Tk::platform)\n";

This happens when I try to export a git commit to a CVS working directory *with keyword expansion turned off*. git-cvsexportcommit will try to simulate what CVS does on unexpanding keywords. However, it *DOES NOT* realize only valid keywords should be unexpanded. Please help apply this patch.

Thanks. Luke Lee

>From a33096156e376924d3a7ac2b5a42877f9aedee58 Mon Sep 17 00:00:00 2001
From: Luke Lee <luke.yx.lee@gmail.com>
Date: Wed, 24 Sep 2014 14:38:17 +0800
Subject: [PATCH] Fix a critical bug in git-cvsexportcommit.perl about
 unexpanding keywords which incorrectly delete codes that are not expanded
 keywords.
---
 git-cvsexportcommit.perl | 2 +-
 1 file changed, 1 insertions(+), 1 deletion(-)
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index d13f02d..bf41a72 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -309,7 +309,8 @@ foreach my $f (@files) {
 	while (<FILTER_IN>)
 	{
 	    my $line = $_;
-	    $line =~ s/\$([A-Z][a-z]+):[^\$]+\$/\$$1\$/g;
+	    $line =~ s/\$(Author|Date|Header|Id|Locker|Log|RCSfile|Revision|Source|State):[^:\$][^\$]+\$/\$$1\$/g;
 	    print FILTER_OUT $line;
 	}
 	close FILTER_IN;
--
2.1.1.303.ga330961.dirty
Next: Stefan Beller
Message 1 of 3 in “Fix a critical bug in git-cvsexportcommit.perl”
  1. Luke LeeSep 24, 2014
  2. Stefan BellerSep 24, 2014
  3. Luke LeeSep 25, 2014

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.