Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-29387

Cannot sync into workspaces with '@' in their path

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • p4-plugin
    • Jenkins 1.618
      Workflow 1.8
      P4 Plugin 1.2.4

      Attempting to sync into a workspace that contains '@' in the path fails:

      p4 client -i

      Error in client specification.
      Embedded special characters (*, %%, #, @) not allowed in 'd:\jenkins\workspace\workflow_test_parallel@2'.

      This is particularly an issue for workflow-plugin as it tends to append '@' to workspace paths such as the path used by the 'Store DSL script in SCM' ('@script'), and the second and later workspaces for a particular build script on a node ('@2', '@3', ...)

          [JENKINS-29387] Cannot sync into workspaces with '@' in their path

          Paul "TBBle" Hampson created issue -

          Joel Brown added a comment -

          Somewhat related: JENKINS-25242. Same issue with "@" in the path.

          Joel Brown added a comment - Somewhat related: JENKINS-25242 . Same issue with "@" in the path.

          A workaround is mentioned in JENKINS-14354, referenced from JENKINS-25242, is to change a system property to use a different specifier for the extra workspaces: -Dhudson.slaves.WorkspaceList=_.

          The current discussion in JENKINS-25242 indicates that this problem is also the reason for that issue, so when that is resolved, this issue will either be resolved or turn out to be a workflow-plugin issue (if it doesn't honour that system property for some reason).

          Paul "TBBle" Hampson added a comment - A workaround is mentioned in JENKINS-14354 , referenced from JENKINS-25242 , is to change a system property to use a different specifier for the extra workspaces: -Dhudson.slaves.WorkspaceList=_ . The current discussion in JENKINS-25242 indicates that this problem is also the reason for that issue, so when that is resolved, this issue will either be resolved or turn out to be a workflow-plugin issue (if it doesn't honour that system property for some reason).

          Code changed in jenkins
          User: Paul Allen
          Path:
          src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java
          http://jenkins-ci.org/commit/p4-plugin/f6727b45c5534741ed6f928b6dd583ef92a2f27f
          Log:
          Create a template workspace for parallel builds.

          If Jenkins attempts a parallel build it creates a workspace@2
          directory. This change creates a new template workspace (appended with
          .clone2) and substitutes the `@` to `%40` in the root path.

          JENKINS-29387

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Paul Allen Path: src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java http://jenkins-ci.org/commit/p4-plugin/f6727b45c5534741ed6f928b6dd583ef92a2f27f Log: Create a template workspace for parallel builds. If Jenkins attempts a parallel build it creates a workspace@2 directory. This change creates a new template workspace (appended with .clone2) and substitutes the `@` to `%40` in the root path. JENKINS-29387

          Paul Allen added a comment -

          Fixed 1.3.1

          Paul Allen added a comment - Fixed 1.3.1
          Paul Allen made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 164261 ] New: JNJira + In-Review [ 208994 ]
          Andrew Bayer made changes -
          Labels Original: workflow New: pipeline workflow
          Andrew Bayer made changes -
          Labels Original: pipeline workflow New: pipeline

          Jay Spang added a comment -

          p4paul sorry to bump a very old issue, but how can I use your fix when I'm using raw p4groovy to do more advanced stuff?

          I have a function called get_synced_changelist() that does exactly what the name implies. This code works fine except if the job runs on an executor other than 0. If that happens, Jenkins appends '@2'  to the workspace and p4groovy crashes when it tries to use that as the workspace root.

          Unless I'm missing something, I don't see any way to specify the client's root at the time of instantiation, so I don't know how to avoid this bug.

          Here's the code. The best way to repro this is to pin your job to a certain node, then Build it rapidly a few times (ensuring concurrent builds). Any build NOT on the first executor will fail.

           
          def get_synced_changelist(String p4_credential_name, String client_name, String p4_stream) {
              def ws = [$class: 'StreamWorkspaceImpl', charset: 'none', format: client_name, pinHost: false, streamName: p4_stream]
              def p4 = p4(credential: p4_credential_name, workspace: ws)
              changelist = p4.run( 'changes', '-m1', "@"+ p4.getClientName() )    
              return changelist[0].change
          }
           
          get_synced_changelist('p4tools', 'jenkins-${NODE_NAME}${JOB_NAME}${EXECUTOR_NUMBER}', '//depot/stream_name')
           
           
           
           

          Jay Spang added a comment - p4paul sorry to bump a very old issue, but how can I use your fix when I'm using raw p4groovy to do more advanced stuff? I have a function called get_synced_changelist()  that does exactly what the name implies. This code works fine  except  if the job runs on an executor other than 0. If that happens, Jenkins appends '@2'  to the workspace and p4groovy crashes when it tries to use that as the workspace root. Unless I'm missing something, I don't see any way to specify the client's root at the time of instantiation, so I don't know how to avoid this bug. Here's the code. The best way to repro this is to pin your job to a certain node, then Build it rapidly a few times (ensuring concurrent builds). Any build NOT on the first executor will fail.   def get_synced_changelist(String p4_credential_name, String client_name, String p4_stream) {     def ws = [$class: 'StreamWorkspaceImpl', charset: 'none', format: client_name, pinHost: false, streamName: p4_stream]     def p4 = p4(credential: p4_credential_name, workspace: ws)     changelist = p4.run( 'changes', '-m1', "@"+ p4.getClientName() )          return changelist [0] .change }   get_synced_changelist('p4tools', 'jenkins-${NODE_NAME} ${JOB_NAME} ${EXECUTOR_NUMBER}', '//depot/stream_name')        

            Unassigned Unassigned
            p_hampson Paul "TBBle" Hampson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: