Syncing with Perforce on Linux/Unix/Bash fails
----------------------------------------------

                 Key: CONTINUUM-1402
                 URL: http://jira.codehaus.org/browse/CONTINUUM-1402
             Project: Continuum
          Issue Type: Bug
          Components: Integration - Maven 2, SCM
    Affects Versions: 1.1-beta-2
         Environment: Bash
            Reporter: Sebastian Annies
            Priority: Critical


When a client is created it is named:

E.g.{{monospaced}} 
sannies-sojus-MavenSCM-\opt\continuum-1.1-beta-3-SNAPSHOT\apps\continuum\webapp\WEB-INF\working-directory\6{{monospaced}}

that is ok, but now comes the sync command and uses following commandline

{{monospaced}}
/bin/bash -c "p4 -d 
/opt/continuum-1.1-beta-3-SNAPSHOT/apps/continuum/webapp/WEB-INF/working-directory/1
 
-cbackground-sojus-MavenSCM-\opt\continuum-1.1-beta-3-SNAPSHOT\apps\continuum\webapp\WEB-INF\working-directory\1
 sync"
{{monospaced}}

The Bash now removes the backslashes in the client name! The result is that the 
client is not existent and perforce returns with an error. 

I think continuum does everything allright but we need the ticket here to be 
reminded to switch to a new plexus-utils or maven-scm if it is fixed there. 

The Problem starts in 'PerforceCheckOutCommand':
{{monospaced}}

    public static Commandline createCommandLine( PerforceScmProviderRepository 
repo, File workingDirectory,
                                                 ScmVersion version, String 
specname )
    {
        Commandline command = PerforceScmProvider.createP4Command( repo, 
workingDirectory );
{color:red} 
        command.createArgument().setValue( "-c" + specname  );
{color}
        command.createArgument().setValue( "sync" );

        // Use a simple heuristic to determine if we should use the Force flag
        // on sync.  Forcing sync is a HUGE performance hit but is required in
        // rare instances where source is somehow deleted.  If the target
        // directory is completely empty, assume a force is required.  If
        // not empty, we assume a previous checkout was already done and a 
normal
        // sync will suffice.
        // SCM-110
        String[] files = workingDirectory.list();
        if ( files == null || files.length == 0 )
        {
            // We need to force so checkout to an empty directory will work.
            command.createArgument().setValue( "-f" );
        }

        // Not sure what to do here. I'm unclear whether we should be
        // sync'ing each file individually to the label or just sync the
        // entire contents of the workingDir. I'm going to assume the
        // latter until the exact semantics are clearer.
        if ( version != null && StringUtils.isNotEmpty( version.getName() ) )
        {
            command.createArgument().setValue( "@" + version.getName() );
        }
        return command;
{{monospaced}}

The {{monospaced}}specname  {{monospaced}} contains the backslashes and is 
these are neither escaped nor quoted! Hmm ... Is that a job that the 
CommandLine should handle? I think so!

The next thing I will do is to file an issue at plexus-utils and link the 
issues.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to