Thursday, January 01, 2026

net/syncthing: fix hard-coded paths in patch

Hi,

I recently noticed hard-coded paths in a syncthing patch. Below is a diff to
fix that.

I had planned to to the SUBST_CMD in a pre-configure, but that doesn't work as
expected in go ports. Is what I've done instead correct?

Syncthing is still able to open a broswer and restart itself after this change.

I bumped, even though it'd only matter if you installed packages somewhere
other than the default /usr/local.

OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/net/syncthing/Makefile,v
diff -u -p -r1.74 Makefile
--- Makefile 1 Jan 2026 22:24:37 -0000 1.74
+++ Makefile 1 Jan 2026 23:16:37 -0000
@@ -1,6 +1,7 @@
COMMENT = open decentralized synchronization utility

V = 2.0.12
+REVISION = 0
DISTNAME = syncthing-${V}
DISTFILES = syncthing-source-v${V}${EXTRACT_SUFX}

@@ -28,6 +29,9 @@ MODULES = lang/go
ST_CMDS = syncthing stdiscosrv strelaysrv

MAKE_ENV = GOMAXPROCS=${MAKE_JOBS}
+
+pre-build:
+ ${SUBST_CMD} ${WRKSRC}/cmd/syncthing/main.go

# If at any point quic is busted for our in-tree go version, then you can
# temporarily add `-tags noquic` to at least get syncthing building (albeit
Index: patches/patch-cmd_syncthing_main_go
===================================================================
RCS file: /cvs/ports/net/syncthing/patches/patch-cmd_syncthing_main_go,v
diff -u -p -r1.4 patch-cmd_syncthing_main_go
--- patches/patch-cmd_syncthing_main_go 1 Jan 2026 22:24:37 -0000 1.4
+++ patches/patch-cmd_syncthing_main_go 1 Jan 2026 22:57:09 -0000
@@ -23,11 +23,11 @@ Index: cmd/syncthing/main.go
+ panic(err)
+ }
+
-+ if err := unix.Unveil("/usr/local/bin/syncthing", "rx"); err != nil {
++ if err := unix.Unveil("${PREFIX}/bin/syncthing", "rx"); err != nil {
+ panic(err)
+ }
+
-+ if err := unix.Unveil("/usr/local/bin/xdg-open", "rx"); err != nil {
++ if err := unix.Unveil("${LOCALBASE}/bin/xdg-open", "rx"); err != nil {
+ panic(err)
+ }
+

--
Best Regards
Edd Barrett

https://www.theunixzoo.co.uk

No comments:

Post a Comment