{"record":{"id":"ccf9bd260bf06ea1","repo":"jordansissel/fpm","slug":"name-source-date-epoch-of-0-not-supported","errorCode":null,"errorMessage":"#{name}: source_date_epoch of 0 not supported.","messagePattern":"#(.+?): source_date_epoch of 0 not supported\\.","errorType":"validation","errorClass":"FPM::InvalidPackageConfiguration","httpStatus":null,"severity":"error","filePath":"lib/fpm/package/deb.rb","lineNumber":534,"sourceCode":"        logger.info(\"You gave --deb-shlibs but no --after-install, so \" \\\n                     \"I am adding an after-install script that runs \" \\\n                     \"ldconfig to update the system library cache\")\n        scripts[:after_install] = template(\"deb/ldconfig.sh.erb\").result(binding)\n      end\n      if !script?(:after_remove)\n        logger.info(\"You gave --deb-shlibs but no --after-remove, so \" \\\n                     \"I am adding an after-remove script that runs \" \\\n                     \"ldconfig to update the system library cache\")\n        scripts[:after_remove] = template(\"deb/ldconfig.sh.erb\").result(binding)\n      end\n    end\n\n    if attributes[:source_date_epoch].nil? and not attributes[:source_date_epoch_default].nil?\n      attributes[:source_date_epoch] = attributes[:source_date_epoch_default]\n    end\n    if attributes[:source_date_epoch] == \"0\"\n      logger.error(\"Alas, ruby's Zlib::GzipWriter does not support setting an mtime of zero.  Aborting.\")\n      raise FPM::InvalidPackageConfiguration, \"#{name}: source_date_epoch of 0 not supported.\"\n    end\n    if not attributes[:source_date_epoch].nil? and not ar_cmd_deterministic?\n      logger.error(\"Alas, could not find an ar that can handle -D option. Try installing recent gnu binutils. Aborting.\")\n      raise FPM::InvalidPackageConfiguration, \"#{name}: ar is insufficient to support source_date_epoch.\"\n    end\n    if not attributes[:source_date_epoch].nil? and not tar_cmd_supports_sort_names_and_set_mtime?\n      logger.error(\"Alas, could not find a tar that can set mtime and sort.  Try installing recent gnu tar. Aborting.\")\n      raise FPM::InvalidPackageConfiguration, \"#{name}: tar is insufficient to support source_date_epoch.\"\n    end\n\n    systemd_file_extensions = [\n        \".service\",\n        \".socket\",\n        \".device\",\n        \".mount\",\n        \".automount\",\n        \".swap\",\n        \".target\",","sourceCodeStart":516,"sourceCodeEnd":552,"githubUrl":"https://github.com/jordansissel/fpm/blob/b6d77ba72a560b687723376a0e5115c3a92634ad/lib/fpm/package/deb.rb#L516-L552","documentation":"When building a deb with reproducibility enabled, fpm refuses a source_date_epoch of exactly 0 because Ruby's Zlib::GzipWriter cannot store an mtime of zero in the gzip header of control.tar.gz/data.tar.gz. The check is a literal string comparison against '0' and raises FPM::InvalidPackageConfiguration before any tarball is written.","triggerScenarios":"Running fpm --deb output with --source-date-epoch 0, or with --source-date-epoch-default picking up SOURCE_DATE_EPOCH=0 from the environment (common in reproducible-builds CI that normalizes to the epoch). Any nonzero value passes this particular check.","commonSituations":"CI pipelines exporting SOURCE_DATE_EPOCH=0 to make builds deterministic; templates that copy dpkg's 1970-01-01 convention; wrappers that read the env var blindly and pass it through.","solutions":["Use a fixed nonzero timestamp instead: --source-date-epoch 1, or the project's real release date (e.g. the last commit timestamp)","Unset SOURCE_DATE_EPOCH=0 in the environment or stop mapping it to --source-date-epoch-default","If bit-identical output is required, pin any constant nonzero epoch consistently across builds"],"exampleFix":"# before\nSOURCE_DATE_EPOCH=0 fpm -s dir -t deb -n foo .\n# -> source_date_epoch of 0 not supported\n\n# after\nSOURCE_DATE_EPOCH=1 fpm -s dir -t deb -n foo .\n# or: fpm -s dir -t deb -n foo --source-date-epoch 1 .","handlingStrategy":"validation","validationCode":"epoch = ENV['SOURCE_DATE_EPOCH']\nif epoch == '0'\n  warn 'SOURCE_DATE_EPOCH=0 unsupported by fpm/gzip; using 1'\n  ENV['SOURCE_DATE_EPOCH'] = '1'\nend","typeGuard":"def usable_source_date_epoch?(value)\n  !value.nil? && value != '0' && value =~ /\\A\\d+\\z/\nend","tryCatchPattern":"begin\n  pkg.output(out)\nrescue FPM::InvalidPackageConfiguration => e\n  raise unless e.message =~ /source_date_epoch of 0/\n  pkg.attributes[:source_date_epoch] = '1'\n  retry\nend","preventionTips":["Never normalize SOURCE_DATE_EPOCH to 0 in fpm-based pipelines; use a fixed nonzero epoch (1 or the release commit date)","Sanitize env-provided epochs in wrappers before they reach --source-date-epoch-default","Document the zlib gzip mtime limitation for teams doing reproducible deb builds"],"tags":["fpm","deb","reproducible-builds","source-date-epoch","zlib","packaging"],"backgroundTag":"reproducible-build-timestamp-error","analyzedSha":"b6d77ba72a560b687723376a0e5115c3a92634ad","analyzedAt":"2026-08-21T16:39:02.570Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}