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

perforce plug in does not issue an error on a p4 sync error

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      perforce plug in does not issue an error on a p4 sync error

        Attachments

          Activity

          Hide
          keithgamd keith gallie added a comment -

          I believe this is where the problem is. p4 commands generally return an operating system true regardless of whether the command actually succeeded. If you use a -s and check the output for 'error' (beginning of line, etc) you will be able to detect whether a sync succeeded or not.

          http://kb.perforce.com/article/377/p4-client-error-handling

          src/main/java/com/tek42/perforce/parse//Workspace.java

          /**

          • Provides method to sync to a depot path and allows for any revision, changelist, label, etc.
          • to be appended to the path.
          • <p>
          • A force sync can be specified by passing true to forceSync.
          • @param path
          • The depot path to sync to. Perforce suffix for [revRange] is allowed.
          • @param forceSync
          • Should we force a sync to grab all files regardless of version on disk?
          • @return
          • A StringBuilder that contains the output of the p4 execution.
          • @throws PerforceException
            */
            public StringBuilder syncTo(String path, boolean forceSync) throws PerforceException {
            if(forceSync)
            Unknown macro: { StringBuilder response = getPerforceResponse(new String[] { getP4Exe(), "sync", "-f", path }); if(hitMax(response)){ throw new PerforceException("Hit perforce server limit while force syncing: " + response); } return response; }

            else

            Unknown macro: { StringBuilder response = getPerforceResponse(new String[] { getP4Exe(), "sync", path }); if(hitMax(response)){ throw new PerforceException("Hit perforce server limit while syncing: " + response); } return response; }

            }

          Show
          keithgamd keith gallie added a comment - I believe this is where the problem is. p4 commands generally return an operating system true regardless of whether the command actually succeeded. If you use a -s and check the output for 'error' (beginning of line, etc) you will be able to detect whether a sync succeeded or not. http://kb.perforce.com/article/377/p4-client-error-handling src/main/java/com/tek42/perforce/parse//Workspace.java /** Provides method to sync to a depot path and allows for any revision, changelist, label, etc. to be appended to the path. <p> A force sync can be specified by passing true to forceSync. @param path The depot path to sync to. Perforce suffix for [revRange] is allowed. @param forceSync Should we force a sync to grab all files regardless of version on disk? @return A StringBuilder that contains the output of the p4 execution. @throws PerforceException */ public StringBuilder syncTo(String path, boolean forceSync) throws PerforceException { if(forceSync) Unknown macro: { StringBuilder response = getPerforceResponse(new String[] { getP4Exe(), "sync", "-f", path }); if(hitMax(response)){ throw new PerforceException("Hit perforce server limit while force syncing: " + response); } return response; } else Unknown macro: { StringBuilder response = getPerforceResponse(new String[] { getP4Exe(), "sync", path }); if(hitMax(response)){ throw new PerforceException("Hit perforce server limit while syncing: " + response); } return response; } }
          Hide
          rpetti Rob Petti added a comment -

          What error are you hitting that is not being caught? The getPerforceResponse function checks for the most common errors and throws an exception as necessary.

          Show
          rpetti Rob Petti added a comment - What error are you hitting that is not being caught? The getPerforceResponse function checks for the most common errors and throws an exception as necessary.
          Hide
          keithgamd keith gallie added a comment -

          Below are our commands from a shell script we are running in parallel while we evaluate hudson/jenkins. Someone checked in a directory over a file of the same name.

          + /tool/pandora/.package/perforce-2009.2/bin/p4 -s sync -p ./...@199062
          + echo ' sync complete; checking status...'
          sync complete; checking status...
          + grep '^error: ' sync.output
          error: open for write: /tmp/nightly/2.0.X/scripts/jivaroD/.rex_release: Not a directory
          error: open for write: /tmp/nightly/2.0.X/scripts/jivaroD/jivaroD: Not a directory
          error: open for write: /tmp/nightly/2.0.X/scripts/jivaroD_wrapper/.rex_release: Not a directory
          error: open for write: /tmp/nightly/2.0.X/scripts/jivaroD_wrapper/jivaroD_wrapper: Not a directory

          Show
          keithgamd keith gallie added a comment - Below are our commands from a shell script we are running in parallel while we evaluate hudson/jenkins. Someone checked in a directory over a file of the same name. + /tool/pandora/.package/perforce-2009.2/bin/p4 -s sync -p ./...@199062 + echo ' sync complete; checking status...' sync complete; checking status... + grep '^error: ' sync.output error: open for write: /tmp/nightly/2.0.X/scripts/jivaroD/.rex_release: Not a directory error: open for write: /tmp/nightly/2.0.X/scripts/jivaroD/jivaroD: Not a directory error: open for write: /tmp/nightly/2.0.X/scripts/jivaroD_wrapper/.rex_release: Not a directory error: open for write: /tmp/nightly/2.0.X/scripts/jivaroD_wrapper/jivaroD_wrapper: Not a directory
          Hide
          rpetti Rob Petti added a comment -

          Perforce should really be handling that case properly, though I suppose adding error handling for it wouldn't hurt.

          Show
          rpetti Rob Petti added a comment - Perforce should really be handling that case properly, though I suppose adding error handling for it wouldn't hurt.
          Hide
          rpetti Rob Petti added a comment -

          Not critical.

          Show
          rpetti Rob Petti added a comment - Not critical.
          Hide
          rpetti Rob Petti added a comment -

          Fixed. Will be released with 1.2.3.

          Show
          rpetti Rob Petti added a comment - Fixed. Will be released with 1.2.3.

            People

            • Assignee:
              Unassigned
              Reporter:
              keithgamd keith gallie
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: