summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorGordonGR2018-04-02 15:10:30 +0300
committerGordonGR2018-04-02 15:10:30 +0300
commitd61a02551e4d960544a726ff4d3eeb1761db7f9e (patch)
tree7305c863b4b789e2956fe44a91a354357107963f
parent8abc0d299539b76bba7720e20339119f38419b21 (diff)
downloadaur-lib32-enca.tar.gz
1.19-2: Add patch for FS#57881
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD13
-rw-r--r--enca-bad-file-descriptor.patch35
3 files changed, 49 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index d824197e72a..715a9f5a0d8 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,16 +1,18 @@
# Generated by mksrcinfo v8
-# Sun Sep 11 16:55:49 UTC 2016
+# Mon Apr 2 12:09:32 UTC 2018
pkgbase = lib32-enca
pkgdesc = Charset analyser and converter (32 bit)
pkgver = 1.19
- pkgrel = 1
+ pkgrel = 2
url = http://cihar.com/software/enca/
arch = x86_64
license = GPL
depends = recode
depends = enca
source = http://dl.cihar.com/enca/enca-1.19.tar.xz
+ source = enca-bad-file-descriptor.patch
md5sums = a7a0c152658e012db701a48ae8b79525
+ md5sums = d4e204209bccffea4dcc1aec62d4cadf
pkgname = lib32-enca
diff --git a/PKGBUILD b/PKGBUILD
index 2405f097934..66b0ffe7786 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,14 +4,21 @@
_pkgname=enca
pkgname=lib32-${_pkgname}
pkgver=1.19
-pkgrel=1
+pkgrel=2
pkgdesc="Charset analyser and converter (32 bit)"
arch=('x86_64')
url="http://cihar.com/software/enca/"
license=('GPL')
depends=('recode' "${_pkgname}")
-source=("http://dl.cihar.com/${_pkgname}/${_pkgname}-${pkgver}.tar.xz")
-md5sums=('a7a0c152658e012db701a48ae8b79525')
+source=("http://dl.cihar.com/${_pkgname}/${_pkgname}-${pkgver}.tar.xz"
+ 'enca-bad-file-descriptor.patch')
+md5sums=('a7a0c152658e012db701a48ae8b79525'
+ 'd4e204209bccffea4dcc1aec62d4cadf')
+
+prepare() {
+cd ${_pkgname}-$pkgver
+patch -p1 -i ../enca-bad-file-descriptor.patch # https://github.com/nijel/enca/issues/28
+}
build() {
export CC='gcc -m32'
diff --git a/enca-bad-file-descriptor.patch b/enca-bad-file-descriptor.patch
new file mode 100644
index 00000000000..2f6ad911bed
--- /dev/null
+++ b/enca-bad-file-descriptor.patch
@@ -0,0 +1,35 @@
+--- a/src/convert_recode.c
++++ b/src/convert_recode.c
+@@ -101,7 +101,8 @@ convert_recode(File *file,
+ return ERR_IOFAIL;
+ file->buffer->pos = 0;
+
+- if ((tempfile = file_temporary(file->buffer, 1)) == NULL
++ /* We do not unlink tempfile, because we want to reopen it later */
++ if ((tempfile = file_temporary(file->buffer, 0)) == NULL
+ || file_seek(file, 0, SEEK_SET) != 0) {
+ file_free(tempfile);
+ return ERR_IOFAIL;
+@@ -112,9 +113,20 @@ convert_recode(File *file,
+ task->fail_level = enca_recode_fail_level;
+ task->abort_level = RECODE_SYSTEM_ERROR;
+ task->input.name = NULL;
+- task->input.file = file->stream;
+ task->output.name = NULL;
+- task->output.file = tempfile->stream;
++ /* recode_perform_task closes given streams, so we need to duplicate them */
++ task->input.file = fopen(file->name, "rb");
++ if (task->input.file == NULL) {
++ fprintf(stderr, "failed to reopen `%s'\n", file->name);
++ file_free(tempfile);
++ return ERR_IOFAIL;
++ }
++ task->output.file = fopen(tempfile->name, "wb");
++ if (task->input.file == NULL) {
++ fprintf(stderr, "failed to reopen `%s'\n", tempfile->name);
++ file_free(tempfile);
++ return ERR_IOFAIL;
++ }
+
+ /* Now run conversion original -> temporary file. */
+ success = recode_perform_task(task);