{"record":{"id":"cacf4ebedb4df133","repo":"jordansissel/fpm","slug":"package-version-version-includes-dashes-con","errorCode":null,"errorMessage":"Package version '#{@version}' includes dashes, converting to underscores","messagePattern":"Package version '#(.+?)' includes dashes, converting to underscores","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"lib/fpm/package/rpm.rb","lineNumber":640,"sourceCode":"    end\n  end # def prefix\n\n  def build_sub_dir\n    return \"BUILD\"\n    #return File.join(\"BUILD\", prefix)\n  end # def build_sub_dir\n\n  def summary\n    if !attributes[:rpm_summary]\n      return @description.split(\"\\n\").find { |line| !line.strip.empty? } || \"_\"\n    end\n\n    return attributes[:rpm_summary]\n  end # def summary\n\n  def version\n    if @version.kind_of?(String) and @version.include?(\"-\")\n      logger.warn(\"Package version '#{@version}' includes dashes, converting\" \\\n                   \" to underscores\")\n      @version = @version.gsub(/-/, \"_\")\n    end\n\n    return @version\n  end\n\n  # The default epoch value must be nil, see #381\n  def epoch\n    return @epoch if @epoch.is_a?(Numeric)\n\n    if @epoch.nil? or @epoch.empty?\n      return nil\n    end\n\n    return @epoch\n  end # def epoch\n","sourceCodeStart":622,"sourceCodeEnd":658,"githubUrl":"https://github.com/jordansissel/fpm/blob/b6d77ba72a560b687723376a0e5115c3a92634ad/lib/fpm/package/rpm.rb#L622-L658","documentation":"RPM's Version field must not contain dashes; rpmbuild rejects them. When the rpm output target sees a String version containing '-', it rewrites every dash to an underscore in place and logs this warning. The package still builds, but its version metadata differs from the string you passed.","triggerScenarios":"Building an rpm with `--version 1.2.3-beta.1`, or with `--version $(git describe --tags)` which yields '1.2.3-14-g0abc1' that then becomes '1.2.3_14_g0abc1'.","commonSituations":"CI pipelines feeding git describe or npm/python prerelease versions straight into fpm; downstream tools comparing versions mismatch because the published rpm carries underscores where the tag had dashes.","solutions":["Strip or replace dashes before invoking fpm: `VER=${VER//-/_}`","Split semver prereleases the RPM way: `--version 1.2.3 --iteration 0.1.beta1`","Derive the version from the tag only, e.g. `git describe --tags --abbrev=0`, not the full describe string"],"exampleFix":"# before\nfpm -s dir -t rpm -n app -v $(git describe --tags) .\n\n# after\nfpm -s dir -t rpm -n app -v $(git describe --tags --abbrev=0) --iteration $(git rev-list --count HEAD) .","handlingStrategy":"validation","validationCode":"VER=\"${VER//-/_}\"\nif [[ \"$VER\" == *-* ]]; then\n  echo \"version contains dashes after sanitize: $VER\" >&2\n  exit 1\nfi","typeGuard":"def rpm_safe_version?(str)\n  str.is_a?(String) && !str.include?('-') && !str.empty?\nend","tryCatchPattern":null,"preventionTips":["Use `git describe --tags --abbrev=0` (tag only) for --version, and put the commit count into --iteration","Put semver prerelease suffixes in --iteration with underscores, per RPM convention","Assert the published rpm's %{VERSION} matches the intended tag in CI"],"tags":["rpm","version","rpmbuild","git-describe","sanitization"],"backgroundTag":"invalid-rpm-metadata","analyzedSha":"b6d77ba72a560b687723376a0e5115c3a92634ad","analyzedAt":"2026-08-21T16:39:02.570Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}