* update enca to 1.19-5

This commit is contained in:
Alexander Baldeck 2023-07-05 09:10:15 +02:00
parent 55ee03b6c3
commit 30a3d25fba
2 changed files with 5 additions and 45 deletions

View File

@ -1,24 +1,19 @@
# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Giovanni Scafora <giovanni@archlinux.org>
# Maintainer:
# Contributor: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: Filip Dvorak <fila@pruda.com>
pkgname=enca
pkgver=1.19
pkgrel=4
pkgrel=5
pkgdesc="Charset analyser and converter"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
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
}
source=("https://dl.cihar.com/${pkgname}/${pkgname}-${pkgver}.tar.xz")
sha256sums=('3a487eca40b41021e2e4b7a6440b97d822e6532db5464471f572ecf77295e8b8')
build() {
cd ${pkgname}-${pkgver}

View File

@ -1,35 +0,0 @@
--- 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);