From 4eb48259ea47067f52772e7cbf3d7345c3bf988c Mon Sep 17 00:00:00 2001 From: Sören Tempel Date: Tue, 29 Sep 2020 20:46:08 +0200 Subject: community/pdfgrep: prevent crash if LANG is not set explicitly --- community/pdfgrep/APKBUILD | 8 +++++--- community/pdfgrep/no-locale.patch | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 community/pdfgrep/no-locale.patch diff --git a/community/pdfgrep/APKBUILD b/community/pdfgrep/APKBUILD index 16c09427e1c..b8de6666242 100644 --- a/community/pdfgrep/APKBUILD +++ b/community/pdfgrep/APKBUILD @@ -3,7 +3,7 @@ # Maintainer: André Klitzing pkgname=pdfgrep pkgver=2.1.2 -pkgrel=4 +pkgrel=5 pkgdesc="Commandline utility to search text in PDF files" url="https://pdfgrep.org/" arch="all" @@ -13,7 +13,8 @@ checkdepends="dejagnu texlive" subpackages="$pkgname-doc $pkgname-zsh-completion:zshcomp:noarch $pkgname-bash-completion:bashcomp:noarch" -source="https://pdfgrep.org/download/${pkgname}-${pkgver}.tar.gz" +source="https://pdfgrep.org/download/${pkgname}-${pkgver}.tar.gz + no-locale.patch" options="!check" # multiple failures builddir="$srcdir/$pkgname-$pkgver" @@ -56,4 +57,5 @@ zshcomp() { "$subpkgdir"/usr/share/zsh/site-functions } -sha512sums="27bc4741e5203b2fd265815a22ad8d702b3455b2ae932641b040fc9ce615bc9ff0abef221eb2ec8aa59c79cb139d31184261d076f9731177129a473d62aa4e5c pdfgrep-2.1.2.tar.gz" +sha512sums="27bc4741e5203b2fd265815a22ad8d702b3455b2ae932641b040fc9ce615bc9ff0abef221eb2ec8aa59c79cb139d31184261d076f9731177129a473d62aa4e5c pdfgrep-2.1.2.tar.gz +0908a622202e7955d529befbbb87e2c521693e150bd3911ea459ce0f870ddea737afd0504a60038c3f2c71630fdb92d64e6401ae6e70e756583fb99c18aedb64 no-locale.patch" diff --git a/community/pdfgrep/no-locale.patch b/community/pdfgrep/no-locale.patch new file mode 100644 index 00000000000..d450055abe5 --- /dev/null +++ b/community/pdfgrep/no-locale.patch @@ -0,0 +1,31 @@ +Don't set locale explicitly. musl supports UTF-8 by default. + +With this change pdfgrep fails with: + + terminate called after throwing an instance of 'std::runtime_error' + what(): locale::facet::_S_create_c_locale name not valid + Aborted + +Unless LANG is set explicitly. + +Alternative solutions: + + * Use the "C" lang instead of the "" lang? + * Catch the error and ignore it? + +diff -upr pdfgrep-2.1.2.orig/src/pdfgrep.cc pdfgrep-2.1.2/src/pdfgrep.cc +--- pdfgrep-2.1.2.orig/src/pdfgrep.cc 2020-09-29 12:33:50.018014326 +0200 ++++ pdfgrep-2.1.2/src/pdfgrep.cc 2020-09-29 12:36:39.827698175 +0200 +@@ -457,10 +457,12 @@ int main(int argc, char** argv) + Options options; + init_colors(options.outconf.colors); + ++#if 0 + // Set locale to user-preference. If this locale is an UTF-8 locale, the + // regex-functions regcomp/regexec become unicode aware, which means + // e.g. that '.' will match a unicode character, not a single byte. + locale::global(locale("")); ++#endif + + enum re_engine_type { + RE_POSIX = 0, -- cgit v1.2.3