views:

249

answers:

3

On the Windows command line and cygwin bash I can execute the following without problems:

cvs login
cvs -Q log -N -rVersion_01_00

A ruby script in the same directory contains the following:

`cvs login`;
`cvs -Q log -N -rVersion_01_00`;

When I execute the ruby script on the Windows command line I get the following error:

cvs log: warning: failed to open /cygdrive/c/Documents and Settings/za100744/.cvspass for reading: No such file or directory

If I run the script in a cygwin bash shell I get the same output I would as when I type in the commands manually.

I have no idea as to what is going wrong. The path generated by the Ruby script is wrong since it is a cygwin path but it works correctly directly on the command line. I use cvs that came as part of cygwin:

which cvs
cvs is an external : C:\cygwin\bin\cvs.exe

Ruby is the one-click installer version:

which ruby
/cygdrive/c/Ruby/bin/ruby

It seems like cvs under Ruby can not resolve /cygdrive/c to c: but works OK from the cmdline.

Perl gives me exactly the same problem.

my $str = "cvs -Q log -N -r$cvs_tag|";
open(CVS_STATUS, $str) or die "\n##ERROR##";
A: 

It looks like either CVS can't create the file, or your path is wrong. Does the file .cvspass exist? If not, this page suggests you try creating an empty .cvspass file and then run your command. e.g. do

touch ~/.cvspass

If this doesn't help, then the problem is probably path related. There are a few possibilities; $HOME not set correctly, your home dir not matching what's in \etc\passwd, etc. See this tutorial for some troubleshooting steps that should help pin down the problem.

ire_and_curses
The file exists and is accessible. It seems like cvs under ruby can not resolve /cygdrive/c to `c:` but works OK from the cmdline.
Gerhard
A: 

We had several problems with unix-, mixed- and windows-style paths in cygwin based perl scripts and built-in tools such as rsync. E.g. rsync can't handle wind-style paths. Use the tool "cygpath.exe" to adjust them correctly. Maybe it's the cause.

felix
The path is internal to the CVS executable, so cygpath.exe will not help. But I am filing the info for future use.
Gerhard
+1  A: 

Using a windows native compiled CVS solves the problem. It is not ideal since I have to send a cvs executable with the script for users that has cygwin CVS but its better than nothing.

Gerhard