Skip to content

Commit a9f4926

Browse files
authored
feat(building): add note on handling invalid version string errors (#986)
I updated the dev docs on building Syncthing with a note on handling "Invalid version string" errors; see syncthing/syncthing#10557. I also added a note that the version string for binaries is derived from the most recent Git tag as well as the Git commit (due to [this code](https://github.com/syncthing/syncthing/blob/main/build.go#L943-L948) in `build.go`). Fixes syncthing/syncthing#10557 Signed-off-by: Dylan Sprague <dylan.richard.sprague@gmail.com>
1 parent fffd579 commit a9f4926

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

dev/building.rst

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,11 @@ influence ``build``, ``tar`` and ``zip``. Examples:
168168
Version Tagging
169169
---------------
170170

171-
The binaries are "tagged" with a version derived from the current Git commit
172-
(or the ``RELEASE`` file, see below) and the current username and hostname.
173-
The username and hostname can be overridden by the ``BUILD_USER`` and
174-
``BUILD_HOST`` environment variables, for example::
171+
The binaries are "tagged" with a version derived from the current Git commit,
172+
the most recent Git tag, and the current username and hostname. The Git commit
173+
and tag can be replaced by a ``RELEASE`` file; see below. The username and
174+
hostname can be overridden by the ``BUILD_USER`` and ``BUILD_HOST`` environment
175+
variables, for example::
175176

176177
$ BUILD_USER=builder BUILD_HOST=buildhost.local go run build.go
177178
$ ./bin/syncthing --version
@@ -180,6 +181,24 @@ The username and hostname can be overridden by the ``BUILD_USER`` and
180181
In addition the timestamp (by default taken from the current Git commit) can
181182
be overridden by the ``SOURCE_DATE_EPOCH`` variable, in Unix epoch seconds.
182183

184+
.. note::
185+
If your built binary fails with an ``Invalid version string`` error, you
186+
probably did not fetch the Git tags with the code. This can happen when
187+
forking the repository on GitHub if you select the option to "Copy the
188+
``main`` branch only". To fetch the tags on a fork, run these commands:
189+
190+
.. code-block:: bash
191+
192+
# Add the upstream repository as a remote
193+
$ git remote add upstream https://github.com/syncthing/syncthing.git
194+
195+
# Fetch all tags from the upstream remote
196+
$ git fetch --tags upstream
197+
198+
# Rebuild
199+
$ go run build.go
200+
201+
183202
Building without Git
184203
--------------------
185204

0 commit comments

Comments
 (0)