Am Saturday, den 23.04.2016, 16:21 +0200 schrieb Sebastien Marie: > On Sat, Apr 23, 2016 at 03:29:33PM +0200, David Dahlberg wrote:
> > BTW, how do I cvs diff over new files? > 1. cp file{,.orig} > 2. edit file, and save > 3. cd /usr/ports/.../ && make update-patches Yes, that's documented in the Porter's Handbook. I was more looking for Stuart's hint: "cvs add", probably was too straigt forward for me ;-) > So I think the pledge promises are incomplete and/or the pledge call > is > misplaced. [..] > I will try to (re?)present differents ways to efficiently adds pledge > a > program: [..] Thanks a lot for your comprehensive instructions. I leaned a lot and will have to continue to do so (esp.the mapping symbols to pledge(2) promises part). With what you described as the "dynamic approach", I found at least the missing "getpw", though I seem to have skipped the "-o" argument for some reason. Attached is a patch that has a first pledge after setlocale, and a second call the command line parsing, which removes write access. I bid somebody with better C skills in using debuggers and reading symbols than me to check, whether this should be sufficient. Steve, didn't you volunteer? ;-) Cheers, David Index: Makefile =================================================================== RCS file: /cvs/ports/sysutils/colortree/Makefile,v retrieving revision 1.3 diff -u -p -u -p -r1.3 Makefile --- Makefile 23 Apr 2016 14:08:41 -0000 1.3 +++ Makefile 23 Apr 2016 18:32:23 -0000 @@ -6,7 +6,7 @@ V = 1.7.0 DISTNAME = tree-$V PKGNAME= colortree-$V CATEGORIES = sysutils -REVISION = 1 +REVISION = 2 HOMEPAGE = http://mama.indstate.edu/users/ice/tree/ @@ -15,6 +15,7 @@ MAINTAINER = David Dahlberg <david+bsd@d # GPLv2+ PERMIT_PACKAGE_CDROM = Yes +# uses pledge() WANTLIB = c MASTER_SITES = http://mama.indstate.edu/users/ice/tree/src/ Index: patches/patch-tree_c =================================================================== RCS file: patches/patch-tree_c diff -N patches/patch-tree_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-tree_c 23 Apr 2016 18:32:23 -0000 @@ -0,0 +1,27 @@ +$OpenBSD$ +--- tree.c.orig Wed Apr 23 23:38:24 2014 ++++ tree.c Sat Apr 23 19:53:42 2016 +@@ -106,6 +106,11 @@ int main(int argc, char **argv) + setlocale(LC_CTYPE, ""); + setlocale(LC_COLLATE, ""); + ++ if (pledge("stdio rpath wpath cpath getpw", NULL) == -1){ ++ fprintf(stderr, "%s: pledge\n", argv[0]); ++ exit(1); ++ } ++ + charset = getcharset(); + if (charset == NULL && strcmp(nl_langinfo(CODESET), "UTF-8") == 0) { + charset = "UTF-8"; +@@ -450,6 +455,11 @@ int main(int argc, char **argv) + fprintf(stderr,"tree: invalid filename '%s'\n",outfilename); + exit(1); + } ++ } ++ ++ if (pledge("stdio rpath getpw", NULL) == -1){ ++ fprintf(stderr, "%s: pledge\n", argv[0]); ++ exit(1); + } + + parse_dir_colors();