Tracey Emery <[email protected]> writes:
> On Thu, Jan 20, 2022 at 10:07:13AM +0100, Omar Polo wrote:
>> Hello ports,
>>
>> Please find attached a diff to update net/gophernicus to the latest
>> version.
>>
>> The changelog for 3.1.0 is quite interesting, as they added pledge(2)
>> and unveil(2) support and changed the build system (among other things.)
>> 3.1.1 is just some bugfixes on the build system.
>>
>> Unfortunately the pledge/unveil support is disabled by default and a few
>> command line switches are needed to enable it: gophernicus uses shared
>> memory and allows exec'ing arbitrary scripts from gophermaps, so one
>> needs at least -nm and -nx to respectively disable them to run under
>> pledge and unveil. -nu disables serving from users home directory and
>> seems tightens it a bit more. That's why I've changed the pkg/README to
>> suggest running with those flags.
>>
>> Some installed files (such as TODO) are not available anymore, and since
>> I was there I've also removed INSTALL.md as I don't see any reason to
>> install it too.
>>
>> This still keeps gophernicus installed as libexec/in.gophernicus to
>> avoid breaking existing setups.
>>
>> As I've only tested it on localhost, some real world usage is much
>> appreciated :)
>>
>>
>
> Do you think the pkg_readme could be improved by pointing users to rcctl
> enable inetd and rcctl start/restart inetd?
>
> Just an idea. I'm not sure what we do for other ports that have these
> kind of daemon requirements.
The only other port that uses inetd that comes to mind is net/vger and
that points to rcctl enable/start inetd. It's questionable, but I agree
on pointing users to rcctl.
Here's an updated diff that tweaks pkg/README a bit more:
- I've dropped the "setting up a gopher site" title. There's already a
"running gophernicus on OpenBSD" and it felt redundant.
- tweaked the paragraph regarding inetd to point the reader to rcctl(8)
and show how enable and start inetd, loosely inspired from net/vger.
I think it reads better now, but comments/critics are welcome.
Regarding the update itself, I've found a small issue: there a couple of
code path that ends up calling *printf with NULL instead of a string.
Not a huge issue, just annoying to see log entries like:
Jan 20 16:26:32 venera in.gophernicus: vfprintf %s NULL in "Error: %s %s\^M "
for each not found file. (easy repro: printf 'foobar\r\n' |
/usr/local/libexec/in.gophernicus -h localhost). grep gophernicus.c for
`die' when the second argument is NULL. It's present in the master
branch too, i'll report it upstream soon. It's worth to keep a local
patch for that?
Index: Makefile
===================================================================
RCS file: /home/cvs/ports/net/gophernicus/Makefile,v
retrieving revision 1.20
diff -u -p -r1.20 Makefile
--- Makefile 13 Feb 2021 14:13:37 -0000 1.20
+++ Makefile 20 Jan 2022 15:14:32 -0000
@@ -1,11 +1,9 @@
# $OpenBSD: Makefile,v 1.20 2021/02/13 14:13:37 bcallah Exp $
COMMENT= modern gopher server
-REVISION = 0
-GH_ACCOUNT= gophernicus
-GH_PROJECT= gophernicus
-GH_TAGNAME= v3.0.1
+V= 3.1.1
+DISTNAME= gophernicus-${V}
CATEGORIES= net
@@ -14,19 +12,26 @@ HOMEPAGE= gopher://gophernicus.org/
# BSD
PERMIT_PACKAGE= Yes
+# uses pledge
+# uses unveil
WANTLIB += c
+MASTER_SITES=
https://github.com/gophernicus/gophernicus/releases/download/${V}/
+
+CONFIGURE_STYLE= simple
+CONFIGURE_ARGS= --listener=inetd
+
MAKE_FLAGS= CC="${CC}" CFLAGS="${CFLAGS}"
NO_TEST= Yes
do-install:
- ${INSTALL_PROGRAM} ${WRKSRC}/gophernicus
${PREFIX}/libexec/in.gophernicus
+ ${INSTALL_PROGRAM} ${WRKSRC}/src/gophernicus
${PREFIX}/libexec/in.gophernicus
+ ${INSTALL_MAN} ${WRKSRC}/gophernicus.8 ${PREFIX}/man/man8
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/gophernicus
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/gophernicus
- cd ${WRKSRC} && ${INSTALL_DATA} LICENSE README INSTALL.md \
- TODO README.Gophermap gophertag \
- ${PREFIX}/share/doc/gophernicus/
- cd ${WRKSRC} && ${INSTALL_DATA} gophermap \
- ${PREFIX}/share/examples/gophernicus/
+ cd ${WRKSRC} && ${INSTALL_DATA} LICENSE README.md README.gophermap \
+ gophertag ${PREFIX}/share/doc/gophernicus/
+ ${INSTALL_DATA} ${WRKSRC}/gophermap.sample \
+ ${PREFIX}/share/examples/gophernicus/gophermap
.include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /home/cvs/ports/net/gophernicus/distinfo,v
retrieving revision 1.10
diff -u -p -r1.10 distinfo
--- distinfo 6 Feb 2020 18:06:10 -0000 1.10
+++ distinfo 19 Jan 2022 21:43:34 -0000
@@ -1,2 +1,2 @@
-SHA256 (gophernicus-3.0.1.tar.gz) =
Fl/SrU+wY430FHFJa7rGgiA6FdBdX3RhiFhYFyE4vJY=
-SIZE (gophernicus-3.0.1.tar.gz) = 52525
+SHA256 (gophernicus-3.1.1.tar.gz) =
p4ROSqLhry9C0Z5bM+vswcK0ehnUvVkeddKVdSVL97Q=
+SIZE (gophernicus-3.1.1.tar.gz) = 55234
Index: patches/patch-gophernicus_c
===================================================================
RCS file: patches/patch-gophernicus_c
diff -N patches/patch-gophernicus_c
--- patches/patch-gophernicus_c 13 Feb 2021 14:13:37 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-gophernicus_c,v 1.1 2021/02/13 14:13:37 bcallah Exp $
-
-We don't have libwrap, and these cause issues with -fno-common
-
-Index: gophernicus.c
---- gophernicus.c.orig
-+++ gophernicus.c
-@@ -30,8 +30,6 @@
- * Libwrap needs these defined
- */
- #ifdef HAVE_LIBWRAP
--int allow_severity = LOG_DEBUG;
--int deny_severity = LOG_ERR;
- #endif
-
-
Index: pkg/PLIST
===================================================================
RCS file: /home/cvs/ports/net/gophernicus/pkg/PLIST,v
retrieving revision 1.4
diff -u -p -r1.4 PLIST
--- pkg/PLIST 6 Feb 2020 18:06:10 -0000 1.4
+++ pkg/PLIST 20 Jan 2022 09:38:57 -0000
@@ -2,12 +2,11 @@
@newgroup _gophernicus:704
@newuser _gophernicus:704:704:daemon:Gophernicus Gopher
Server:/nonexistent:/sbin/nologin
@bin libexec/in.gophernicus
+@man man/man8/gophernicus.8
share/doc/gophernicus/
-share/doc/gophernicus/INSTALL.md
share/doc/gophernicus/LICENSE
-share/doc/gophernicus/README
-share/doc/gophernicus/README.Gophermap
-share/doc/gophernicus/TODO
+share/doc/gophernicus/README.gophermap
+share/doc/gophernicus/README.md
share/doc/gophernicus/gophertag
@mode 755
@owner root
Index: pkg/README
===================================================================
RCS file: /home/cvs/ports/net/gophernicus/pkg/README,v
retrieving revision 1.5
diff -u -p -r1.5 README
--- pkg/README 4 Sep 2018 12:46:17 -0000 1.5
+++ pkg/README 20 Jan 2022 15:18:33 -0000
@@ -4,23 +4,22 @@ $OpenBSD: README,v 1.5 2018/09/04 12:46:
| Running ${PKGSTEM} on OpenBSD
+-----------------------------------------------------------------------
-Setting up a gopher site
-========================
-
After installing the gophernicus package, edit /etc/inetd.conf and add
the following, all on one line:
-gopher stream tcp nowait _gophernicus ${TRUEPREFIX}/libexec/in.gophernicus
in.gophernicus -h "hostname"
+gopher stream tcp nowait _gophernicus ${TRUEPREFIX}/libexec/in.gophernicus
in.gophernicus -h "hostname" -nm -nu -nx
Replace "hostname" with the system's hostname, this should be valid
and resolvable as it is used to construct links.
-inetd(8) must be reloaded (or started). To enable it at boot, the
-following line needs to be added to rc.conf.local(8):
-inetd_flags=
+inetd(8) must then be enabled and started:
+
+ # rcctl enable inetd
+ # rcctl start inetd
By default Gophernicus serves documents from /var/gopher and will
only serve files which are world-readable; being readable by the
server process is not enough.
-For more information, see ${TRUEPREFIX}/share/doc/gophernicus/README.
+For more information, see gophernicus(8) and
+${TRUEPREFIX}/share/doc/gophernicus/README.md.