All of lore.kernel.org
 help / color / mirror / Atom feed
* Fix a critical bug in git-cvsexportcommit.perl
@ 2014-09-24  8:32 Luke Lee
  2014-09-24 10:20 ` Stefan Beller
  0 siblings, 1 reply; 3+ messages in thread
From: Luke Lee @ 2014-09-24  8:32 UTC (permalink / raw)
  To: git

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Fix a critical bug in git-cvsexportcommit.perl
  2014-09-24  8:32 Fix a critical bug in git-cvsexportcommit.perl Luke Lee
@ 2014-09-24 10:20 ` Stefan Beller
  2014-09-25  3:15   ` Luke Lee
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Beller @ 2014-09-24 10:20 UTC (permalink / raw)
  To: Luke Lee, git

On 24.09.2014 10:32, Luke Lee wrote:
> 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

Thanks for sending a patch. :)

> 
> 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.

Please have a look at Documentation/SubmittingPatches,
also found online at
https://github.com/git/git/blob/master/Documentation/SubmittingPatches

Specially look at section "(2) Describe your changes well."
So the headline could be shorter and then in the body of the commit
message you may want to be more descriptive

Also look at section "(5) Sign your work"
This is to make sure you're legally allowed to send in the patch,
i.e. you're doing it on your own time or your employer allowed you to
send code here to the mailing list.


> 
> ---
>  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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fix a critical bug in git-cvsexportcommit.perl
  2014-09-24 10:20 ` Stefan Beller
@ 2014-09-25  3:15   ` Luke Lee
  0 siblings, 0 replies; 3+ messages in thread
From: Luke Lee @ 2014-09-25  3:15 UTC (permalink / raw)
  To: Stefan Beller; +Cc: git

Stefan Beller <stefanbeller@gmail.com> writes:

> Please have a look at Documentation/SubmittingPatches,
> also found online at
> https://github.com/git/git/blob/master/Documentation/SubmittingPatches
>
> Specially look at section "(2) Describe your changes well."
> So the headline could be shorter and then in the body of the commit
> message you may want to be more descriptive
>
> Also look at section "(5) Sign your work"
> This is to make sure you're legally allowed to send in the patch,
> i.e. you're doing it on your own time or your employer allowed you to
> send code here to the mailing list.

I followed both (2) and (5), a new patch is generated and signed as
follows. Hopefully this time it fits the criteria :). Thanks.


>From a265cffc5f5bbfb3309a5ef2b425096523c94066 Mon Sep 17 00:00:00 2001
From: "Luke Y.X. Lee" <luke.yx.lee@gmail.com>
Date: Thu, 25 Sep 2014 10:56:46 +0800
Subject: [PATCH] Fix git-cvs bug that kills non-keyword source texts

* git-cvsexportcommit.perl: the wild matching on unexpanding keywords
overkilled texts that are not CVS keywords. Limits the matching to
CVS keywords only; also prevents OO syntax that accidentally matched.

Signed-off-by: Luke Y.X. Lee <luke.yx.lee@gmail.com>
---
 git-cvsexportcommit.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index d13f02d..8671d41 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -309,7 +309,7 @@ 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.304.gb913e04

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-25  3:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-24  8:32 Fix a critical bug in git-cvsexportcommit.perl Luke Lee
2014-09-24 10:20 ` Stefan Beller
2014-09-25  3:15   ` Luke Lee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.