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

CommandInstaller assumes write access to installation directory

      The Mercurial incorrectly assumes write-access to the Mercurial installation directory, triggering the following exception:

      hudson.util.IOException2: Failed to create a temp file on /usr
      	at hudson.FilePath.createTextTempFile(FilePath.java:1163)
      	at hudson.FilePath.createTextTempFile(FilePath.java:1114)
      	at hudson.tools.CommandInstaller.performInstallation(CommandInstaller.java:82)
      	at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:61)
      	at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:107)
      	at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:203)
      	at hudson.plugins.mercurial.MercurialInstallation.forNode(MercurialInstallation.java:103)
      	at hudson.plugins.mercurial.MercurialSCM.findHgExe(MercurialSCM.java:201)
      	at hudson.plugins.mercurial.HgExe.<init>(HgExe.java:80)
      	at hudson.plugins.mercurial.MercurialSCM.clone(MercurialSCM.java:554)
      	at hudson.plugins.mercurial.MercurialSCM.checkout(MercurialSCM.java:389)
      	at hudson.model.AbstractProject.checkout(AbstractProject.java:1324)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676)
      	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581)
      	at hudson.model.Run.execute(Run.java:1518)
      	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:236)
      Caused by: hudson.util.IOException2: remote file operation failed: /usr at hudson.remoting.Channel@26528fa4:Ubuntu 12.04
      	at hudson.FilePath.act(FilePath.java:848)
      	at hudson.FilePath.act(FilePath.java:825)
      	at hudson.FilePath.createTextTempFile(FilePath.java:1141)
      	... 18 more
      

      My configuration is as follows:

      Installation directory = /usr
      Executable = INSTALLATION/bin/hg
      Installation Automatically using command: "sudo apt-get install mercurial"

      Jenkin's user does not have general access to /usr, nor to "sudo". It only has executable permissions in /usr/bin and "sudoers" permission to "apt-get".

      Expected behavior: write temporary files into the path specified by the "java.io.tmpdir" system property.

          [JENKINS-16005] CommandInstaller assumes write access to installation directory

          cowwoc added a comment -

          I forgot to mention, my environment is Ubuntu 12.04, 64-bit edition.

          cowwoc added a comment - I forgot to mention, my environment is Ubuntu 12.04, 64-bit edition.

          cowwoc added a comment -

          Workaround: Set "Installation directory" to Jenkins' home directory (which we have write access to) and "Tool Home" remains pointed to /usr.

          PS: What's the difference between "Installation directory" and "Tool Home"? There is no help tooltip for "Installation directory".

          cowwoc added a comment - Workaround: Set "Installation directory" to Jenkins' home directory (which we have write access to) and "Tool Home" remains pointed to /usr. PS: What's the difference between "Installation directory" and "Tool Home"? There is no help tooltip for "Installation directory".

          Jesse Glick added a comment -

          The bug is actually in CommandInstaller.performInstallation, which assumes that it can use the tool home as a temporary directory—which is normally a safe assumption, but not when sudo or the like is being used to create files. Should just use the system temp directory.

          Jesse Glick added a comment - The bug is actually in CommandInstaller.performInstallation , which assumes that it can use the tool home as a temporary directory—which is normally a safe assumption, but not when sudo or the like is being used to create files. Should just use the system temp directory.

          Jesse Glick added a comment -

          If you click Install automatically then Installation directory disappears so I am not sure why you have it set—Installation directory only makes sense if you are not having Jenkins perform the installation.

          It is Tool Home which should be set to /usr (or just set Executable to /usr/bin/hg and leave Tool Home blank).

          Jesse Glick added a comment - If you click Install automatically then Installation directory disappears so I am not sure why you have it set— Installation directory only makes sense if you are not having Jenkins perform the installation. It is Tool Home which should be set to /usr (or just set Executable to /usr/bin/hg and leave Tool Home blank).

          cowwoc added a comment -

          >If you click Install automatically then Installation directory disappears so I am not sure why you have it set

          I am using Hudson 1.492 and this isn't the case. Selecting "install automatically" does not cause the "installation directory" field to become hidden. Should I file an additional bug report for this?

          cowwoc added a comment - >If you click Install automatically then Installation directory disappears so I am not sure why you have it set I am using Hudson 1.492 and this isn't the case. Selecting "install automatically" does not cause the "installation directory" field to become hidden. Should I file an additional bug report for this?

          Jesse Glick added a comment -

          It worked when I tried in 1.424 (baseline for the plugin), so if it is not working in 1.492 then that sounds like a regression which ought to be filed.

          Jesse Glick added a comment - It worked when I tried in 1.424 (baseline for the plugin), so if it is not working in 1.492 then that sounds like a regression which ought to be filed.

          cowwoc added a comment -

          cowwoc added a comment - Filed JENKINS-16022 .

          Daniel Beck added a comment -

          Given that JENKINS-16022 cannot be reproduced with recent Jenkins and Mercurial plugin, this issue should also be obsolete.

          Daniel Beck added a comment - Given that JENKINS-16022 cannot be reproduced with recent Jenkins and Mercurial plugin, this issue should also be obsolete.

          Jesse Glick added a comment -

          I do not think so; JENKINS-16022 was a side issue. This problem is distinct and I think the bug summary reflects it properly.

          Jesse Glick added a comment - I do not think so; JENKINS-16022 was a side issue. This problem is distinct and I think the bug summary reflects it properly.

          Daniel Beck added a comment - - edited

          Right, I misread the issue description. My apologies.

          Issue is in core at AbstractCommandInstaller.performInstallation() line 76

          Daniel Beck added a comment - - edited Right, I misread the issue description. My apologies. Issue is in core at AbstractCommandInstaller.performInstallation() line 76

            Unassigned Unassigned
            cowwoc cowwoc
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: