public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Guy Rouillier <guyr@burntmail•com>
To: Junio C Hamano <gitster@pobox•com>
Cc: Martin Langhoff <martin@laptop•org>,
	Jonathan Nieder <jrnieder@gmail•com>,
	Emil Medve <Emilian.Medve@freescale•com>,
	git <git@vger•kernel.org>, Pascal Obry <pascal@obry•net>,
	Clemens Buchacher <drizzd@aon•at>
Subject: Re: cvsimport still not working with cvsnt
Date: Sat, 19 Feb 2011 02:17:43 -0500	[thread overview]
Message-ID: <4D5F6E97.4000402@burntmail.com> (raw)
In-Reply-To: <7voc69p4xu.fsf@alter.siamese.dyndns.org>

On 2/18/2011 1:34 PM, Junio C Hamano wrote:
> Guy Rouillier <guyr@burntmail•com> writes:
> 
>> ...  I'm new to all this and I thought 
>> perhaps one of the listed committers had to submit the official patch.  
> 
> There is no _listed committers_ ;-)  I was hoping either you as the original
> author of the patch or Martin as the area expert would respond, but as
> long as the result looks correct and explained well, it doesn't matter
> either way.
> 
> Just one hopefully final question.
> 
> After stripping "/<version number><space>" from the beginning of the line
> in order to treat newer .cvspass file format and the original file format
> the same way, the code splits the remainder into two fields (cvsroot and
> lightly-scrambled password).  It used to split only at a whitespace, which
> seems to be in line with the source of CVS 1.12.13 I looked at (it is in
> password_entry_parseline() function, src/login.c).  You new code however
> also allows '=' to be a delimiter to be used for this split.
> 
> Is this change intentional?  If so please explain why it is necessary in
> the commit log message.

Thanks to everyone here for the gracious patience with newcomers.

Yes, the change is intentional.  I've added an additional commit comment to
explain why.

>From 0fdfbdc0dbd0a0280d987640890f7b5ff566d6ef Mon Sep 17 00:00:00 2001
From: Guy Rouillier <guyr@burntmail•com>
Date: Sat, 19 Feb 2011 01:56:15 -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.

The two clients use a different delimiter to separate the CVS
repository name from the user password.  The original CVS
client separates the two entries with a space character, while
CVSNT separates them with an equal (=) character.  Hence,
the regular expression used to split these two tokens is
altered to accept either delimiter.

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.4.rc1.5.ge17aa

-- 
Guy Rouillier

  reply	other threads:[~2011-02-19  7:18 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-20  4:05 cvsimport still not working with cvsnt Guy Rouillier
2010-12-20 21:36 ` Jonathan Nieder
2010-12-21 22:09   ` Emil Medve
2010-12-22  5:43     ` Guy Rouillier
2011-01-10  7:33       ` Guy Rouillier
2011-01-10 15:38         ` Martin Langhoff
2011-01-14  6:38           ` Guy Rouillier
2011-01-14  7:44             ` Jonathan Nieder
2011-01-14 21:49               ` Junio C Hamano
2011-01-30  6:33                 ` Guy Rouillier
2011-01-30 20:19                   ` Martin Langhoff
2011-02-10 22:01                     ` Junio C Hamano
2011-02-18  6:26                       ` Guy Rouillier
2011-02-18 18:34                         ` Junio C Hamano
2011-02-19  7:17                           ` Guy Rouillier [this message]
2011-02-20  7:21                             ` Junio C Hamano
2011-02-21  4:30                               ` Guy Rouillier
2011-02-21 23:33                                 ` Junio C Hamano
2011-02-22 23:08                                   ` Junio C Hamano
2011-02-22 23:50                                     ` Martin Langhoff
2011-02-23  0:08                                       ` Guy Rouillier
2011-02-23  0:45                                         ` Junio C Hamano
2011-02-23  2:33                                           ` Guy Rouillier
2011-02-23  5:24                                             ` Junio C Hamano
2011-02-27  5:20                                           ` Guy Rouillier
2011-02-27  8:26                                             ` Junio C Hamano
2011-04-29  4:27                                               ` Guy Rouillier
2011-04-29 22:27                                                 ` Jonathan Nieder
2011-05-01  5:33                                                   ` Guy Rouillier
2011-05-01 18:44                                                     ` Junio C Hamano
2011-02-23  0:42                                       ` Junio C Hamano
2011-02-24  3:14                                         ` Guy Rouillier

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=4D5F6E97.4000402@burntmail.com \
    --to=guyr@burntmail$(echo .)com \
    --cc=Emilian.Medve@freescale$(echo .)com \
    --cc=drizzd@aon$(echo .)at \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=jrnieder@gmail$(echo .)com \
    --cc=martin@laptop$(echo .)org \
    --cc=pascal@obry$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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