Index | Thread | Search

From:
Douglas Silva <doug.hs@proton.me>
Subject:
Re: Upgrade net/syncthing to v2
To:
"ports@openbsd.org" <ports@openbsd.org>
Cc:
"kn@openbsd.org" <kn@openbsd.org>, Edd Barrett <edd@theunixzoo.co.uk>, Lydia Sobot <chilledfrogs@disroot.org>
Date:
Wed, 31 Dec 2025 14:13:14 +0000

Download raw body.

Thread
  • Douglas Silva:

    Upgrade net/syncthing to v2

  • Got it. Now the usage report is disabled on first run.
    
    - If you ever decide to enable it, you can — I just tested it.
    - If you ever set it to "Undecided", it will reset to "Disabled" after a page reload; but I think that's fine, since it can't open that modal anymore.
    
    But now I do wonder: what if the package user doesn't ever use the GUI to manage it? Syncthing has a CLI interface too.
    
    
    Index: Makefile
    ===================================================================
    RCS file: /cvs/ports/net/syncthing/Makefile,v
    diff -u -p -u -p -r1.73 Makefile
    --- Makefile	22 Jul 2025 20:20:25 -0000	1.73
    +++ Makefile	31 Dec 2025 14:01:51 -0000
    @@ -1,6 +1,6 @@
     COMMENT =	open decentralized synchronization utility
     
    -V =		1.30.0
    +V =		2.0.12
     DISTNAME =	syncthing-${V}
     DISTFILES =	syncthing-source-v${V}${EXTRACT_SUFX}
     
    @@ -22,7 +22,6 @@ WRKDIST =		${WRKDIR}/syncthing
     WRKSRC =		${WRKDIR}/go/src/github.com/syncthing/syncthing
     
     MODULES =		lang/go
    -MODGO_TYPE =		bin
     
     # Syncthing contains a lot of stuff that end users wouldn't be interested in,
     # so we package only these binaries.
    Index: distinfo
    ===================================================================
    RCS file: /cvs/ports/net/syncthing/distinfo,v
    diff -u -p -u -p -r1.50 distinfo
    --- distinfo	4 Jul 2025 19:19:39 -0000	1.50
    +++ distinfo	31 Dec 2025 14:01:51 -0000
    @@ -1,2 +1,2 @@
    -SHA256 (syncthing-source-v1.30.0.tar.gz) = 7xvnHGZ1PAQhKrHJxUjmeNRoutmNxUYeg1QKTvXC/Lo=
    -SIZE (syncthing-source-v1.30.0.tar.gz) = 16142834
    +SHA256 (syncthing-source-v2.0.12.tar.gz) = VgBK5tl0qjh8PGpzTrmKr9XWFZ/GV6H0xhjgsYFPra4=
    +SIZE (syncthing-source-v2.0.12.tar.gz) = 62613260
    Index: patches/patch-build_go
    ===================================================================
    RCS file: /cvs/ports/net/syncthing/patches/patch-build_go,v
    diff -u -p -u -p -r1.24 patch-build_go
    --- patches/patch-build_go	4 Jun 2025 20:07:43 -0000	1.24
    +++ patches/patch-build_go	31 Dec 2025 14:01:51 -0000
    @@ -3,7 +3,7 @@ Print build commands
     Index: build.go
     --- build.go.orig
     +++ build.go
    -@@ -549,7 +549,7 @@ func appendParameters(args []string, tags []string, pk
    +@@ -532,7 +532,7 @@ func appendParameters(args []string, tags []string, pk
      
      	if !debugBinary {
      		// Regular binaries get version tagged and skip some debug symbols
    Index: patches/patch-cmd_syncthing_main_go
    ===================================================================
    RCS file: /cvs/ports/net/syncthing/patches/patch-cmd_syncthing_main_go,v
    diff -u -p -u -p -r1.3 patch-cmd_syncthing_main_go
    --- patches/patch-cmd_syncthing_main_go	15 Jun 2025 16:42:21 -0000	1.3
    +++ patches/patch-cmd_syncthing_main_go	31 Dec 2025 14:01:51 -0000
    @@ -5,8 +5,8 @@ use unveil(2) to limit execution to
     Index: cmd/syncthing/main.go
     --- cmd/syncthing/main.go.orig
     +++ cmd/syncthing/main.go
    -@@ -29,6 +29,8 @@ import (
    - 	"syscall"
    +@@ -31,6 +31,8 @@ import (
    + 	"text/tabwriter"
      	"time"
      
     +	"golang.org/x/sys/unix"
    @@ -14,23 +14,28 @@ Index: cmd/syncthing/main.go
      	"github.com/alecthomas/kong"
      	"github.com/gofrs/flock"
      	"github.com/thejerf/suture/v4"
    -@@ -206,6 +208,19 @@ func defaultVars() kong.Vars {
    - }
    - 
    +@@ -213,6 +215,24 @@ func defaultVars() kong.Vars {
      func main() {
    + 	// Create a parser with an overridden help function to print our extra
    + 	// help info.
    ++
     +	if err := unix.Unveil("/", "rwc"); err != nil {
     +		panic(err)
     +	}
    ++
     +	if err := unix.Unveil("/usr/local/bin/syncthing", "rx"); err != nil {
     +		panic(err)
     +	}
    ++
     +	if err := unix.Unveil("/usr/local/bin/xdg-open", "rx"); err != nil {
     +		panic(err)
     +	}
    ++
     +	if err := unix.UnveilBlock(); err != nil {
     +		panic(err)
     +	}
     +
    - 	// First some massaging of the raw command line to fit the new model.
    - 	// Basically this means adding the default command at the front, and
    - 	// converting -options to --options.
    ++
    + 	var entrypoint CLI
    + 	parser, err := kong.New(
    + 		&entrypoint,
    Index: patches/patch-gui_default_syncthing_core_syncthingController_js
    ===================================================================
    RCS file: patches/patch-gui_default_syncthing_core_syncthingController_js
    diff -N patches/patch-gui_default_syncthing_core_syncthingController_js
    --- /dev/null	1 Jan 1970 00:00:00 -0000
    +++ patches/patch-gui_default_syncthing_core_syncthingController_js	31 Dec 2025 14:01:51 -0000
    @@ -0,0 +1,46 @@
    +Disable nag screen for telemetry.
    +
    +Index: gui/default/syncthing/core/syncthingController.js
    +--- gui/default/syncthing/core/syncthingController.js.orig
    ++++ gui/default/syncthing/core/syncthingController.js
    +@@ -187,15 +187,6 @@ angular.module('syncthing.core')
    +                     $scope.version = data;
    +                 }).error($scope.emitHTTPError);
    + 
    +-                if ($scope.system && $scope.config.options.urAccepted > -1 && $scope.config.options.urSeen < $scope.system.urVersionMax && $scope.config.options.urAccepted < $scope.system.urVersionMax) {
    +-                    // Usage reporting decision has not been taken or format
    +-                    // has changed, prompt the user to (re-)accept.
    +-                    $http.get(urlbase + '/svc/report').success(function (data) {
    +-                        $scope.reportData = data;
    +-                        showModal('#ur');
    +-                    }).error($scope.emitHTTPError);
    +-                }
    +-
    +                 $http.get(urlbase + '/system/upgrade').success(function (data) {
    +                     $scope.upgradeInfo = data;
    +                 }).error(function () {
    +@@ -370,21 +361,9 @@ angular.module('syncthing.core')
    + 
    +         $scope.$on('ConfigLoaded', function () {
    +             if ($scope.config.options.urAccepted === 0) {
    +-                // If usage reporting has been neither accepted nor declined,
    +-                // we want to ask the user to make a choice. But we don't want
    +-                // to bug them during initial setup, so we set a cookie with
    +-                // the time of the first visit. When that cookie is present
    +-                // and the time is more than four hours ago, we ask the
    +-                // question.
    +-
    +-                var firstVisit = document.cookie.replace(/(?:(?:^|.*;\s*)firstVisit\s*\=\s*([^;]*).*$)|^.*$/, "$1");
    +-                if (!firstVisit) {
    +-                    document.cookie = "firstVisit=" + Date.now() + ";max-age=" + 30 * 24 * 3600;
    +-                } else {
    +-                    if (+firstVisit < Date.now() - 4 * 3600 * 1000) {
    +-                        showModal('#ur');
    +-                    }
    +-                }
    ++                $scope.config.options.urAccepted = -1;
    ++                $scope.config.options.urSeen = $scope.system.urVersionMax;
    ++                $scope.saveConfig();
    +             }
    +         });
    + 
    Index: patches/patch-internal_db_interface_go
    ===================================================================
    RCS file: patches/patch-internal_db_interface_go
    diff -N patches/patch-internal_db_interface_go
    --- /dev/null	1 Jan 1970 00:00:00 -0000
    +++ patches/patch-internal_db_interface_go	31 Dec 2025 14:01:51 -0000
    @@ -0,0 +1,20 @@
    +Remove canonical import path that prevents successful build.
    +
    +This has been fixed upstream [1] and, when released, will
    +make this patch obsolete.
    +
    +[1] https://github.com/syncthing/syncthing/commit/1843cac6d9cb1e3c8b7dd96e5ec4fcb28f554275
    +
    +
    +Index: internal/db/interface.go
    +--- internal/db/interface.go.orig
    ++++ internal/db/interface.go
    +@@ -4,7 +4,7 @@
    + // License, v. 2.0. If a copy of the MPL was not distributed with this file,
    + // You can obtain one at https://mozilla.org/MPL/2.0/.
    + 
    +-package db // import "github.com/syncthing/syncthing/internal/db/sqlite"
    ++package db
    + 
    + import (
    + 	"iter"
    Index: patches/patch-lib_build_build_go
    ===================================================================
    RCS file: /cvs/ports/net/syncthing/patches/patch-lib_build_build_go,v
    diff -u -p -u -p -r1.4 patch-lib_build_build_go
    --- patches/patch-lib_build_build_go	28 Nov 2024 11:47:47 -0000	1.4
    +++ patches/patch-lib_build_build_go	31 Dec 2025 14:01:51 -0000
    @@ -3,7 +3,7 @@ Disable phone-home calls / anonymous usa
     Index: lib/build/build.go
     --- lib/build/build.go.orig
     +++ lib/build/build.go
    -@@ -74,7 +74,7 @@ func setBuildData() {
    +@@ -83,7 +83,7 @@ func setBuildData() {
      
      	exp := regexp.MustCompile(`^v\d+\.\d+\.\d+(-[a-z]+[\d\.]+)?$`)
      	IsRelease = exp.MatchString(Version)
    Index: pkg/README
    ===================================================================
    RCS file: /cvs/ports/net/syncthing/pkg/README,v
    diff -u -p -u -p -r1.8 README
    --- pkg/README	16 Feb 2024 15:09:13 -0000	1.8
    +++ pkg/README	31 Dec 2025 14:01:51 -0000
    @@ -21,8 +21,8 @@ Starting via RC script
     
     Syncthing can be started via the included RC script, thus running
     Syncthing as a system service. This is fine for single user
    -configurations. Under this mode of operation, Syncthing will run as the
    -_syncthing user and store the default 'Sync' folder under
    +configurations. Under this mode of operation, Syncthing runs as the
    +_syncthing user, and the default location for folders is
     ${LOCALSTATEDIR}/syncthing.
     
     Starting Manually
    @@ -31,7 +31,7 @@ Starting Manually
     The other way is to simply invoke ${TRUEPREFIX}/bin/syncthing manually.
     This is a better choice for situations where several users all want to
     run their own instances of Syncthing. Under this mode, the default
    -'Sync' folder will be stored in the user's home directory. Users will
    +location for folders is the user's home directory. Users will
     have to configure Syncthing to listen on different TCP ports for this
     method to work.
     
    Index: pkg/syncthing.rc
    ===================================================================
    RCS file: /cvs/ports/net/syncthing/pkg/syncthing.rc,v
    diff -u -p -u -p -r1.6 syncthing.rc
    --- pkg/syncthing.rc	11 Mar 2022 19:47:38 -0000	1.6
    +++ pkg/syncthing.rc	31 Dec 2025 14:01:51 -0000
    @@ -1,7 +1,7 @@
     #!/bin/ksh
     
     daemon="${TRUEPREFIX}/bin/syncthing"
    -daemon_flags="-no-browser"
    +daemon_flags="--no-browser"
     daemon_user="_syncthing"
     
     . /etc/rc.d/rc.subr
    
    
    
    
    On Wednesday, December 31st, 2025 at 00:29, Douglas Silva <doug.hs@proton.me> wrote:
    
    > 
    > 
    > 
    > 
    > There was another piece of code triggering the telemetry modal, so I removed it too. Now it doesn't show up anymore.
    > 
    > But if you go to Settings and look for the "Anonymous Usage Reporting", it's now set to "Undecided (will prompt)" by default. We need to set it to "Disabled", somehow.
    > 
    > In the same file there is a function defined as '$scope.declineUR', which seems to be what we need. I'm going to experiment with that tomorrow.
    > 
    > 
    > Index: Makefile
    > ===================================================================
    > RCS file: /cvs/ports/net/syncthing/Makefile,v
    > diff -u -p -u -p -r1.73 Makefile
    > --- Makefile 22 Jul 2025 20:20:25 -0000 1.73
    > +++ Makefile 31 Dec 2025 03:14:19 -0000
    > @@ -1,6 +1,6 @@
    > COMMENT = open decentralized synchronization utility
    > 
    > -V = 1.30.0
    > +V = 2.0.12
    > DISTNAME = syncthing-${V}
    > DISTFILES = syncthing-source-v${V}${EXTRACT_SUFX}
    > 
    > @@ -22,7 +22,6 @@ WRKDIST = ${WRKDIR}/syncthing
    > WRKSRC = ${WRKDIR}/go/src/github.com/syncthing/syncthing
    > 
    > MODULES = lang/go
    > -MODGO_TYPE = bin
    > 
    > # Syncthing contains a lot of stuff that end users wouldn't be interested in,
    > # so we package only these binaries.
    > Index: distinfo
    > ===================================================================
    > RCS file: /cvs/ports/net/syncthing/distinfo,v
    > diff -u -p -u -p -r1.50 distinfo
    > --- distinfo 4 Jul 2025 19:19:39 -0000 1.50
    > +++ distinfo 31 Dec 2025 03:14:19 -0000
    > @@ -1,2 +1,2 @@
    > -SHA256 (syncthing-source-v1.30.0.tar.gz) = 7xvnHGZ1PAQhKrHJxUjmeNRoutmNxUYeg1QKTvXC/Lo=
    > -SIZE (syncthing-source-v1.30.0.tar.gz) = 16142834
    > +SHA256 (syncthing-source-v2.0.12.tar.gz) = VgBK5tl0qjh8PGpzTrmKr9XWFZ/GV6H0xhjgsYFPra4=
    > +SIZE (syncthing-source-v2.0.12.tar.gz) = 62613260
    > Index: patches/patch-build_go
    > ===================================================================
    > RCS file: /cvs/ports/net/syncthing/patches/patch-build_go,v
    > diff -u -p -u -p -r1.24 patch-build_go
    > --- patches/patch-build_go 4 Jun 2025 20:07:43 -0000 1.24
    > +++ patches/patch-build_go 31 Dec 2025 03:14:19 -0000
    > @@ -3,7 +3,7 @@ Print build commands
    > Index: build.go
    > --- build.go.orig
    > +++ build.go
    > -@@ -549,7 +549,7 @@ func appendParameters(args []string, tags []string, pk
    > +@@ -532,7 +532,7 @@ func appendParameters(args []string, tags []string, pk
    > 
    > if !debugBinary {
    > // Regular binaries get version tagged and skip some debug symbols
    > Index: patches/patch-cmd_syncthing_main_go
    > ===================================================================
    > RCS file: /cvs/ports/net/syncthing/patches/patch-cmd_syncthing_main_go,v
    > diff -u -p -u -p -r1.3 patch-cmd_syncthing_main_go
    > --- patches/patch-cmd_syncthing_main_go 15 Jun 2025 16:42:21 -0000 1.3
    > +++ patches/patch-cmd_syncthing_main_go 31 Dec 2025 03:14:19 -0000
    > @@ -5,8 +5,8 @@ use unveil(2) to limit execution to
    > Index: cmd/syncthing/main.go
    > --- cmd/syncthing/main.go.orig
    > +++ cmd/syncthing/main.go
    > -@@ -29,6 +29,8 @@ import (
    > - "syscall"
    > +@@ -31,6 +31,8 @@ import (
    > + "text/tabwriter"
    > "time"
    > 
    > + "golang.org/x/sys/unix"
    > @@ -14,23 +14,28 @@ Index: cmd/syncthing/main.go
    > "github.com/alecthomas/kong"
    > "github.com/gofrs/flock"
    > "github.com/thejerf/suture/v4"
    > -@@ -206,6 +208,19 @@ func defaultVars() kong.Vars {
    > - }
    > -
    > +@@ -213,6 +215,24 @@ func defaultVars() kong.Vars {
    > func main() {
    > + // Create a parser with an overridden help function to print our extra
    > + // help info.
    > ++
    > + if err := unix.Unveil("/", "rwc"); err != nil {
    > + panic(err)
    > + }
    > ++
    > + if err := unix.Unveil("/usr/local/bin/syncthing", "rx"); err != nil {
    > + panic(err)
    > + }
    > ++
    > + if err := unix.Unveil("/usr/local/bin/xdg-open", "rx"); err != nil {
    > + panic(err)
    > + }
    > ++
    > + if err := unix.UnveilBlock(); err != nil {
    > + panic(err)
    > + }
    > +
    > - // First some massaging of the raw command line to fit the new model.
    > - // Basically this means adding the default command at the front, and
    > - // converting -options to --options.
    > ++
    > + var entrypoint CLI
    > + parser, err := kong.New(
    > + &entrypoint,
    > Index: patches/patch-gui_default_syncthing_core_syncthingController_js
    > ===================================================================
    > RCS file: patches/patch-gui_default_syncthing_core_syncthingController_js
    > diff -N patches/patch-gui_default_syncthing_core_syncthingController_js
    > --- /dev/null 1 Jan 1970 00:00:00 -0000
    > +++ patches/patch-gui_default_syncthing_core_syncthingController_js 31 Dec 2025 03:14:19 -0000
    > @@ -0,0 +1,48 @@
    > +Disable nag screen for telemetry.
    > +
    > +Index: gui/default/syncthing/core/syncthingController.js
    > +--- gui/default/syncthing/core/syncthingController.js.orig
    > ++++ gui/default/syncthing/core/syncthingController.js
    > +@@ -187,15 +187,6 @@ angular.module('syncthing.core')
    > + $scope.version = data;
    > + }).error($scope.emitHTTPError);
    > +
    > +- if ($scope.system && $scope.config.options.urAccepted > -1 && $scope.config.options.urSeen < $scope.system.urVersionMax && $scope.config.options.urAccepted < $scope.system.urVersionMax) {
    > 
    > +- // Usage reporting decision has not been taken or format
    > +- // has changed, prompt the user to (re-)accept.
    > +- $http.get(urlbase + '/svc/report').success(function (data) {
    > +- $scope.reportData = data;
    > +- showModal('#ur');
    > +- }).error($scope.emitHTTPError);
    > +- }
    > +-
    > + $http.get(urlbase + '/system/upgrade').success(function (data) {
    > + $scope.upgradeInfo = data;
    > + }).error(function () {
    > +@@ -365,26 +356,6 @@ angular.module('syncthing.core')
    > + delete $scope.pendingFolders[folderDev.folderID].offeredBy[folderDev.deviceID];
    > + }
    > + });
    > + }
    > + });
    > +-
    > +- $scope.$on('ConfigLoaded', function () {
    > +- if ($scope.config.options.urAccepted === 0) {
    > +- // If usage reporting has been neither accepted nor declined,
    > +- // we want to ask the user to make a choice. But we don't want
    > +- // to bug them during initial setup, so we set a cookie with
    > +- // the time of the first visit. When that cookie is present
    > +- // and the time is more than four hours ago, we ask the
    > +- // question.
    > +-
    > +- var firstVisit = document.cookie.replace(/(?:(?:^|.;\s)firstVisit\s*\=\s*([^;]).$)|^.*$/, "$1");
    > +- if (!firstVisit) {
    > +- document.cookie = "firstVisit=" + Date.now() + ";max-age=" + 30 * 24 * 3600;
    > +- } else {
    > +- if (+firstVisit < Date.now() - 4 * 3600 * 1000) {
    > +- showModal('#ur');
    > +- }
    > +- }
    > +- }
    > +- });
    > +
    > Index: patches/patch-internal_db_interface_go
    > ===================================================================
    > RCS file: patches/patch-internal_db_interface_go
    > diff -N patches/patch-internal_db_interface_go
    > --- /dev/null 1 Jan 1970 00:00:00 -0000
    > +++ patches/patch-internal_db_interface_go 31 Dec 2025 03:14:19 -0000
    > @@ -0,0 +1,20 @@
    > +Remove canonical import path that prevents successful build.
    > +
    > +This has been fixed upstream [1] and, when released, will
    > +make this patch obsolete.
    > +
    > +[1] https://github.com/syncthing/syncthing/commit/1843cac6d9cb1e3c8b7dd96e5ec4fcb28f554275
    > +
    > +
    > +Index: internal/db/interface.go
    > +--- internal/db/interface.go.orig
    > ++++ internal/db/interface.go
    > +@@ -4,7 +4,7 @@
    > + // License, v. 2.0. If a copy of the MPL was not distributed with this file,
    > + // You can obtain one at https://mozilla.org/MPL/2.0/.
    > +
    > +-package db // import "github.com/syncthing/syncthing/internal/db/sqlite"
    > ++package db
    > +
    > + import (
    > + "iter"
    > Index: patches/patch-lib_build_build_go
    > ===================================================================
    > RCS file: /cvs/ports/net/syncthing/patches/patch-lib_build_build_go,v
    > diff -u -p -u -p -r1.4 patch-lib_build_build_go
    > --- patches/patch-lib_build_build_go 28 Nov 2024 11:47:47 -0000 1.4
    > +++ patches/patch-lib_build_build_go 31 Dec 2025 03:14:19 -0000
    > @@ -3,7 +3,7 @@ Disable phone-home calls / anonymous usa
    > Index: lib/build/build.go
    > --- lib/build/build.go.orig
    > +++ lib/build/build.go
    > -@@ -74,7 +74,7 @@ func setBuildData() {
    > +@@ -83,7 +83,7 @@ func setBuildData() {
    > 
    > exp := regexp.MustCompile(`^v\\d+\\.\\d+\\.\\d+(-[a-z]+[\\d\\.]+)?$`)
    > IsRelease = exp.MatchString(Version)
    > Index: pkg/README
    > ===================================================================
    > RCS file: /cvs/ports/net/syncthing/pkg/README,v
    > diff -u -p -u -p -r1.8 README
    > --- pkg/README 16 Feb 2024 15:09:13 -0000 1.8
    > +++ pkg/README 31 Dec 2025 03:14:19 -0000
    > @@ -21,8 +21,8 @@ Starting via RC script
    > 
    > Syncthing can be started via the included RC script, thus running
    > Syncthing as a system service. This is fine for single user
    > -configurations. Under this mode of operation, Syncthing will run as the
    > -_syncthing user and store the default 'Sync' folder under
    > +configurations. Under this mode of operation, Syncthing runs as the
    > +_syncthing user, and the default location for folders is
    > ${LOCALSTATEDIR}/syncthing.
    > 
    > Starting Manually
    > @@ -31,7 +31,7 @@ Starting Manually
    > The other way is to simply invoke ${TRUEPREFIX}/bin/syncthing manually.
    > This is a better choice for situations where several users all want to
    > run their own instances of Syncthing. Under this mode, the default
    > -'Sync' folder will be stored in the user's home directory. Users will
    > +location for folders is the user's home directory. Users will
    > have to configure Syncthing to listen on different TCP ports for this
    > method to work.
    > 
    > Index: pkg/syncthing.rc
    > ===================================================================
    > RCS file: /cvs/ports/net/syncthing/pkg/syncthing.rc,v
    > diff -u -p -u -p -r1.6 syncthing.rc
    > --- pkg/syncthing.rc 11 Mar 2022 19:47:38 -0000 1.6
    > +++ pkg/syncthing.rc 31 Dec 2025 03:14:19 -0000
    > @@ -1,7 +1,7 @@
    > #!/bin/ksh
    > 
    > daemon="${TRUEPREFIX}/bin/syncthing"
    > -daemon_flags="-no-browser"
    > +daemon_flags="--no-browser"
    > daemon_user="_syncthing"
    > 
    > . /etc/rc.d/rc.subr
    > 
    > 
    > 
    > 
    > 
    > 
    > On Tuesday, December 30th, 2025 at 15:22, Douglas Silva doug.hs@proton.me wrote:
    > 
    > > I just tested your patch, but the telemetry prompt is still shown for a new configuration. I'll take a look at that code.
    > > 
    > > For the record:
    > > The patching was failing here because my mail client deletes trailing spaces, which are critical for context matching. Running patch(1) with --ignore-whitespace makes it work.
    > > 
    > > On Monday, December 29th, 2025 at 05:37, Edd Barrett edd@theunixzoo.co.uk wrote:
    > > 
    > > > Hi,
    > > > 
    > > > On Sun, Dec 28, 2025 at 07:46:13PM +0000, Douglas Silva wrote:
    > > > 
    > > > > As you've seen, it migrates to v2 without any user intervention.
    > > > 
    > > > Yes, and I've now tested that locally, and it works. V2 also speaks to V1 just
    > > > fine it seems (also turns out my android phone has been talking V2 to my V1
    > > > OpenBSD nodes for some time).
    > > > 
    > > > > > There are some (pre-existing) hard-coded paths in
    > > > > > this patch. We should fix these as a separate commit.
    > > > > 
    > > > > Honestly, I have no idea what that means or how to fix it :D
    > > > 
    > > > I'll fix those in a follow-up commit. I also think any proposed changes to
    > > > logging should also be a follow-up commit. For now let's just focus on the
    > > > version upgrade.
    > > > 
    > > > > When opening the web GUI for the first time, I get the dialog asking if I
    > > > > want to enable telemetry. Isn't it supposed to be disabled by the patch
    > > > > `patch-lib_build_build_go`?
    > > > 
    > > > I think that patch is designed to do two things:
    > > > - disable auto-update
    > > > - disable telemetry
    > > > 
    > > > But it seems we now have to try harder for the latter.
    > > > 
    > > > Here's an updated diff which disables the telemetry nag screen, leaving
    > > > `urAccepted=0` in the config file. Please test.
    > > > 
    > > > Index: Makefile
    > > > ===================================================================
    > > > RCS file: /cvs/ports/net/syncthing/Makefile,v
    > > > diff -u -p -r1.73 Makefile
    > > > --- Makefile 22 Jul 2025 20:20:25 -0000 1.73
    > > > +++ Makefile 29 Dec 2025 07:28:55 -0000
    > > > @@ -1,6 +1,6 @@
    > > > COMMENT = open decentralized synchronization utility
    > > > 
    > > > -V = 1.30.0
    > > > +V = 2.0.12
    > > > DISTNAME = syncthing-${V}
    > > > DISTFILES = syncthing-source-v${V}${EXTRACT_SUFX}
    > > > 
    > > > @@ -22,7 +22,6 @@ WRKDIST = ${WRKDIR}/syncthing
    > > > WRKSRC = ${WRKDIR}/go/src/github.com/syncthing/syncthing
    > > > 
    > > > MODULES = lang/go
    > > > -MODGO_TYPE = bin
    > > > 
    > > > # Syncthing contains a lot of stuff that end users wouldn't be interested in,
    > > > # so we package only these binaries.
    > > > Index: distinfo
    > > > ===================================================================
    > > > RCS file: /cvs/ports/net/syncthing/distinfo,v
    > > > diff -u -p -r1.50 distinfo
    > > > --- distinfo 4 Jul 2025 19:19:39 -0000 1.50
    > > > +++ distinfo 29 Dec 2025 07:28:55 -0000
    > > > @@ -1,2 +1,2 @@
    > > > -SHA256 (syncthing-source-v1.30.0.tar.gz) = 7xvnHGZ1PAQhKrHJxUjmeNRoutmNxUYeg1QKTvXC/Lo=
    > > > -SIZE (syncthing-source-v1.30.0.tar.gz) = 16142834
    > > > +SHA256 (syncthing-source-v2.0.12.tar.gz) = VgBK5tl0qjh8PGpzTrmKr9XWFZ/GV6H0xhjgsYFPra4=
    > > > +SIZE (syncthing-source-v2.0.12.tar.gz) = 62613260
    > > > Index: patches/patch-build_go
    > > > ===================================================================
    > > > RCS file: /cvs/ports/net/syncthing/patches/patch-build_go,v
    > > > diff -u -p -r1.24 patch-build_go
    > > > --- patches/patch-build_go 4 Jun 2025 20:07:43 -0000 1.24
    > > > +++ patches/patch-build_go 29 Dec 2025 07:28:55 -0000
    > > > @@ -3,7 +3,7 @@ Print build commands
    > > > Index: build.go
    > > > --- build.go.orig
    > > > +++ build.go
    > > > -@@ -549,7 +549,7 @@ func appendParameters(args []string, tags []string, pk
    > > > +@@ -532,7 +532,7 @@ func appendParameters(args []string, tags []string, pk
    > > > 
    > > > if !debugBinary {
    > > > // Regular binaries get version tagged and skip some debug symbols
    > > > Index: patches/patch-cmd_syncthing_main_go
    > > > ===================================================================
    > > > RCS file: /cvs/ports/net/syncthing/patches/patch-cmd_syncthing_main_go,v
    > > > diff -u -p -r1.3 patch-cmd_syncthing_main_go
    > > > --- patches/patch-cmd_syncthing_main_go 15 Jun 2025 16:42:21 -0000 1.3
    > > > +++ patches/patch-cmd_syncthing_main_go 29 Dec 2025 07:28:55 -0000
    > > > @@ -5,8 +5,8 @@ use unveil(2) to limit execution to
    > > > Index: cmd/syncthing/main.go
    > > > --- cmd/syncthing/main.go.orig
    > > > +++ cmd/syncthing/main.go
    > > > -@@ -29,6 +29,8 @@ import (
    > > > - "syscall"
    > > > +@@ -31,6 +31,8 @@ import (
    > > > + "text/tabwriter"
    > > > "time"
    > > > 
    > > > + "golang.org/x/sys/unix"
    > > > @@ -14,23 +14,28 @@ Index: cmd/syncthing/main.go
    > > > "github.com/alecthomas/kong"
    > > > "github.com/gofrs/flock"
    > > > "github.com/thejerf/suture/v4"
    > > > -@@ -206,6 +208,19 @@ func defaultVars() kong.Vars {
    > > > - }
    > > > -
    > > > +@@ -213,6 +215,24 @@ func defaultVars() kong.Vars {
    > > > func main() {
    > > > + // Create a parser with an overridden help function to print our extra
    > > > + // help info.
    > > > ++
    > > > + if err := unix.Unveil("/", "rwc"); err != nil {
    > > > + panic(err)
    > > > + }
    > > > ++
    > > > + if err := unix.Unveil("/usr/local/bin/syncthing", "rx"); err != nil {
    > > > + panic(err)
    > > > + }
    > > > ++
    > > > + if err := unix.Unveil("/usr/local/bin/xdg-open", "rx"); err != nil {
    > > > + panic(err)
    > > > + }
    > > > ++
    > > > + if err := unix.UnveilBlock(); err != nil {
    > > > + panic(err)
    > > > + }
    > > > +
    > > > - // First some massaging of the raw command line to fit the new model.
    > > > - // Basically this means adding the default command at the front, and
    > > > - // converting -options to --options.
    > > > ++
    > > > + var entrypoint CLI
    > > > + parser, err := kong.New(
    > > > + &entrypoint,
    > > > Index: patches/patch-gui_default_syncthing_core_syncthingController_js
    > > > ===================================================================
    > > > RCS file: patches/patch-gui_default_syncthing_core_syncthingController_js
    > > > diff -N patches/patch-gui_default_syncthing_core_syncthingController_js
    > > > --- /dev/null 1 Jan 1970 00:00:00 -0000
    > > > +++ patches/patch-gui_default_syncthing_core_syncthingController_js 29 Dec 2025 08:28:59 -0000
    > > > @@ -0,0 +1,21 @@
    > > > +Disable nag screen for telemetry.
    > > > +
    > > > +Index: gui/default/syncthing/core/syncthingController.js
    > > > +--- gui/default/syncthing/core/syncthingController.js.orig
    > > > ++++ gui/default/syncthing/core/syncthingController.js
    > > > +@@ -187,15 +187,6 @@ angular.module('syncthing.core')
    > > > + $scope.version = data;
    > > > + }).error($scope.emitHTTPError);
    > > > +
    > > > +- if ($scope.system && $scope.config.options.urAccepted > -1 && $scope.config.options.urSeen < $scope.system.urVersionMax && $scope.config.options.urAccepted < $scope.system.urVersionMax) {
    > > > 
    > > > +- // Usage reporting decision has not been taken or format
    > > > +- // has changed, prompt the user to (re-)accept.
    > > > +- $http.get(urlbase + '/svc/report').success(function (data) {
    > > > +- $scope.reportData = data;
    > > > +- showModal('#ur');
    > > > +- }).error($scope.emitHTTPError);
    > > > +- }
    > > > +-
    > > > + $http.get(urlbase + '/system/upgrade').success(function (data) {
    > > > + $scope.upgradeInfo = data;
    > > > + }).error(function () {
    > > > Index: patches/patch-internal_db_interface_go
    > > > ===================================================================
    > > > RCS file: patches/patch-internal_db_interface_go
    > > > diff -N patches/patch-internal_db_interface_go
    > > > --- /dev/null 1 Jan 1970 00:00:00 -0000
    > > > +++ patches/patch-internal_db_interface_go 29 Dec 2025 07:28:55 -0000
    > > > @@ -0,0 +1,20 @@
    > > > +Remove canonical import path that prevents successful build.
    > > > +
    > > > +This has been fixed upstream [1] and, when released, will
    > > > +make this patch obsolete.
    > > > +
    > > > +[1] https://github.com/syncthing/syncthing/commit/1843cac6d9cb1e3c8b7dd96e5ec4fcb28f554275
    > > > +
    > > > +
    > > > +Index: internal/db/interface.go
    > > > +--- internal/db/interface.go.orig
    > > > ++++ internal/db/interface.go
    > > > +@@ -4,7 +4,7 @@
    > > > + // License, v. 2.0. If a copy of the MPL was not distributed with this file,
    > > > + // You can obtain one at https://mozilla.org/MPL/2.0/.
    > > > +
    > > > +-package db // import "github.com/syncthing/syncthing/internal/db/sqlite"
    > > > ++package db
    > > > +
    > > > + import (
    > > > + "iter"
    > > > Index: patches/patch-lib_build_build_go
    > > > ===================================================================
    > > > RCS file: /cvs/ports/net/syncthing/patches/patch-lib_build_build_go,v
    > > > diff -u -p -r1.4 patch-lib_build_build_go
    > > > --- patches/patch-lib_build_build_go 28 Nov 2024 11:47:47 -0000 1.4
    > > > +++ patches/patch-lib_build_build_go 29 Dec 2025 07:28:55 -0000
    > > > @@ -3,7 +3,7 @@ Disable phone-home calls / anonymous usa
    > > > Index: lib/build/build.go
    > > > --- lib/build/build.go.orig
    > > > +++ lib/build/build.go
    > > > -@@ -74,7 +74,7 @@ func setBuildData() {
    > > > +@@ -83,7 +83,7 @@ func setBuildData() {
    > > > 
    > > > exp := regexp.MustCompile(`^v\\\\\\\\d+\\\\\\\\.\\\\\\\\d+\\\\\\\\.\\\\\\\\d+(-[a-z]+[\\\\\\\\d\\\\\\\\.]+)?$`)
    > > > IsRelease = exp.MatchString(Version)
    > > > Index: pkg/README
    > > > ===================================================================
    > > > RCS file: /cvs/ports/net/syncthing/pkg/README,v
    > > > diff -u -p -r1.8 README
    > > > --- pkg/README 16 Feb 2024 15:09:13 -0000 1.8
    > > > +++ pkg/README 29 Dec 2025 07:28:55 -0000
    > > > @@ -21,8 +21,8 @@ Starting via RC script
    > > > 
    > > > Syncthing can be started via the included RC script, thus running
    > > > Syncthing as a system service. This is fine for single user
    > > > -configurations. Under this mode of operation, Syncthing will run as the
    > > > -_syncthing user and store the default 'Sync' folder under
    > > > +configurations. Under this mode of operation, Syncthing runs as the
    > > > +_syncthing user, and the default location for folders is
    > > > ${LOCALSTATEDIR}/syncthing.
    > > > 
    > > > Starting Manually
    > > > @@ -31,7 +31,7 @@ Starting Manually
    > > > The other way is to simply invoke ${TRUEPREFIX}/bin/syncthing manually.
    > > > This is a better choice for situations where several users all want to
    > > > run their own instances of Syncthing. Under this mode, the default
    > > > -'Sync' folder will be stored in the user's home directory. Users will
    > > > +location for folders is the user's home directory. Users will
    > > > have to configure Syncthing to listen on different TCP ports for this
    > > > method to work.
    > > > 
    > > > Index: pkg/syncthing.rc
    > > > ===================================================================
    > > > RCS file: /cvs/ports/net/syncthing/pkg/syncthing.rc,v
    > > > diff -u -p -r1.6 syncthing.rc
    > > > --- pkg/syncthing.rc 11 Mar 2022 19:47:38 -0000 1.6
    > > > +++ pkg/syncthing.rc 29 Dec 2025 07:28:55 -0000
    > > > @@ -1,7 +1,7 @@
    > > > #!/bin/ksh
    > > > 
    > > > daemon="${TRUEPREFIX}/bin/syncthing"
    > > > -daemon_flags="-no-browser"
    > > > +daemon_flags="--no-browser"
    > > > daemon_user="_syncthing"
    > > > 
    > > > . /etc/rc.d/rc.subr
    > > > 
    > > > --
    > > > Best Regards
    > > > Edd Barrett
    > > > 
    > > > https://www.theunixzoo.co.uk
    
    
  • Douglas Silva:

    Upgrade net/syncthing to v2