Re: pledge archivers/pigz

2018-07-08 Thread Jeremie Courreges-Anglas
On Sat, Jun 30 2018, Klemens Nanni  wrote:
> Similar to gzip in base, further drop promises (de)compressing to stdout
> except for "cpath" which is needed for unlink(2) in pigz.c:cut_short()
> which handles internal errors and SIGINT.
>
> I also tested this with several regress/usr.bin/gzip runs on both amd64
> and sparc64.
>
> While here, do some cleanup and install unpigz as symlink since it's the
> same binary.

You could also install it as a hardlink instead (like upstream does).

> Feedback? OK?

If there's no reason to remove -Wall -Wextra from CFLAGS I'd rather keep
them, they might spot problems.  Else ok jca@

(Also ok for the maintainer change.)

> Index: Makefile
> ===
> RCS file: /cvs/ports/archivers/pigz/Makefile,v
> retrieving revision 1.6
> diff -u -p -r1.6 Makefile
> --- Makefile  25 Jan 2018 10:34:49 -  1.6
> +++ Makefile  30 Jun 2018 16:13:03 -
> @@ -5,7 +5,8 @@ NOT_FOR_ARCHS=${GCC3_ARCHS}
>  
>  COMMENT =parallel implementation of gzip utilizing multiple cores
>  
> -DISTNAME =   pigz-2.4
> +DISTNAME =   pigz-2.4
> +REVISION =   0
>  CATEGORIES = archivers
>  HOMEPAGE =   https://zlib.net/pigz/
>  
> @@ -14,17 +15,19 @@ MAINTAINER =  Thomas Pfaff   # zlib + Apache
>  PERMIT_PACKAGE_CDROM =   Yes
>  
> +# uses pledge()
>  WANTLIB =c m pthread z
>  
> -MASTER_SITES =   ${HOMEPAGE}
> +MASTER_SITES =   https://zlib.net/pigz/
>  
> -MAKE_FLAGS = CC="${CC}" CFLAGS="${CFLAGS} -Wall -Wextra"
> +MAKE_FLAGS = CC="${CC}" \
> + CFLAGS="${CFLAGS}"
>  
>  ALL_TARGET = pigz
>  
>  do-install:
> - ${INSTALL_PROGRAM} ${WRKSRC}/pigz ${PREFIX}/bin
> - ${INSTALL_PROGRAM} ${WRKSRC}/unpigz ${PREFIX}/bin
> + ${INSTALL_PROGRAM} ${WRKBUILD}/pigz ${PREFIX}/bin
> + ln -sf pigz ${PREFIX}/bin/unpigz
>   ${INSTALL_MAN} ${WRKSRC}/pigz.1 ${PREFIX}/man/man1
>  
>  .include 
> Index: patches/patch-pigz_c
> ===
> RCS file: patches/patch-pigz_c
> diff -N patches/patch-pigz_c
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ patches/patch-pigz_c  30 Jun 2018 15:37:37 -
> @@ -0,0 +1,30 @@
> +$OpenBSD$
> +
> +Index: pigz.c
> +--- pigz.c.orig
>  pigz.c
> +@@ -4307,6 +4307,11 @@ int main(int argc, char **argv) {
> + char *opts, *p; // environment default options, marker
> + ball_t err; // error information from throw()
> + 
> ++if (pledge("stdio rpath wpath cpath fattr chown", NULL) == -1) {
> ++complain("pledge");
> ++exit(1);
> ++}
> ++
> + g.ret = 0;
> + try {
> + // initialize globals
> +@@ -4408,6 +4413,12 @@ int main(int argc, char **argv) {
> + else if (option(argv[n]))   // process argument
> + argv[n] = NULL; // remove if option
> + option(NULL);   // check for missing parameter
> ++
> ++if (g.pipeout || g.decode == 2)
> ++if (pledge("stdio rpath cpath", NULL) == -1) {
> ++complain("pledge");
> ++exit(1);
> ++}
> + 
> + // process command-line filenames
> + done = 0;
> Index: pkg/PLIST
> ===
> RCS file: /cvs/ports/archivers/pigz/pkg/PLIST,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 PLIST
> --- pkg/PLIST 1 Dec 2013 03:19:13 -   1.1.1.1
> +++ pkg/PLIST 30 Jun 2018 16:13:03 -
> @@ -1,4 +1,4 @@
>  @comment $OpenBSD: PLIST,v 1.1.1.1 2013/12/01 03:19:13 brad Exp $
>  @bin bin/pigz
> -@bin bin/unpigz
> +bin/unpigz
>  @man man/man1/pigz.1
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: pledge archivers/pigz

2018-07-06 Thread Klemens Nanni
On Thu, Jul 05, 2018 at 03:19:39PM +0200, Thomas Pfaff wrote:
> If someone wants to take over as maintainer that'd be nice.  I use
> the port but unfortunately I don't have the time to do my duties as
> maintainer.
Would you still update to that diff and confirm that it works for you?

I can take over as maintainer.



Re: pledge archivers/pigz

2018-07-05 Thread Thomas Pfaff
[...]
> While here, do some cleanup and install unpigz as symlink since it's the
> same binary.
> 
> Feedback? OK?

If someone wants to take over as maintainer that'd be nice.  I use
the port but unfortunately I don't have the time to do my duties as
maintainer.

> Index: Makefile
> ===
> RCS file: /cvs/ports/archivers/pigz/Makefile,v
> retrieving revision 1.6
> diff -u -p -r1.6 Makefile
> --- Makefile  25 Jan 2018 10:34:49 -  1.6
> +++ Makefile  30 Jun 2018 16:13:03 -
> @@ -5,7 +5,8 @@ NOT_FOR_ARCHS=${GCC3_ARCHS}
>  
>  COMMENT =parallel implementation of gzip utilizing multiple cores
>  
> -DISTNAME =   pigz-2.4
> +DISTNAME =   pigz-2.4
> +REVISION =   0
>  CATEGORIES = archivers
>  HOMEPAGE =   https://zlib.net/pigz/
>  
> @@ -14,17 +15,19 @@ MAINTAINER =  Thomas Pfaff 

pledge archivers/pigz

2018-06-30 Thread Klemens Nanni
Similar to gzip in base, further drop promises (de)compressing to stdout
except for "cpath" which is needed for unlink(2) in pigz.c:cut_short()
which handles internal errors and SIGINT.

I also tested this with several regress/usr.bin/gzip runs on both amd64
and sparc64.

While here, do some cleanup and install unpigz as symlink since it's the
same binary.

Feedback? OK?

Index: Makefile
===
RCS file: /cvs/ports/archivers/pigz/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- Makefile25 Jan 2018 10:34:49 -  1.6
+++ Makefile30 Jun 2018 16:13:03 -
@@ -5,7 +5,8 @@ NOT_FOR_ARCHS=  ${GCC3_ARCHS}
 
 COMMENT =  parallel implementation of gzip utilizing multiple cores
 
-DISTNAME = pigz-2.4
+DISTNAME = pigz-2.4
+REVISION = 0
 CATEGORIES =   archivers
 HOMEPAGE = https://zlib.net/pigz/
 
@@ -14,17 +15,19 @@ MAINTAINER =Thomas Pfaff https://zlib.net/pigz/
 
-MAKE_FLAGS =   CC="${CC}" CFLAGS="${CFLAGS} -Wall -Wextra"
+MAKE_FLAGS =   CC="${CC}" \
+   CFLAGS="${CFLAGS}"
 
 ALL_TARGET =   pigz
 
 do-install:
-   ${INSTALL_PROGRAM} ${WRKSRC}/pigz ${PREFIX}/bin
-   ${INSTALL_PROGRAM} ${WRKSRC}/unpigz ${PREFIX}/bin
+   ${INSTALL_PROGRAM} ${WRKBUILD}/pigz ${PREFIX}/bin
+   ln -sf pigz ${PREFIX}/bin/unpigz
${INSTALL_MAN} ${WRKSRC}/pigz.1 ${PREFIX}/man/man1
 
 .include 
Index: patches/patch-pigz_c
===
RCS file: patches/patch-pigz_c
diff -N patches/patch-pigz_c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-pigz_c30 Jun 2018 15:37:37 -
@@ -0,0 +1,30 @@
+$OpenBSD$
+
+Index: pigz.c
+--- pigz.c.orig
 pigz.c
+@@ -4307,6 +4307,11 @@ int main(int argc, char **argv) {
+ char *opts, *p; // environment default options, marker
+ ball_t err; // error information from throw()
+ 
++if (pledge("stdio rpath wpath cpath fattr chown", NULL) == -1) {
++complain("pledge");
++exit(1);
++}
++
+ g.ret = 0;
+ try {
+ // initialize globals
+@@ -4408,6 +4413,12 @@ int main(int argc, char **argv) {
+ else if (option(argv[n]))   // process argument
+ argv[n] = NULL; // remove if option
+ option(NULL);   // check for missing parameter
++
++if (g.pipeout || g.decode == 2)
++if (pledge("stdio rpath cpath", NULL) == -1) {
++complain("pledge");
++exit(1);
++}
+ 
+ // process command-line filenames
+ done = 0;
Index: pkg/PLIST
===
RCS file: /cvs/ports/archivers/pigz/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 PLIST
--- pkg/PLIST   1 Dec 2013 03:19:13 -   1.1.1.1
+++ pkg/PLIST   30 Jun 2018 16:13:03 -
@@ -1,4 +1,4 @@
 @comment $OpenBSD: PLIST,v 1.1.1.1 2013/12/01 03:19:13 brad Exp $
 @bin bin/pigz
-@bin bin/unpigz
+bin/unpigz
 @man man/man1/pigz.1