On Mon, Jan 18, 2016 at 09:20:01AM -0500, Josh Grosse wrote:
> My first pledge(2) attempt is below, posted for comments.
>
> This promises "stdio rpath wpath cpath fattr" for the 7za and 7zr
> executables. 7z loads codecs through ld.so, and I'm working on
> determining if I can add this same promise after codecs are loaded,
> but it is not pledged in this early attempt.
The patch below now includes the same promise string for 7z, inserted
after codecs are loaded.
If there are no comments, I believe this is ready for testing on
other archs. It passes the test suite (make test) on amd64.
Index: Makefile
===================================================================
RCS file: /systems/cvs/ports/archivers/p7zip/Makefile,v
retrieving revision 1.26
diff -u -p -r1.26 Makefile
--- Makefile 16 Nov 2015 22:52:08 -0000 1.26
+++ Makefile 18 Jan 2016 14:04:31 -0000
@@ -6,7 +6,7 @@ COMMENT-main= file archiver with high co
COMMENT-rar= rar modules for p7zip
V= 15.09
-REVISION= 0
+REVISION= 1
DISTNAME= p7zip_${V}_src_all
PKGNAME= p7zip-${V}
PKGNAME-main= p7zip-${V}
Index: patches/patch-CPP_7zip_UI_Console_Main_cpp
===================================================================
RCS file: patches/patch-CPP_7zip_UI_Console_Main_cpp
diff -N patches/patch-CPP_7zip_UI_Console_Main_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-CPP_7zip_UI_Console_Main_cpp 18 Jan 2016 15:05:44 -0000
@@ -0,0 +1,43 @@
+$OpenBSD$
+
+Pledge archivers/p7zip binaries
+
+--- CPP/7zip/UI/Console/Main.cpp.orig Sat Oct 17 11:20:22 2015
++++ CPP/7zip/UI/Console/Main.cpp Mon Jan 18 10:05:31 2016
+@@ -484,6 +484,18 @@ int Main2(
+ #endif
+ )
+ {
++
++// pledge 7za and 7zr at this point, they take different paths than 7z.
++
++#ifndef EXTERNAL_CODECS
++
++ if (pledge("stdio rpath wpath cpath fattr", NULL) == -1) {
++ perror("pledge");
++ exit(1);
++ }
++
++#endif
++
+ #if defined(_WIN32) && !defined(UNDER_CE)
+ SetFileApisToOEM();
+ #endif
+@@ -579,6 +591,17 @@ int Main2(
+ codecs->CaseSensitiveChange = options.CaseSensitiveChange;
+ codecs->CaseSensitive = options.CaseSensitive;
+ ThrowException_if_Error(codecs->Load());
++
++// pledge 7z here
++
++#ifdef EXTERNAL_CODECS
++
++ if (pledge("stdio rpath wpath cpath fattr", NULL) == -1) {
++ perror("pledge");
++ exit(1);
++ }
++
++#endif
+
+ bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
+