jordansissel/fpm · error · FPM::InvalidPackageConfiguration

A source directory cannot be the root of your temporary dire

Error message

A source directory cannot be the root of your temporary directory (#{::Dir.tmpdir}). fpm uses the temporary directory to stage files during packaging, so this setting would have caused fpm to loop creating staging directories and copying them into your package! Oops! If you are confused, maybe you could check your TMPDIR, TMP, or TEMP environment variables?

What it means

Error "A source directory cannot be the root of your temporary directory (#{::Dir.tmpdir}). fpm uses the temporary directory to stage files during packaging, so this setting would have caused fpm to loop creating staging directories and copying them into your package! Oops! If you are confused, maybe you could check your TMPDIR, TMP, or TEMP environment variables?" thrown in jordansissel/fpm.

Source

Thrown at lib/fpm/package/dir.rb:128

  # Copy a file or directory to a destination
  #
  # This is special because it respects the full path of the source.
  # Aditionally, hardlinks will be used instead of copies.
  #
  # Example:
  #
  #     clone("/tmp/hello/world", "/tmp/example")
  #
  # The above will copy, recursively, /tmp/hello/world into
  # /tmp/example/hello/world
  def clone(source, destination)
    logger.debug("Cloning path", :source => source, :destination => destination)
    # Edge case check; abort if the temporary directory is the source.
    # If the temporary dir is the same path as the source, it causes
    # fpm to recursively (and forever) copy the staging directory by
    # accident (#542).
    if File.expand_path(source) == File.expand_path(::Dir.tmpdir)
      raise FPM::InvalidPackageConfiguration,
        "A source directory cannot be the root of your temporary " \
        "directory (#{::Dir.tmpdir}). fpm uses the temporary directory " \
        "to stage files during packaging, so this setting would have " \
        "caused fpm to loop creating staging directories and copying " \
        "them into your package! Oops! If you are confused, maybe you could " \
        "check your TMPDIR, TMP, or TEMP environment variables?"
    end

    # For single file copies, permit file destinations
    fileinfo = File.lstat(source)
    destination_is_directory = File.directory?(destination)
    if fileinfo.file? && !destination_is_directory
      if destination[-1,1] == "/"
        copy(source, File.join(destination, source))
      else
        copy(source, destination)
      end
    elsif fileinfo.symlink?

View on GitHub (pinned to b6d77ba72a)

When it happens

Trigger: Thrown at lib/fpm/package/dir.rb:128 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jordansissel/fpm@b6d77ba72a (2026-08-21). Data as JSON: /api/errors/7b963f00bf0d1b15. Report an issue: GitHub.