Hi.
I came across the following (I use tramp's cvs repository as an
example, any will do):
dinsdale@glitch:~$ ls ~/.cvspass
ls: /home/dinsdale/.cvspass: No such file or directory
dinsdale@glitch:~$ cvs -d :pserver:[EMAIL PROTECTED]:/cvsroot/tramp
login
Logging in to :pserver:[EMAIL PROTECTED]:2401/cvsroot/tramp
CVS password:
cvs login: failed to open /home/dinsdale/.cvspass for reading: No such file or
directory
cvs [login aborted]: fatal error: exiting
dinsdale@glitch:~$ touch ~/.cvspass
dinsdale@glitch:~$ cvs -d :pserver:[EMAIL PROTECTED]:/cvsroot/tramp
login
Logging in to :pserver:[EMAIL PROTECTED]:2401/cvsroot/tramp
CVS password:
dinsdale@glitch:~$
cvs login shouldn't *need* read ~/.cvspass . It may try to read it,
to check for duplicate entries or something like that, but an error there
shouldn't be fatal.
Attached is a patch to login.c which deals with that. Please apply
it, or consider some other fix to this. While it's not a very critical bug
(as shown above, I can simply touch(1) the file), it can confuse new users.
Thanks,
rbp
______________________________________________________________________
Rodrigo Bernardo Pimentel <[EMAIL PROTECTED]>
http://www.linuxsp.org.br http://isnomore.net
GPG: <0x81F85A48> 7E62 9CA2 C95B FC86 B334 203E C011 2E4D 81F8 5A48
Computer games don't affect kids. I mean, if Pac-Man affected us as kids,
we'd all be running around in darkened rooms, munching magic pills
and listening to repetitive electronic music.
--- login.c.orig Thu Apr 19 16:45:32 2001
+++ login.c Sun Mar 3 14:20:35 2002
@@ -320,36 +320,42 @@
passfile = construct_cvspass_filename ();
fp = CVS_FOPEN (passfile, "r");
- if (fp == NULL)
+
+ /* If the file doesn't exist, we simply treat it as an empty file */
+ if (fp == NULL && operation != password_entry_add)
{
error (0, errno, "failed to open %s for reading", passfile);
goto error_exit;
}
- cvsroot_canonical = normalize_cvsroot (root);
-
- /* Check each line to see if we have this entry already. */
- line = 0;
- while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0)
- {
- line++;
- password = password_entry_parseline(cvsroot_canonical, 1, line, linebuf);
- if (password != NULL)
- /* this is it! break out and deal with linebuf */
- break;
- }
- if (line_length < 0 && !feof (fp))
+ if (fp != NULL)
{
- error (0, errno, "cannot read %s", passfile);
- goto error_exit;
+ cvsroot_canonical = normalize_cvsroot (root);
+
+ /* Check each line to see if we have this entry already. */
+ line = 0;
+ while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0)
+ {
+ line++;
+ password = password_entry_parseline(cvsroot_canonical, 1, line, linebuf);
+ if (password != NULL)
+ /* this is it! break out and deal with linebuf */
+ break;
+ }
+ if (line_length < 0 && !feof (fp))
+ {
+ error (0, errno, "cannot read %s", passfile);
+ goto error_exit;
+ }
+ if (fclose (fp) < 0)
+ /* not fatal, unless it cascades */
+ error (0, errno, "cannot close %s", passfile);
+ fp = NULL;
}
- if (fclose (fp) < 0)
- /* not fatal, unless it cascades */
- error (0, errno, "cannot close %s", passfile);
- fp = NULL;
/* Utter, total, raving paranoia, I know. */
- chmod (passfile, 0600);
+ if (isfile (passfile))
+ chmod (passfile, 0600);
/* a copy to return or keep around so we can reuse linebuf */
if (password != NULL)