Changes between Initial Version and Version 1 of WhenToUseTheStupidTildeInVersionNumbers


Ignore:
Timestamp:
03/12/11 20:07:32 (13 years ago)
Author:
jdreed
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WhenToUseTheStupidTildeInVersionNumbers

    v1 v1  
     1When specifying version numbers, such as in `dpkg --compare-versions` or the various `control` fields (e.g. `Depends:`, `Conflicts:`, etc), you may notice that in some cases there is a tilde after the version number (e.g. `1.4~`) and in some cases there isn't. 
     2 
     3According to [http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version Debian Policy]: 
     4 
     5  The lexical comparison is a comparison of ASCII values modified so that all the letters sort earlier than all the non-letters and so that a tilde sorts before anything, even the end of a part. For example, the following parts are in sorted order from earliest to latest: ~~, ~~a, ~, the empty part, a.[[BR]] 
     6  ...[[BR]] 
     7  One common use of ~ is for upstream pre-releases. For example, 1.0~beta1~svn1245 sorts earlier than 1.0~beta1, which sorts earlier than 1.0. 
     8 
     9A good rule of thumb is that the tilde is generally needed for '''earlier''' (`<<`, `lt`)  and '''later-or-equal''' (`>=`, `ge`) comparisons, and not needed for '''later'''  (`>>`, `gt`) or '''earlier-or-equal''' (`<=`, `le`).   
     10 
     11When using `dpkg --compare-versions`, not that by default an empty version (i.e. the package is not installed or the package is being installed for the first time, depending on context) is treated as the earliest possible version.  The `lt`, `le`, `gt`, and `ge` comparison operators have alternative versions with a trailing `-nl` (e.g. `gt-nl`) which treat an empty version as the latest possible version.  When constructing `dpkg --compare-versions` conditionals, remember to verify that the flow control is correct for both upgrade and fresh installs.