On Sat, Jun 11, 2016 at 09:27:58AM +0200, Sebastien Marie wrote:
>
> the promises seems correct to me, but patches needs some comments (based
> on your previous description for example).
>
> it is OK semarie@ (with additionnal comments), but I would be glad to
> have maintener point of vue too.
>
> thanks.
Updated patch with comments.
--
Carlin
Index: archivers/par2cmdline/Makefile
===================================================================
RCS file: /cvs/ports/archivers/par2cmdline/Makefile,v
retrieving revision 1.11
diff -u -p -u -r1.11 Makefile
--- archivers/par2cmdline/Makefile 5 Oct 2015 16:50:14 -0000 1.11
+++ archivers/par2cmdline/Makefile 11 Jun 2016 14:44:22 -0000
@@ -5,6 +5,7 @@ COMMENT = command line implementation of
V = 0.6.14
DISTNAME = par2cmdline-$V
DISTFILES = ${DISTNAME}{v$V}.tar.gz
+REVISION = 0
CATEGORIES = archivers
@@ -13,6 +14,7 @@ HOMEPAGE = https://github.com/BlackIkeEa
# GPLv2+
PERMIT_PACKAGE_CDROM = Yes
+# uses pledge()
WANTLIB = c m stdc++
MAINTAINER = Mikolaj Kucharski <[email protected]>
Index: archivers/par2cmdline/patches/patch-configure_ac
===================================================================
RCS file: archivers/par2cmdline/patches/patch-configure_ac
diff -N archivers/par2cmdline/patches/patch-configure_ac
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ archivers/par2cmdline/patches/patch-configure_ac 11 Jun 2016 14:44:22
-0000
@@ -0,0 +1,11 @@
+$OpenBSD$
+--- configure.ac.orig Wed Jun 8 23:30:46 2016
++++ configure.ac Wed Jun 8 23:31:20 2016
+@@ -56,6 +56,7 @@ dnl Checks for library functions.
+ AC_FUNC_MEMCMP
+ AC_CHECK_FUNCS([stricmp] [strcasecmp])
+ AC_CHECK_FUNCS([strchr] [memcpy])
++AC_CHECK_FUNCS([pledge])
+
+ AC_CHECK_FUNCS([getopt] [getopt_long])
+
Index: archivers/par2cmdline/patches/patch-par1repairer_cpp
===================================================================
RCS file: archivers/par2cmdline/patches/patch-par1repairer_cpp
diff -N archivers/par2cmdline/patches/patch-par1repairer_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ archivers/par2cmdline/patches/patch-par1repairer_cpp 11 Jun 2016
14:44:22 -0000
@@ -0,0 +1,25 @@
+$OpenBSD$
+
+pledge:
+ 'par2 repair' with par1 files - stdio rpath cpath
+ once the target files have been opened for writing, wpath is no
+ longer required, cpath must be kept to delete partial files in
+ case of an error
+
+--- par1repairer.cpp.orig Wed Jun 8 23:41:11 2016
++++ par1repairer.cpp Wed Jun 8 23:42:01 2016
+@@ -157,6 +157,14 @@ Result Par1Repairer::Process(const CommandLine &comman
+ if (!CreateTargetFiles())
+ return eFileIOError;
+
++#ifdef HAVE_PLEDGE
++ if (pledge("stdio rpath cpath", NULL) == -1)
++ {
++ cerr << "pledge failed" << endl;
++ return eLogicError;
++ }
++#endif
++
+ // Work out which data blocks are available, which need to be
recreated,
+ // and compute the appropriate Reed Solomon matrix.
+ if (!ComputeRSmatrix())
Index: archivers/par2cmdline/patches/patch-par2cmdline_cpp
===================================================================
RCS file: archivers/par2cmdline/patches/patch-par2cmdline_cpp
diff -N archivers/par2cmdline/patches/patch-par2cmdline_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ archivers/par2cmdline/patches/patch-par2cmdline_cpp 11 Jun 2016 14:44:22
-0000
@@ -0,0 +1,57 @@
+$OpenBSD$
+
+pledge:
+ 'par2 create' - stdio rpath wpath cpath
+ creates and writes par files
+
+ 'par2 repair' - stdio rpath wpath cpath
+ renames and deletes partial/damaged files, writes repaired files
+
+ 'par2 verify' - stdio rpath cpath
+ may delete par files, only if -p option was given, otherwise
+ cpath is not required
+
+--- par2cmdline.cpp.orig Wed Jun 8 23:31:42 2016
++++ par2cmdline.cpp Wed Jun 8 23:38:36 2016
+@@ -34,6 +34,14 @@ int main(int argc, char *argv[])
+ _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_ALLOC_MEM_DF |
/*_CRTDBG_CHECK_CRT_DF | */_CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
+ #endif
+
++#ifdef HAVE_PLEDGE
++ if (pledge("stdio rpath wpath cpath", NULL) == -1)
++ {
++ cerr << "pledge failed" << endl;
++ return eLogicError;
++ }
++#endif
++
+ // Parse the command line
+ CommandLine *commandline = new CommandLine;
+
+@@ -55,6 +63,26 @@ int main(int argc, char *argv[])
+ break;
+ case CommandLine::opVerify:
+ {
++#ifdef HAVE_PLEDGE
++ if (!commandline->GetPurgeFiles())
++ {
++ if (pledge("stdio rpath", NULL) == -1)
++ {
++ cerr << "pledge failed" << endl;
++ result = eLogicError;
++ break;
++ }
++ }
++ else
++ {
++ if (pledge("stdio rpath cpath", NULL) == -1)
++ {
++ cerr << "pledge failed" << endl;
++ result = eLogicError;
++ break;
++ }
++ }
++#endif
+ // Verify damaged files
+ switch (commandline->GetVersion())
+ {
Index: archivers/par2cmdline/patches/patch-par2repairer_cpp
===================================================================
RCS file: archivers/par2cmdline/patches/patch-par2repairer_cpp
diff -N archivers/par2cmdline/patches/patch-par2repairer_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ archivers/par2cmdline/patches/patch-par2repairer_cpp 11 Jun 2016
14:44:22 -0000
@@ -0,0 +1,25 @@
+$OpenBSD$
+
+pledge:
+ 'par2 repair' with par2 files - stdio rpath cpath
+ once the target files have been opened for writing, wpath is no
+ longer required, cpath must be kept to delete partial files in
+ case of an error
+
+--- par2repairer.cpp.orig Wed Jun 8 23:38:53 2016
++++ par2repairer.cpp Wed Jun 8 23:41:00 2016
+@@ -193,6 +193,14 @@ Result Par2Repairer::Process(const CommandLine &comman
+ if (!CreateTargetFiles())
+ return eFileIOError;
+
++#ifdef HAVE_PLEDGE
++ if (pledge("stdio rpath cpath", NULL) == -1)
++ {
++ cerr << "pledge failed" << endl;
++ return eLogicError;
++ }
++#endif
++
+ // Work out which data blocks are available, which need to be copied
+ // directly to the output, and which need to be recreated, and compute
+ // the appropriate Reed Solomon matrix.