NetBSD Problem Report #55553

From www@netbsd.org  Sat Aug  8 22:31:17 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 2A81D1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  8 Aug 2020 22:31:17 +0000 (UTC)
Message-Id: <20200808223116.26B811A923A@mollari.NetBSD.org>
Date: Sat,  8 Aug 2020 22:31:16 +0000 (UTC)
From: osa@FreeBSD.org
Reply-To: osa@FreeBSD.org
To: gnats-bugs@NetBSD.org
Subject: Add new port: www/unit
X-Send-Pr-Version: www-1.0

>Number:         55553
>Category:       pkg
>Synopsis:       Add new port: www/unit
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 08 22:35:00 +0000 2020
>Last-Modified:  Mon Aug 10 21:15:01 +0000 2020
>Originator:     Sergey Osokin
>Release:        NetBSD 9.0
>Organization:
>Environment:
NetBSD netbsd 9.0 NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64

>Description:
Add new pkgsrc: www/unit.

NGINX Unit is a lightweight dynamic open-source server for diverse
web applications; to install it, see here.

Built from scratch, Unit can run web apps in different language
versions; fully configurable in runtime with zero interruption, it
enables on-the-fly granular management for engineering and operations.
>How-To-Repeat:

>Fix:

>Audit-Trail:
From: "Sergey A. Osokin" <osa@freebsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/55553: Add new port: www/unit
Date: Sat, 8 Aug 2020 22:36:19 +0000

 --oLBj+sq0vYjzfsbl
 Content-Type: text/plain; charset=koi8-r
 Content-Disposition: inline

 On Sat, Aug 08, 2020 at 10:35:00PM +0000, gnats-admin@netbsd.org wrote:
 > Thank you very much for your problem report.
 > It has the internal identification `pkg/55553'.
 > The individual assigned to look at your
 > report is: pkg-manager. 
 > 
 > >Category:       pkg
 > >Responsible:    pkg-manager
 > >Synopsis:       Add new port: www/unit
 > >Arrival-Date:   Sat Aug 08 22:35:00 +0000 2020

 Here's the shar file.

 --
 Sergey 

 --oLBj+sq0vYjzfsbl
 Content-Type: text/plain; charset=koi8-r
 Content-Disposition: attachment; filename=patch-netbsd-unit

 # This is a shell archive.  Save it in a file, remove anything before
 # this line, and then unpack it by entering "sh file".  Note, it may
 # create directories; files and directories will be owned by you and
 # have default permissions.
 #
 # This archive contains:
 #
 #	.
 #	./Makefile
 #	./PLIST
 #	./patches
 #	./patches/patch-aa
 #	./patches/patch-ab
 #	./patches/patch-ac
 #	./distinfo
 #	./DESCR
 #
 echo c - .
 mkdir -p . > /dev/null 2>&1
 echo x - ./Makefile
 sed 's/^X//' >./Makefile << 'END-of-./Makefile'
 X# $NetBSD$
 X
 XDISTNAME=	unit-1.18.0
 XCATEGORIES=	www
 XMASTER_SITES=	https://unit.nginx.org/download/
 X
 XMAINTAINER=	osa@FreeBSD.org
 XHOMEPAGE=	https://unit.nginx.org/download/
 XCOMMENT=	Dynamic web application server
 XLICENSE=	apache-2.0
 X
 X.include "../../mk/bsd.prefs.mk"
 X
 XUNIT_USER?=		unit
 XUNIT_GROUP?=		unit
 XUNIT_DATADIR?=		${VARBASE}/db/unit
 XUNIT_LOGDIR?=		${VARBASE}/log/unit
 XUNIT_RUNDIR?=		${VARBASE}/run/unit
 XUNIT_PIDDIR?=		${VARBASE}/run
 XUNIT_TMPDIR?=		${VARBASE}/tmp
 X
 XBUILD_DEFS+=		UNIT_DATADIR UNIT_LOGDIR UNIT_PIDDIR VARBASE
 X
 XPKG_USERS_VARS+=	UNIT_USER
 XPKG_GROUPS_VARS+=       UNIT_GROUP
 XPKG_GROUPS=             ${UNIT_GROUP}
 XPKG_USERS=              ${UNIT_USER}:${UNIT_GROUP}
 X
 XPKG_GECOS.${UNIT_USER}=	NGINX Unit server user
 XPKG_HOME.${UNIT_USER}=	${UNIT_DATADIR}
 XPKG_SHELL.${UNIT_USER}=	${NOLOGIN}
 X
 XUSE_PKGLOCALEDIR=	yes
 XHAS_CONFIGURE=		yes
 XCONFIGURE_ARGS+=	--prefix=${PREFIX}
 XCONFIGURE_ARGS+=	--ld-opt="-L${PREFIX}/lib"
 XCONFIGURE_ARGS+=	--log=${UNIT_LOGDIR}/unit.log
 XCONFIGURE_ARGS+=	--modules=libexec/unit/modules
 XCONFIGURE_ARGS+=	--pid=${UNIT_PIDDIR}/unit.pid
 XCONFIGURE_ARGS+=	--state=libexec/unit
 XCONFIGURE_ARGS+=	--control=unix:${UNIT_RUNDIR}/control.unit.sock
 XCONFIGURE_ARGS+=	--tmp=${UNIT_TMPDIR}
 XCONFIGURE_ARGS+=	--user=${UNIT_USER}
 XCONFIGURE_ARGS+=	--group=${UNIT_GROUP}
 X
 XINSTALLATION_DIRS+=	sbin
 XMAKE_DIRS+=		${UNIT_PIDDIR} ${UNIT_DATADIR} ${UNIT_RUNDIR}
 XOWN_DIRS=		${UNIT_LOGDIR} ${UNIT_RUNDIR}
 XOWN_DIRS_PERMS+=	${UNIT_DATADIR} ${UNIT_USER} ${UNIT_GROUP} 0700
 X
 XUSE_LANGUAGES=	c c++
 X
 X.include "../../mk/bsd.pkg.mk"
 END-of-./Makefile
 echo x - ./PLIST
 sed 's/^X//' >./PLIST << 'END-of-./PLIST'
 X@comment $NetBSD$
 Xsbin/unitd
 X@pkgdir libexec/unit
 END-of-./PLIST
 echo c - ./patches
 mkdir -p ./patches > /dev/null 2>&1
 echo x - ./patches/patch-aa
 sed 's/^X//' >./patches/patch-aa << 'END-of-./patches/patch-aa'
 X--- src/nxt_conn_write.c.orig	2020-05-28 12:04:00.000000000 -0400
 X+++ src/nxt_conn_write.c	2020-08-08 16:49:50.752693316 -0400
 X@@ -266,6 +266,21 @@
 X     res = sendfile(s, fd, &pos, size);
 X #endif
 X 
 X+#ifdef NXT_HAVE_NETBSD_SENDFILE
 X+    struct stat fileinfo;
 X+    void *fmem = NULL;
 X+    res = fstat(fd, &fileinfo);
 X+    if (res == 0) {
 X+        fmem = mmap(NULL, fileinfo.st_size, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0);
 X+    }
 X+    if (fmem != NULL) {
 X+        res = write(s, fmem, fileinfo.st_size);
 X+        munmap(fmem, fileinfo.st_size);
 X+    } else {
 X+        res = -1;
 X+    }
 X+#endif 
 X+
 X     return res;
 X }
 X 
 END-of-./patches/patch-aa
 echo x - ./patches/patch-ab
 sed 's/^X//' >./patches/patch-ab << 'END-of-./patches/patch-ab'
 X--- auto/sendfile.orig	2020-08-08 16:00:55.378410575 -0400
 X+++ auto/sendfile	2020-08-08 16:16:14.270362755 -0400
 X@@ -5,6 +5,7 @@
 X 
 X NXT_HAVE_LINUX_SENDFILE=NO
 X NXT_HAVE_FREEBSD_SENDFILE=NO
 X+NXT_HAVE_NETBSD_SENDFILE=NO
 X NXT_HAVE_MACOSX_SENDFILE=NO
 X NXT_HAVE_SOLARIS_SENDFILEV=NO
 X NXT_HAVE_AIX_SEND_FILE=NO
 X@@ -82,6 +83,34 @@
 X     fi
 X fi
 X 
 X+if [ $nxt_found = no ]; then
 X+
 X+    # NetBSD has no sendfile().
 X+
 X+    nxt_feature="NetBSD mmap()/write()"
 X+    nxt_feature_name=NXT_HAVE_NETBSD_SENDFILE
 X+    nxt_feature_libs=
 X+    nxt_feature_test="#include <sys/types.h>
 X+                      #include <sys/mman.h>
 X+                      #include <sys/stat.h>
 X+                      #include <fcntl.h>
 X+                      #include <unistd.h>
 X+
 X+                      int main() {
 X+                          struct stat f;
 X+                          void *m = NULL;
 X+
 X+                          fstat(-1, &f);
 X+                          m = mmap(NULL, f.st_size, PROT_READ, MAP_FILE | MAP_SHARED, -1, 0);
 X+                          write(-1, m, f.st_size);
 X+                          munmap(m, f.st_size);
 X+                      }"
 X+    . auto/feature
 X+
 X+    if [ $nxt_found = yes ]; then
 X+        NXT_HAVE_NETBSD_SENDFILE=YES
 X+    fi
 X+fi
 X 
 X if [ $nxt_found = no ]; then
 X     $echo
 END-of-./patches/patch-ab
 echo x - ./patches/patch-ac
 sed 's/^X//' >./patches/patch-ac << 'END-of-./patches/patch-ac'
 X--- src/nxt_application.c.orig	2020-08-08 16:28:19.771768606 -0400
 X+++ src/nxt_application.c	2020-08-08 16:33:14.070404193 -0400
 X@@ -474,20 +474,24 @@
 X static nxt_int_t
 X nxt_app_prefork(nxt_task_t *task, nxt_process_t *process, nxt_mp_t *mp)
 X {
 X-    nxt_int_t              cap_setid, cap_chroot;
 X+    nxt_int_t              cap_setid;
 X     nxt_int_t              ret;
 X     nxt_runtime_t          *rt;
 X     nxt_common_app_conf_t  *app_conf;
 X-    nxt_app_lang_module_t  *lang;
 X 
 X     rt = task->thread->runtime;
 X     app_conf = process->data.app;
 X     cap_setid = rt->capabilities.setid;
 X-    cap_chroot = rt->capabilities.chroot;
 X 
 X+#if (NXT_HAVE_ISOLATION_ROOTFS)
 X+    nxt_int_t               cap_chroot;
 X+    nxt_app_lang_module_t  *lang;
 X+
 X+    cap_chroot = rt->capabilities.chroot;
 X     lang = nxt_app_lang_module(rt, &app_conf->type);
 X 
 X     nxt_assert(lang != NULL);
 X+#endif
 X 
 X     if (app_conf->isolation != NULL) {
 X         ret = nxt_app_set_isolation(task, app_conf->isolation, process);
 END-of-./patches/patch-ac
 echo x - ./distinfo
 sed 's/^X//' >./distinfo << 'END-of-./distinfo'
 X$NetBSD$
 X
 XSHA1 (unit-1.18.0.tar.gz) = ef7edf05201ea9b52b2c92e5c9dce3b9fa00cd98
 XRMD160 (unit-1.18.0.tar.gz) = fa25a9e7556fcc34b9d243669a15ae2848d2054e
 XSHA512 (unit-1.18.0.tar.gz) = 2beac69caeb09278a6c2cdafe20a8040e589f9ad6e302c896cd396ae7d576f563dd6a480f815b4a26d22e15592b5abcd927a8ba436517bd9b9bbb78bff3176ff
 XSize (unit-1.18.0.tar.gz) = 742273 bytes
 XSHA1 (patch-aa) = 375d1bd7dd4d6dcdf8446bafeb4c159e5726793f
 XSHA1 (patch-ab) = 8c95b8c57ea56aa0654798f86cc9a4018579a1c4
 XSHA1 (patch-ac) = c488775742bcd55f6d0cbc2d2f0263bc7c7519b7
 END-of-./distinfo
 echo x - ./DESCR
 sed 's/^X//' >./DESCR << 'END-of-./DESCR'
 XNGINX Unit is a lightweight dynamic open-source server for diverse
 Xweb applications; to install it, see here.
 X
 XBuilt from scratch, Unit can run web apps in different language
 Xversions; fully configurable in runtime with zero interruption, it
 Xenables on-the-fly granular management for engineering and operations.
 END-of-./DESCR
 exit


 --oLBj+sq0vYjzfsbl--

From: "Sergey A. Osokin" <osa@freebsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/55553: Add new port: www/unit
Date: Mon, 10 Aug 2020 21:14:25 +0000

 Hi there,

 recent version of this port is available in my repository in GH,
 https://github.com/osokin/unit

 Please let me know if you have any questions.

 Thanks.

 --
 Sergey

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.