In a Debian archive file, the package name and the version string is typically separated by an underscore, for instance foo-bar_1.2.3.tar.gz. The top directory in the archive, on the other hand, has a hyphen instead of an underscore, for instance foo-bar-1.2.3. What is the reason for this and where is this convention described?

  • 1
    @roaima this question is about the use of underscore as a separator in package filenames v. hyphen inside the tarball, not about the difference between hyphen and underscore as separators in package filenames. – Stephen Kitt May 8 '17 at 14:49
  • @roaima What exactly is unclear? – August Karlstrom May 8 '17 at 17:30
  • 1
    @Kusalananda Not a dupe. The question clearly (to me) compares underscores in the package name and the version string to hyphens in the top directory in the archive. StephenKitt's comment mentions this too. – Sparhawk May 9 '17 at 3:49

It's very helpful for the names of the .tar.gz and other files that make up the Debian source package to be uniform, since they end up installed on mirror sites in a fixed structure. Here, an underscore is used in order to remove ambiguity: hyphens are permitted in both the package name and the version, so if a hyphen were also used as the separator then it wouldn't be clear which was which. The naming is described (non-normatively) in an appendix to the Debian Policy Manual, although some of the details of which files form part of source packages are out of date in that appendix and dpkg-source(1) is a better reference there.

I don't recall ever seeing a clear reason for why dpkg-source unpacks source packages to <package>-<upstream_version> rather than to <package>_<upstream_version>, although my best guess is that it was simply because that was the usual convention for how tarballs distributed by upstream maintainers would unpack at the time dpkg-source was written (and to a large extent still is), so it made things look least surprising.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.