I received the following bug report on the Debian cvs package. I have
attached a patch which makes sure diff and commit get "--" before any
filenames so that they won't try to interpret filenames that begin
with dashes. It's possible this needs to be fixed in other areas as
well.
src/client.c:
(send_files): Call send_arg("--") before sending files so that the
remote 'cvs ci' command doesn't think filenames that begin with dashes
are options.
src/rcscmds.c:
(RCS_merge): Call call_diff_arg("--") before passing the filenames so
the diff command doesn't think filenames that begin with dashes are
options.
(diff_exec): Same.
(diff_execv): Same.
--
Eric Gillespie, Jr. <*> [EMAIL PROTECTED]
"When everyone has to reinvent the wheel, many people invent
square wheels."
--- Begin Message ---
Package: cvs
Client-Version: 1.10.7-7
Server-Version: 1.11.1p1-1
===
adam@yakko:~/code/erector-set/tmp$ touch ./---bar
adam@yakko:~/code/erector-set/tmp$ cvs add ---bar
add: invalid option -- -
Usage: cvs add [-k rcs-kflag] [-m message] files...
-k Use "rcs-kflag" to add the file with the specified kflag.
-m Use "message" for the creation log.
(Specify the --help global option for a list of other help options)
adam@yakko:~/code/erector-set/tmp$ cvs add -- ---bar
cvs server: invalid option -- -
Usage: cvs server [-k rcs-kflag] [-m message] files...
-k Use "rcs-kflag" to add the file with the specified kflag.
-m Use "message" for the creation log.
(Specify the --help global option for a list of other help options)
adam@yakko:~/code/erector-set/tmp$ cvs add ./---bar
cvs server: scheduling file `./---bar' for addition
cvs server: use 'cvs commit' to add this file permanently
adam@yakko:~/code/erector-set/tmp$ cvs ci -m bar -- ---bar
cvs server: invalid option -- -
Usage: cvs server [-nRlf] [-m msg | -F logfile] [-r rev] files...
-n Do not run the module program (if any).
-R Process directories recursively.
-l Local directory only (not recursive).
-f Force the file to be committed; disables recursion.
-F logfile Read the log message from file.
-m msg Log message.
-r rev Commit to this branch or trunk revision.
(Specify the --help global option for a list of other help options)
adam@yakko:~/code/erector-set/tmp$ cvs ci -m bar -- ./---bar
cvs server: invalid option -- -
Usage: cvs server [-nRlf] [-m msg | -F logfile] [-r rev] files...
-n Do not run the module program (if any).
-R Process directories recursively.
-l Local directory only (not recursive).
-f Force the file to be committed; disables recursion.
-F logfile Read the log message from file.
-m msg Log message.
-r rev Commit to this branch or trunk revision.
(Specify the --help global option for a list of other help options)
adam@yakko:~/code/erector-set/tmp$ touch bar
adam@yakko:~/code/erector-set/tmp$ cvs add bar
cvs server: scheduling file `bar' for addition
cvs server: use 'cvs commit' to add this file permanently
adam@yakko:~/code/erector-set/tmp$ cvs ci -m bar bar ---bar
RCS file: /cvs/utils/erector-set/tmp/bar,v
done
Checking in bar;
/cvs/utils/erector-set/tmp/bar,v <-- bar
initial revision: 1.1
done
RCS file: /cvs/utils/erector-set/tmp/---bar,v
done
Checking in ---bar;
/cvs/utils/erector-set/tmp/---bar,v <-- ---bar
initial revision: 1.1
done
===
This causes real issues. Any time '---bar' is changed, you can't check in the
modification, unless you ALSO modify some other normal file.
--- End Message ---
Index: src/client.c
===================================================================
RCS file: /cvs/cvs/src/client.c,v
retrieving revision 1.1.1.5
diff -a -u -p -r1.1.1.5 client.c
--- src/client.c 22 Dec 2001 00:00:05 -0000 1.1.1.5
+++ src/client.c 25 Jan 2002 03:17:41 -0000
@@ -5602,6 +5602,13 @@ send_files (argc, argv, local, aflag, fl
int err;
/*
+ * If we're about to send file names we need to make sure cvs
+ * server does not interepret any file names beginning with dashes
+ * as options.
+ */
+ send_arg ("--");
+
+ /*
* aflag controls whether the tag/date is copied into the vers_ts.
* But we don't actually use it, so I don't think it matters what we pass
* for aflag here.
Index: src/rcscmds.c
===================================================================
RCS file: /cvs/cvs/src/rcscmds.c,v
retrieving revision 1.1.1.5
diff -a -u -p -r1.1.1.5 rcscmds.c
--- src/rcscmds.c 22 Dec 2001 00:00:06 -0000 1.1.1.5
+++ src/rcscmds.c 25 Jan 2002 03:27:31 -0000
@@ -308,6 +308,8 @@ RCS_merge(rcs, path, workfile, options,
call_diff_arg ("-L");
call_diff_arg (xrev2);
+ call_diff_arg ("--");
+
call_diff_arg (workfile);
call_diff_arg (tmp1);
call_diff_arg (tmp2);
@@ -581,6 +583,9 @@ diff_exec (file1, file2, label1, label2,
call_diff_arg (label1);
if (label2)
call_diff_arg (label2);
+
+ call_diff_arg ("--");
+
call_diff_arg (file1);
call_diff_arg (file2);
free (args);
@@ -630,6 +635,9 @@ diff_execv (file1, file2, label1, label2
call_diff_arg (label1);
if (label2)
call_diff_arg (label2);
+
+ call_diff_arg ("--");
+
call_diff_arg (file1);
call_diff_arg (file2);
free (args);