git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luke Lee <luke.yx.lee@gmail.com>
To: git@vger.kernel.org
Subject: Fix a critical bug in git-cvsexportcommit.perl
Date: Wed, 24 Sep 2014 16:32:16 +0800	[thread overview]
Message-ID: <wq8tquzz.fsf@gmail.com> (raw)

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

             reply	other threads:[~2014-09-24  8:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24  8:32 Luke Lee [this message]
2014-09-24 10:20 ` Fix a critical bug in git-cvsexportcommit.perl Stefan Beller
2014-09-25  3:15   ` Luke Lee

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=wq8tquzz.fsf@gmail.com \
    --to=luke.yx.lee@gmail.com \
    --cc=git@vger.kernel.org \
    /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).