One test still fails for me: Running ./pdfgrep.tests/regex.exp ... FAIL: Empty pattern -- error from pdfgrep
Indeed, when pdfgrep is called with argument "", instead of matching every line it exits with error pdfgrep: empty (sub)expression This happens because our regex(3) doesn't allow empty patterns. As far as I can tell, this behavior is undesirable in something called "*grep", so I added a quirk for this particular use case. Other comments: In Makefile: > -MODULES = gcc4 > -MODGCC4_ARCHS = * > -MODGCC4_LANGS = c++ > +MODULES = gcc4 > +MODGCC4_ARCHS = * > +MODGCC4_LANGS = c++ Whitespace change. Why? > +TEST_DEPENDS = devel/dejagnu print/texlive/base Again, expanded space. In patches/patch-src-pdfgrep.cc: | + if (pledge("stdio rpath ioctl", NULL) == -1) { | + fprintf ( stderr, "pdfgrep: pledge\n" ); | + exit ( 1 ); | + } | + [...] | + | + if (pledge("stdio rpath", NULL) == -1) { | + fprintf ( stderr, "pdfgrep: pledge\n" ); | + exit ( 1 ); | + } I don't see a point in first pledge. As a matter of fact, I wouldn't pledge this port unless upstream is ready to accept pledge. And upstream will definitely not accept pledge without #ifdef. In patches/patch-testsuite-lib-pdfgrep.exp: | -set pdfdir [exec mktemp --tmpdir -d pdfgrep_tests.XXXXXXXXXX] | +set pdfdir [exec mktemp -d /tmp/pdfgrep_tests.XXXXXXXXXX] I'd use "mktemp -td pdfgrep_tests.XXXXXXXXXX]": this form still allows altering temporary directory, and upstream may want to use portable syntax. Patch with my corrections follow. I left second pledge in case people want it, although it will take much more work to make this patch upstreamable. -- Dmitrij D. Czarkoff --- Makefile.orig Tue Aug 25 18:28:04 2015 +++ Makefile Fri Jan 15 12:28:50 2016 @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.3 2015/08/25 16:28:04 jca Exp $ +# $OpenBSD: Makefile,v 1.4 2015/08/25 16:28:04 jca Exp $ COMMENT = tool to search text in PDF files -DISTNAME = pdfgrep-1.4.0 +DISTNAME = pdfgrep-1.4.1 CATEGORIES = textproc @@ -17,11 +17,12 @@ MODGCC4_ARCHS = * MODGCC4_LANGS = c++ -WANTLIB += c m pthread stdc++ poppler-cpp pcre +WANTLIB += c m pthread poppler-cpp pcre MASTER_SITES = https://pdfgrep.org/download/ LIB_DEPENDS = print/poppler +TEST_DEPENDS = devel/dejagnu print/texlive/base CONFIGURE_ENV = LDFLAGS="-L${X11BASE}/lib" CONFIGURE_STYLE = gnu --- distinfo.orig Tue Aug 25 18:28:04 2015 +++ distinfo Fri Jan 15 10:35:39 2016 @@ -1,2 +1,2 @@ -SHA256 (pdfgrep-1.4.0.tar.gz) = MwwRG5GpIRbVpnZsGx0i3NeVkonXNHHZNEsLBHX8quI= -SIZE (pdfgrep-1.4.0.tar.gz) = 125269 +SHA256 (pdfgrep-1.4.1.tar.gz) = 2wSiEOa7e3fNbFSxfw9v7Q0SOoX5elQbJwc2pdOEDyw= +SIZE (pdfgrep-1.4.1.tar.gz) = 151926 --- patches/patch-src_pdfgrep_cc.orig Fri Jan 15 13:19:30 2016 +++ patches/patch-src_pdfgrep_cc Fri Jan 15 12:44:28 2016 @@ -0,0 +1,15 @@ +$OpenBSD$ +--- src/pdfgrep.cc.orig Wed Sep 16 22:06:49 2015 ++++ src/pdfgrep.cc Fri Jan 15 12:29:06 2016 +@@ -775,6 +775,11 @@ int main(int argc, char** argv) + context = -1; + } + ++ if (pledge("stdio rpath", NULL) == -1) { ++ fprintf(stderr, "pdfgrep: pledge\n"); ++ exit(1); ++ } ++ + if (excludes_empty(includes)) + exclude_add(includes, "*.pdf"); + --- patches/patch-src_regengine_cc.orig Fri Jan 15 13:19:30 2016 +++ patches/patch-src_regengine_cc Fri Jan 15 13:07:54 2016 @@ -0,0 +1,13 @@ +$OpenBSD$ +--- src/regengine.cc.orig Fri Jan 15 13:06:26 2016 ++++ src/regengine.cc Fri Jan 15 13:07:45 2016 +@@ -34,6 +34,9 @@ PosixRegex::PosixRegex(const char *pattern, bool case_ + { + int regex_flags = REG_EXTENDED | (case_insensitive ? REG_ICASE : 0); + ++ if (strncmp(pattern, "", 2) == 0) { ++ pattern = "()"; ++ } + int err = regcomp(&this->regex, pattern, regex_flags); + if(err) { + char err_msg[256]; --- patches/patch-testsuite_Makefile_in.orig Fri Jan 15 13:19:30 2016 +++ patches/patch-testsuite_Makefile_in Fri Jan 15 13:19:11 2016 @@ -0,0 +1,14 @@ +$OpenBSD$ +--- testsuite/Makefile.in.orig Thu Sep 24 21:32:33 2015 ++++ testsuite/Makefile.in Fri Jan 15 13:18:59 2016 +@@ -641,10 +641,3 @@ uninstall-am: + tags-am uninstall uninstall-am + + .PRECIOUS: Makefile +- +- +-export DEJAGNU +- +-# Tell versions [3.59,3.63) of GNU make to not export all variables. +-# Otherwise a system limit (for SysV at least) may be exceeded. +-.NOEXPORT: --- patches/patch-testsuite_lib_pdfgrep_exp.orig Fri Jan 15 13:19:30 2016 +++ patches/patch-testsuite_lib_pdfgrep_exp Fri Jan 15 11:12:21 2016 @@ -0,0 +1,12 @@ +$OpenBSD$ +--- testsuite/lib/pdfgrep.exp.orig Wed Jan 13 15:06:57 2016 ++++ testsuite/lib/pdfgrep.exp Wed Jan 13 15:12:42 2016 +@@ -213,7 +213,7 @@ proc reset_configuration {} { + + # The directory where the PDFs will be generated. + # NOTE This will frequently be removed, so don't put important data there +-set pdfdir [exec mktemp --tmpdir -d pdfgrep_tests.XXXXXXXXXX] ++set pdfdir [exec mktemp -td pdfgrep_tests.XXXXXXXXXX] + + + # Delete $pdfdir recursively and create it anew --- patches/patch-testsuite_pdfgrep_tests_exit_status_exp.orig Fri Jan 15 13:19:30 2016 +++ patches/patch-testsuite_pdfgrep_tests_exit_status_exp Fri Jan 15 09:26:05 2016 @@ -0,0 +1,19 @@ +$OpenBSD$ +--- testsuite/pdfgrep.tests/exit_status.exp.orig Wed Jan 13 15:07:29 2016 ++++ testsuite/pdfgrep.tests/exit_status.exp Wed Jan 13 15:10:27 2016 +@@ -8,7 +8,7 @@ clear_pdfdir + set pdf [mkpdf exit-status "foobar"] + + pdfgrep foobar $pdf +- ++expect eof + expect_exit_status 0 + + ######################################## +@@ -40,5 +40,5 @@ clear_pdfdir + + # $pdf doesn't exist anymore + pdfgrep foobar $pdf +- ++expect eof + expect_exit_status 2 --- patches/patch-testsuite_pdfgrep_tests_usage_exp.orig Fri Jan 15 13:19:30 2016 +++ patches/patch-testsuite_pdfgrep_tests_usage_exp Fri Jan 15 09:26:05 2016 @@ -0,0 +1,12 @@ +$OpenBSD$ +--- testsuite/pdfgrep.tests/usage.exp.orig Wed Jan 13 15:07:55 2016 ++++ testsuite/pdfgrep.tests/usage.exp Wed Jan 13 15:11:50 2016 +@@ -5,7 +5,7 @@ expect { + -re "^Usage: .*" { pass $test } + default { fail $test } + } +- ++expect eof + expect_exit_status 2 + + # Also look that nothing is written to stdout