Bug 149683 - [Operations] CVS cannot delete files beginning with -
Summary: [Operations] CVS cannot delete files beginning with -
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: CVS (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M1   Edit
Assignee: platform-cvs-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, helpwanted
Depends on:
Blocks:
 
Reported: 2006-07-05 11:01 EDT by Bill Higgins CLA
Modified: 2007-08-07 10:56 EDT (History)
3 users (show)

See Also:


Attachments
Fix (2.84 KB, patch)
2007-05-21 04:29 EDT, Krzysztof Daniel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bill Higgins CLA 2006-07-05 11:01:35 EDT
I use a third party Ajax package (Dojo) which has a file called -.gif.  Basically once I commit this file to CVS on Linux, I am unable to delete and commit the delete because the diff fails.  This is because dash (-) is a metacharacter on the Linux file system (signals a command switch) and the remote commands seem not to be dealing with it.

Steps to reproduce:
--------------------------------------------------------------------------------
1)  Connect to a CVS repository stored on Linux
2)  In a shared project, create a file called  -whatever
3)  Commit the new file
4)  Delete the file -whatever in your workspace
5)  Try to commit the deletion, you get the following error:

    The server reported an error while performing the "cvs commit" command.

    com.ibm.jsdt.core: diff: invalid option -- m
    com.ibm.jsdt.core: cvs server: Try `diff --help' for more information.
    com.ibm.jsdt.core: cvs [server aborted]: error diffing -whatever

The manual workaround is to log into the Linux box, cd to the directory containing the -whatever file, and performing the command:  rm ./-whatever

The ./ (current directory) syntax avoids dealing with the dash (-) metacharacter.
Comment 1 Michael Valenta CLA 2006-07-05 11:07:35 EDT
How did you commit the file? Did you use the CVS command line (i.e. I get an error from the server when I try to commit such a file from within Eclipse)? Can you delete the file using the command line client as well?
Comment 2 Bill Higgins CLA 2006-07-05 11:13:56 EDT
I successfully committed the file using the Eclipse UI (right-click file, Commit).  I've never used the CVS command-line so I haven't tried this and would prefer not to learn if possible (after all, the Eclipse/CVS GUI integration is SOOOOO NICE,  how could I ever use a command line again <g>)
Comment 3 Michael Valenta CLA 2006-07-14 10:34:54 EDT
The error is coming from the server. Either the server doesn't support it or, what is more likely is that we need to escape the - in some form when we send the file name argument. We should be able to find out by getting the log from a command line operation. However, we wont have time to look at this in 3.3.
Comment 4 Krzysztof Daniel CLA 2007-05-14 09:18:22 EDT
Michael, for me it is server error. I have search the cvs manual, and have found that some commands have additional clues for handling files placed after the file name. f.e.
"FileName -kb"
means that specified file should be treated as binary one.

I have tried to escape the '-' with "\-" but the result always remains the same - invalid option.

I think it is CVS bug.
Comment 5 Michael Valenta CLA 2007-05-14 15:47:13 EDT
What you need to do is see what happens when you use only the command line client. If you can commit the file and delete the file using the command line client then we should be able to do the same things from within Eclipse.
Comment 6 Krzysztof Daniel CLA 2007-05-15 05:20:18 EDT
On CVSNT, you cannot even add such a file to the repository.

I have dig through the clientserver protocol, and there is no single word about escaping filenames.

if I have a sec, I will try to capture cvs command client (that works pretty well) trafic and see, if there are any differences.
Comment 7 Michael Valenta CLA 2007-05-15 09:11:59 EDT
Do you have access to a Linux box? It would be better to test with the *nix CVS. While the behavior of CVSNT is close to the standard CVS server, it is not the same, especially in the area of supported characters in file names.
Comment 8 Krzysztof Daniel CLA 2007-05-21 04:29:37 EDT
Created attachment 67946 [details]
Fix

I have found escape sequence - it is "./".

Added in two places, tested for commit, synchronize, update and remove - works well.
Comment 9 Michael Valenta CLA 2007-06-21 10:56:10 EDT
Patch released to HEAD
Comment 10 Tomasz Zarna CLA 2007-08-07 06:19:20 EDT
Verified in I20070806-1800. It works even for nasty-named files and folders