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

Re: cvsimport still not working with cvsnt

From
GRGuy Rouillier <guyr@burntmail.com>
Date
Feb 18, 2011, 06:26 UTC
Message-ID
<4D5E1116.7040501@burntmail.com>
In-Reply-To
<7vhbcb35xk.fsf@alter.siamese.dyndns.org>
On 2/10/2011 5:01 PM, Junio C Hamano wrote:
Show 13 quoted lines
> Martin Langhoff <martin@laptop.org> writes:
> 
>> On Sat, Jan 29, 2011 at 11:33 PM, Guy Rouillier<guyr@burntmail.com>  wrote:
>>> That was my original inclination.  As no other opinions have been posted
>>> since your message, here is my amended patch, incorporating Martin's
>>> ideas and dieing if the script finds both CVS and CVSNT password files.
>>
>> ACK! Thanks!
> 
> Can somebody resubmit an appliable patch with a proper commit message that
> describes the problem and the solution please.
> 
> Thanks.

Junio, sorry for the delay in response. I'm new to all this and I thought perhaps one of the listed committers had to submit the official patch. Perhaps they do. I followed the directions in SubmittingPatches. The result is below. Please let me know if I need to do something differently. I didn't simply send the result of format-match because that would have started a different message thread. Thanks.

>From d3ae7d304ee2b89740225b0433bf7d7e07248f59 Mon Sep 17 00:00:00 2001
From: Guy Rouillier <guyr@burntmail.com>
Date: Fri, 18 Feb 2011 00:53:10 -0500
Subject: [PATCH] Look for password in both CVS and CVSNT password files.

The existing code looks for the CVS reposity password only in the CVS password file in HOME/.cvspass. Accommodate the CVS alternative CVSNT by also looking in HOME/.cvs/cvspass. Die if both files are found, and ask the user to remove one.

Signed-off-by: Guy Rouillier <guyr@burntmail.com>
---
 git-cvsimport.perl |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 8e683e5..76b4765 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -259,19 +259,27 @@ sub conn {
 		if ($pass) {
 			$pass = $self->_scramble($pass);
 		} else {
-			open(H,$ENV{'HOME'}."/.cvspass") and do {
-				# :pserver:cvs@mea.tmt.tele.fi:/cvsroot/zmailer Ah<Z
-				while (<H>) {
-					chomp;
-					s/^\/\d+\s+//;
-					my ($w,$p) = split(/\s/,$_,2);
-					if ($w eq $rr or $w eq $rr2) {
-						$pass = $p;
-						last;
+			my @cvspasslocations = ($ENV{'HOME'}."/.cvspass", $ENV{'HOME'}."/.cvs/cvspass");
+			my $filecount = 0;
+			foreach my $cvspass (@cvspasslocations) {
+
+				open(H, $cvspass) and do {
+					# :pserver:cvs@mea.tmt.tele.fi:/cvsroot/zmailer Ah<Z
+					$filecount++;
+					while (<H>) {
+						chomp;
+						s/^\/\d+\s+//;
+						my ($w,$p) = split(/[\s=]/,$_,2);
+						if ($w eq $rr or $w eq $rr2) {
+							$pass = $p;
+							last;
+						}
 					}
-				}
-			};
-			$pass = "A" unless $pass;
+				};
+			}
+
+			die("Two CVS password files found: @cvspasslocations, please remove one") if $filecount > 1;
+			die("Password not found for CVSROOT: $opt_d\n") unless $pass;
 		}

 		my ($s, $rep);
--
1.7.3.4
-- 
Guy Rouillier
Previous: Junio C HamanoNext: Junio C Hamano
Message 13 of 32 in “cvsimport still not working with cvsnt”
  1. Guy RouillierDec 20, 2010
  2. Jonathan NiederDec 20, 2010
  3. Emil MedveDec 21, 2010
  4. Guy RouillierDec 22, 2010
  5. Guy RouillierJan 10, 2011
  6. Martin LanghoffJan 10, 2011
  7. Guy RouillierJan 14, 2011
  8. Jonathan NiederJan 14, 2011
  9. Junio C HamanoJan 14, 2011
  10. Guy RouillierJan 30, 2011
  11. Martin LanghoffJan 30, 2011
  12. Junio C HamanoFeb 10, 2011
  13. Guy RouillierFeb 18, 2011
  14. Junio C HamanoFeb 18, 2011
  15. Guy RouillierFeb 19, 2011
  16. Junio C HamanoFeb 20, 2011
  17. Guy RouillierFeb 21, 2011
  18. Junio C HamanoFeb 21, 2011
  19. Junio C HamanoFeb 22, 2011
  20. Martin LanghoffFeb 22, 2011
  21. Guy RouillierFeb 23, 2011
  22. Junio C HamanoFeb 23, 2011
  23. Guy RouillierFeb 23, 2011
  24. Junio C HamanoFeb 23, 2011
  25. Guy RouillierFeb 27, 2011
  26. Junio C HamanoFeb 27, 2011
  27. Guy RouillierApr 29, 2011
  28. Jonathan NiederApr 29, 2011
  29. Guy RouillierMay 1, 2011
  30. Junio C HamanoMay 1, 2011
  31. Junio C HamanoFeb 23, 2011
  32. Guy RouillierFeb 24, 2011

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.