Skip to content

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

@jenkins-infra-bot

Description

@jenkins-infra-bot

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.(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.


Originally reported by cowwoc, imported from: CommandInstaller assumes write access to installation directory
  • status: Open
  • priority: Major
  • component(s): core
  • label(s): newbie-friendly
  • resolution: Unresolved
  • votes: 0
  • watchers: 4
  • imported: 2025-11-24
Raw content of original issue

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions