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

Bitbucket Push and Pull Request plugin hijacks System.err

      As seen in JENKINS-67900, the Bitbucket Push and Pull Request plugin replaces System.err (Oracle javadoc) with a PrintStream that redirects all output to the logger of io.jenkins.plugins.bitbucketpushandpullrequest.common.BitBucketPPRUtils, even if the output originally had nothing to do with this plugin. That prevents the output from going to the original error log file and misleads the user into believing that the logged error was somehow caused by this plugin.

      The errors are logged by the PrintStream created by BitBucketPPRUtils.createLoggingProxyForErrors. Static initialization blocks in BitBucketPPRJobProbe, BitBucketPPRTrigger, and BitBucketPPREnvironmentContributor set that PrintStream as the System.err stream. The original System.err stream is lost.

          [JENKINS-67917] Bitbucket Push and Pull Request plugin hijacks System.err

          Kalle Niemitalo created issue -
          Kalle Niemitalo made changes -
          Link New: This issue relates to JENKINS-67900 [ JENKINS-67900 ]
          Kalle Niemitalo made changes -
          Summary Original: Bitbucket Push and Pull Request plugin hijacks system.err New: Bitbucket Push and Pull Request plugin hijacks System.err
          Kalle Niemitalo made changes -
          Description Original: As seen in JENKINS-67900, the Bitbucket Push and Pull Request plugin replaces System.err ([Oracle javadoc|https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/System.html#err]) with a PrintStream that redirects all output it to the logger of io.jenkins.plugins.bitbucketpushandpullrequest.common.BitBucketPPRUtils, even if the output originally had nothing to do with this plugin. That prevents the output from going to the original error log file and misleads the user into believing that the logged error was somehow caused by this plugin.

          The errors are logged by the PrintStream created by [BitBucketPPRUtils.createLoggingProxyForErrors|https://github.com/jenkinsci/bitbucket-push-and-pull-request-plugin/blob/ea1cd9533e93ac9e8a6908acdfb5b2521b2bb7af/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/common/BitBucketPPRUtils.java#L93-L103]. Static initialization blocks in [BitBucketPPRJobProbe|https://github.com/jenkinsci/bitbucket-push-and-pull-request-plugin/blob/ea1cd9533e93ac9e8a6908acdfb5b2521b2bb7af/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/BitBucketPPRJobProbe.java#L67-L69], [BitBucketPPRTrigger|https://github.com/jenkinsci/bitbucket-push-and-pull-request-plugin/blob/ea1cd9533e93ac9e8a6908acdfb5b2521b2bb7af/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/BitBucketPPRTrigger.java#L94-L96], and [BitBucketPPREnvironmentContributor|https://github.com/jenkinsci/bitbucket-push-and-pull-request-plugin/blob/ea1cd9533e93ac9e8a6908acdfb5b2521b2bb7af/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/environment/BitBucketPPREnvironmentContributor.java#L73-L75] set that PrintStream as the System.err stream. The original System.err stream is lost.
          New: As seen in JENKINS-67900, the Bitbucket Push and Pull Request plugin replaces System.err ([Oracle javadoc|https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/System.html#err]) with a PrintStream that redirects all output to the logger of io.jenkins.plugins.bitbucketpushandpullrequest.common.BitBucketPPRUtils, even if the output originally had nothing to do with this plugin. That prevents the output from going to the original error log file and misleads the user into believing that the logged error was somehow caused by this plugin.

          The errors are logged by the PrintStream created by [BitBucketPPRUtils.createLoggingProxyForErrors|https://github.com/jenkinsci/bitbucket-push-and-pull-request-plugin/blob/ea1cd9533e93ac9e8a6908acdfb5b2521b2bb7af/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/common/BitBucketPPRUtils.java#L93-L103]. Static initialization blocks in [BitBucketPPRJobProbe|https://github.com/jenkinsci/bitbucket-push-and-pull-request-plugin/blob/ea1cd9533e93ac9e8a6908acdfb5b2521b2bb7af/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/BitBucketPPRJobProbe.java#L67-L69], [BitBucketPPRTrigger|https://github.com/jenkinsci/bitbucket-push-and-pull-request-plugin/blob/ea1cd9533e93ac9e8a6908acdfb5b2521b2bb7af/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/BitBucketPPRTrigger.java#L94-L96], and [BitBucketPPREnvironmentContributor|https://github.com/jenkinsci/bitbucket-push-and-pull-request-plugin/blob/ea1cd9533e93ac9e8a6908acdfb5b2521b2bb7af/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/environment/BitBucketPPREnvironmentContributor.java#L73-L75] set that PrintStream as the System.err stream. The original System.err stream is lost.
          Christian Del Monte made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Christian Del Monte made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]

          Fixed in v2.8.2-beta-1

          Christian Del Monte added a comment - Fixed in v2.8.2-beta-1

            cdelmonte Christian Del Monte
            kon Kalle Niemitalo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: