Uploaded image for project: 'Continuum'
  1. Continuum
  2. CONTINUUM-1402

Syncing with Perforce on Linux/Unix/Bash fails

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.1-beta-2
    • 1.2.2
    • Integration - Maven 2, SCM
    • None
    • Bash

    Description

      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 );

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sannies Sebastian Annies
              Votes:
              4 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: