[arch-commits] Commit in enca/repos (3 files)

Felix Yan felixonmars at archlinux.org
Sat May 16 10:17:00 UTC 2020


    Date: Saturday, May 16, 2020 @ 10:17:00
  Author: felixonmars
Revision: 384068

archrelease: copy trunk to staging-x86_64

Added:
  enca/repos/staging-x86_64/
  enca/repos/staging-x86_64/PKGBUILD
    (from rev 384067, enca/trunk/PKGBUILD)
  enca/repos/staging-x86_64/enca-bad-file-descriptor.patch
    (from rev 384067, enca/trunk/enca-bad-file-descriptor.patch)

--------------------------------+
 PKGBUILD                       |   37 +++++++++++++++++++++++++++++++++++++
 enca-bad-file-descriptor.patch |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+)

Copied: enca/repos/staging-x86_64/PKGBUILD (from rev 384067, enca/trunk/PKGBUILD)
===================================================================
--- staging-x86_64/PKGBUILD	                        (rev 0)
+++ staging-x86_64/PKGBUILD	2020-05-16 10:17:00 UTC (rev 384068)
@@ -0,0 +1,37 @@
+# Maintainer: Giovanni Scafora <giovanni at archlinux.org>
+# Contributor: Filip Dvorak <fila at pruda.com>
+
+pkgname=enca
+pkgver=1.19
+pkgrel=4
+pkgdesc="Charset analyser and converter"
+arch=('x86_64')
+url="https://cihar.com/software/enca/"
+license=('GPL')
+depends=('recode')
+options=('!docs')
+source=("https://dl.cihar.com/${pkgname}/${pkgname}-${pkgver}.tar.xz" enca-bad-file-descriptor.patch)
+sha256sums=('3a487eca40b41021e2e4b7a6440b97d822e6532db5464471f572ecf77295e8b8'
+            '270c7c0abaea5f3d10173b58849200d4106675d3127a0b9b8ce1fc3dcf775acb')
+
+prepare() {
+  cd $pkgname-$pkgver
+  patch -p1 -i ../enca-bad-file-descriptor.patch # https://github.com/nijel/enca/issues/28
+}
+
+build() {
+  cd ${pkgname}-${pkgver}
+
+  ./configure --prefix=/usr \
+              --libexecdir=/usr/lib \
+              --mandir=/usr/share/man \
+              --with-librecode=/usr \
+              --enable-external
+  make
+}
+
+package() {
+  cd ${pkgname}-${pkgver}
+
+  make DESTDIR="${pkgdir}" install
+}

Copied: enca/repos/staging-x86_64/enca-bad-file-descriptor.patch (from rev 384067, enca/trunk/enca-bad-file-descriptor.patch)
===================================================================
--- staging-x86_64/enca-bad-file-descriptor.patch	                        (rev 0)
+++ staging-x86_64/enca-bad-file-descriptor.patch	2020-05-16 10:17:00 UTC (rev 384068)
@@ -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);


More information about the arch-commits mailing list