Minus/Hyphen and Colon characters (GNU Coreutils 9.0)

From Get docs
Coreutils/docs/latest/Minus 002fHyphen-and-Colon-characters


30.3.1 Minus/Hyphen ‘-’ and Colon ‘:’ characters

In Debian’s version string syntax the version consists of three parts:

[epoch:]upstream_version[-debian_revision]

The epoch and debian_revision parts are optional.

Example of such version strings:

60.7.2esr-1~deb9u1
52.9.0esr-1~deb9u1
1:2.3.4-1+b2
327-2
1:1.0.13-3
2:1.19.2-1+deb9u5

If the debian_revision part is not present, hyphen characters ‘-’ are not allowed. If epoch is not present, colons ‘:’ are not allowed.

If these parts are present, hyphen and/or colons can appear only once in valid Debian version strings.

In GNU coreutils, such restrictions are not reasonable (a file name can have many hyphens, a line of text can have many colons).

As a result, in GNU coreutils hyphens and colons are treated exactly like all other punctuation characters (i.e., they are sorted after letters. See Punctuation Characters above).

In Debian, these characters are treated differently than in coreutils: a version string with hyphen will sort before similar strings without hyphens.

Compare:

$ touch   abb   ab-cd

$ ls -v -1
abb
ab-cd

With Debian’s dpkg they will be listed as ab-cd first and abb second.

For further technical details see bug35939.