From: SourceForge.net <no...@so...> - 2010-08-13 07:37:28
|
Bugs item #3039373, was opened at 2010-08-04 13:51 Message generated for change (Settings changed) made by eraonel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=460297&aid=3039373&group_id=50595 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: eclipse-ccase Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Fredrik (linqon) >Assigned to: Mikael Petterson (eraonel) Summary: Cannot handle files with brackets, "[]" Initial Comment: If you have a file in a clearcase project that contains brackets, [ ], it is not recognized as a clearcase file and you cannot use the plugin to check in/out the file. No icon is placed on the file. Windows XP Dynamic view Version 2.2.3.v201005271244 Eclipse: Helios Release (3.6.0) Build id: 20100527-0614 Clearcase: ClearCase version 2003.06.00 (Fri Apr 18 13:06:18 2003) clearcase patch p2003.06.01 (Fri Sep 5 11:59:28 2003) clearcase patch p2003.06.12 (Fri Nov 7 11:59:28 2003) clearcase patch p2003.06.14 (Fri Oct 8 11:59:28 2004) How to reproduce: Create an clearcase element named "bracket[0]" in a eclipse project. Associate it with clearcase. There is no icon on the new file. No CC operations are available for the file. ---------------------------------------------------------------------- Comment By: Mikael Petterson (eraonel) Date: 2010-08-13 07:40 Message: Hi, I removed the patch since it did not solve problem. The initial problem was when we had brackets in name and no space in path. Is it not possible to add a check where we check for spaces in SingleProcessCommandLauncher.java If we have brackets then we add quotation marks. if (command[i].contains(" ") || command.contains("[") | or command.contains("]") { //add quotation marks cmd += "\"" + command[i] + "\" "; } //mike ---------------------------------------------------------------------- Comment By: Mattias Andersson (eplatti) Date: 2010-08-12 13:52 Message: I did not get it to work, the following was written in the log: >>> ls -long -d ""N:\myvob\test\name with space"" >>> ls -long -d N:\myvob\test\name* >>> ls -long -d N:\myvob\test\name1 >>> ls -long -d N:\myvob\test\name[ >>> ls -long -d N:\myvob\test I added a patch bellow (I could attach it to the bug) that shows how I was thinking. However when I tested it I realize that Eclipse does not handle path names with *?, (quite reasonable). So the patch actually only fixes the bracket characters. Index: src/commandline/net/sourceforge/clearcase/ClearCaseCLIImpl.java =================================================================== RCS file: /cvsroot/clearcase-java/net.sourceforge.clearcase/src/commandline/net/sourceforge/clearcase/ClearCaseCLIImpl.java,v retrieving revision 1.77 diff -u -r1.77 ClearCaseCLIImpl.java --- src/commandline/net/sourceforge/clearcase/ClearCaseCLIImpl.java 28 Jul 2010 14:58:13 -0000 1.77 +++ src/commandline/net/sourceforge/clearcase/ClearCaseCLIImpl.java 12 Aug 2010 11:17:19 -0000 @@ -668,7 +668,7 @@ } checkInterface(); - String[] output = buildAndExecuteCommand(command, options, elements, + String[] output = buildAndExecuteCommand(command, options, quote(elements), operationListener); ClearCaseElementState[] states; if (output != null) { @@ -685,6 +685,14 @@ return states; } + protected static String [] quote(final String list[]){ + ArrayList<String> res = new ArrayList<String>(list.length); + for (String element : list) { + res.add('"' + element + '"'); + } + return res.toArray(new String[list.length]); + } + private String[] buildAndExecuteCommand(final String command, final String[] options, final String[] elements, final OperationListener operationListener) { @@ -895,7 +903,7 @@ final String[] options = Utils.toArray(optionsList); return ccOperation("ls", options, elements, null, operationListener); } - + /* * (non-Javadoc) * Index: src/commandline/net/sourceforge/clearcase/commandline/SingleProcessCommandLauncher.java =================================================================== RCS file: /cvsroot/clearcase-java/net.sourceforge.clearcase/src/commandline/net/sourceforge/clearcase/commandline/SingleProcessCommandLauncher.java,v retrieving revision 1.11 diff -u -r1.11 SingleProcessCommandLauncher.java --- src/commandline/net/sourceforge/clearcase/commandline/SingleProcessCommandLauncher.java 28 Jul 2010 12:00:06 -0000 1.11 +++ src/commandline/net/sourceforge/clearcase/commandline/SingleProcessCommandLauncher.java 12 Aug 2010 11:17:19 -0000 @@ -305,7 +305,9 @@ if (commentIndex == i) { cmd += "-c "; } - if (command[i].contains(" ")) { + if (command[i].contains(" ") && + // Ignore already quoted strings. + !(command[i].charAt(0) == '"' && command[i].charAt(command[i].length()-1) == '"')) { cmd += "\"" + command[i] + "\" "; } else { if (command[i].equals("-c")) { ---------------------------------------------------------------------- Comment By: Mikael Petterson (eraonel) Date: 2010-08-12 08:37 Message: Hi, I have uploaded a patch. Please try and let me know if it solves the problem. //mike ---------------------------------------------------------------------- Comment By: Mattias Andersson (eplatti) Date: 2010-08-11 10:03 Message: Hi Mike Yes, brackets is a part of ClearCase wildcards, see ct man wildcards_ccase it might be harsh to quote them in SingleProcessCommandLauncher as someone might want to use it as wildcards, the same applies for ? and * I guess. Would it be better to always quote the path in ClearCaseCLIImpl#getElementStates where the ls command is issued? The problem is that paths with spaces would be quoted a second time by SingleProcessCommandLauncher. Maybe SingleProcessCommandLauncher could skip the quotes of paths with spaces if the path is already quoted. /Mattias ---------------------------------------------------------------------- Comment By: Mikael Petterson (eraonel) Date: 2010-08-11 07:55 Message: Hi mattias, To summarize your conclusion. So it seems to that when you have a space in the path: >>> ls -long -d "N:\myvob\test elem\funny\funny[0]" <<< version N:\myvob\test elem\funny\funny[0]@@\main\dtedev\1 Rule: element ...\test elem\... \main\dtedev\LATEST It works with brackets but if you have ( no space in path) then it won't work: >>> ls -long -d N:\myvob\set1\bracket[0] <<# cleartool: Error: No match for wildcard: "ls -long -d N:\myvob\set1\bracket[0]". <<<<<< Command 8 returned status 1 << duration: 0 ms s=1281439368273 e=1281439368273 MatchStrategyComposite.check() hit: NONE If so then we have to make sure that brackets also will add a quote. Or what do you think? br, //mike ---------------------------------------------------------------------- Comment By: Mattias Andersson (eplatti) Date: 2010-08-10 13:53 Message: I could recreate the problem. It works if the path contains a space. In that case the path to the cleartool ls command is quoted by the SingleProcessCommandLauncher. The funny thing was that I could execute the command from the Windows shell but I guess that the shell adds the quotes for me. The path to element funny contains spaces and is quoted, but not the path to bracket. >>> ls -long -d N:\myvob\set1\bracket[0] <<# cleartool: Error: No match for wildcard: "ls -long -d N:\myvob\set1\bracket[0]". <<<<<< Command 8 returned status 1 << duration: 0 ms s=1281439368273 e=1281439368273 MatchStrategyComposite.check() hit: NONE >>> ls -long -d P:\eclipse\workspaces\runtime-EclipseApplication\Test\.project <<# cleartool: Error: Pathname is not within a VOB: "P:\eclipse\workspaces\runtime-EclipseApplication\Test\.project" <<<<<< Command 9 returned status 1 << duration: 15 ms s=1281439655895 e=1281439655910 MatchStrategyComposite.check() hit: NONE >>> ls -long -d "N:\myvob\test elem\funny\funny[0]" <<< version N:\myvob\test elem\funny\funny[0]@@\main\dtedev\1 Rule: element ...\test elem\... \main\dtedev\LATEST ---------------------------------------------------------------------- Comment By: Mikael Petterson (eraonel) Date: 2010-08-09 18:23 Message: Hi, Is it possible to add a file with brackets in the name from cleartool command line? I have no access to clearcase at the moment. Did you get something in the Eclipse log ${workspace}/.metadata/.log when you perform the "add" operation. br, //mike ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=460297&aid=3039373&group_id=50595 |