diff --git a/documentation/content/en/books/handbook/cutting-edge/_index.adoc b/documentation/content/en/books/handbook/cutting-edge/_index.adoc --- a/documentation/content/en/books/handbook/cutting-edge/_index.adoc +++ b/documentation/content/en/books/handbook/cutting-edge/_index.adoc @@ -596,6 +596,49 @@ Branch names, such as `stable/9`, are listed at link:https://www.FreeBSD.org/releng/[www.freebsd.org/releng]. . Before compiling or upgrading to FreeBSD-STABLE , read [.filename]#/usr/src/Makefile# carefully and follow the instructions in <>. Read the {freebsd-stable} and [.filename]#/usr/src/UPDATING# to keep up-to-date on other bootstrapping procedures that sometimes become necessary on the road to the next release. +[[translate-n-number]] +=== The N-number +When tracking down bugs it is important to know which versions of the source code have been used to create the system exhibiting an issue. +FreeBSD provides version information compiled into the kernel. +man:uname[1] retrieves this information, for example: +[source,shell] +.... +% uname -a +FreeBSD 14.0-CURRENT #112 main-n247514-031260d64c18: Tue Jun 22 20:43:19 MDT 2021 fred@machine:/usr/home/fred/obj/usr/home/fred/git/head/amd64.amd64/sys/FRED +.... +Looking at the 4th field, it is made up of several parts: +[source,shell] +.... +main-n247514-031260d64c18 + +main <.> +n247514 <.> +031260d64c18 <.> +.... +<.> Git branch name. +Note: comparisons of n-numbers are only valid on branches published by the project (`main`, `stable/XX` and `releng/XX`). +Local branches will have n-numbers that will overlap commits of their parent branch. +<.> The n-number is a linear count of commits back to the start of the Git repository starting with the Git hash included in the line. +<.> Git hash of the checked out tree +<.> Sometimes a suffix of `-dirty` is present when the kernel was built in a tree with uncommitted changes. +It is absent in this example because the FRED kernel was built from a pristine checkout. + +The `git rev-list` command is used to find the n-number corresponding to a Git hash. +For example: +[source,shell] +.... +% git rev-list --first-parent --count 031260d64c18 <.> +247514 <.> +.... +<.> git hash to translate (the hash from the above example is reused) +<.> The n-number. + +Usually this number is not all that important. +However, when bug fixes are committed, this number makes it easy to quickly determine whether the fix is present in the currently running system. +Developers will often refer to the hash of the commit (or provide a URL which has that hash), but not the n-number since the hash is the easily visible identifier for a change while the n-number is not. +Security advisories and errata notices will also note an n-number, which can be directly compared against your system. +When you need to use shallow Git clones, you cannot compare n-numbers reliably as the `git rev-list` command counts all the revisions in the repository which a shallow clone omits. + [[makeworld]] == Updating FreeBSD from Source