main/patchutils: upgrade to 0.4.4

This commit is contained in:
Celeste 2025-09-27 05:26:11 +00:00
parent 3e0233e15e
commit ff31eabaad
2 changed files with 4 additions and 106 deletions

View File

@ -2,7 +2,7 @@
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=patchutils
pkgver=0.4.3
pkgver=0.4.4
pkgrel=0
pkgdesc="Programs for manipulating patch files"
options="!check" # 6 tests fail
@ -13,9 +13,8 @@ depends="perl"
makedepends="xmlto"
checkdepends="diffutils"
subpackages="$pkgname-bash-completion $pkgname-doc"
source="https://cyberelk.net/tim/data/patchutils/stable/patchutils-$pkgver.tar.xz
redirectfd.patch
"
#source="https://cyberelk.net/tim/data/patchutils/stable/patchutils-$pkgver.tar.xz"
source="https://github.com/twaugh/patchutils/releases/download/$pkgver/patchutils-$pkgver.tar.xz"
build() {
./configure \
@ -38,6 +37,5 @@ package() {
}
sha512sums="
cf6fcfad4d0deb993ddf3d3da9aff059ff36ee832e612e34d4b03e4dde5f2263875b7df3e02823c70ae80cfb415d1c33fcccbeb2e5f15e191e996219d4b9d062 patchutils-0.4.3.tar.xz
cb10c8ed0d3e744f21597ecea9f59da477e5e7dd1493c87c8f8a11d7b55b7573609617da56dfa5406aedb8fe244be4193978ed42360dbb683c220ec3e5e1da11 redirectfd.patch
26f3ee959d7f8d7d5718ecf361436709559c62d6235114faac9a84442e9df4fb271f85eea5d96dae3969e96d88fdd9c1a9b5246696ef548fad71a8f29a026a84 patchutils-0.4.4.tar.xz
"

View File

@ -1,100 +0,0 @@
Patch-Source: https://github.com/twaugh/patchutils/pull/96
--
From 8bde947e4f24a4a09c40caf23788a45fa93fe824 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= <holger@applied-asynchrony.com>
Date: Tue, 26 Aug 2025 19:22:04 +0200
Subject: [PATCH 1/2] Add redirectfd() to redirect stdout without reassignment
(#91)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
---
src/util.c | 24 ++++++++++++++++++++++++
src/util.h | 2 ++
2 files changed, 26 insertions(+)
diff --git a/src/util.c b/src/util.c
index a977137..4f46f3c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -116,6 +116,30 @@ FILE *xtmpfile (void)
return ret;
}
+FILE *redirectfd (FILE* fd)
+{
+ FILE *ret;
+ char *tmpfname;
+ char *tmpdir = getenv ("TMPDIR");
+ size_t tmpdirlen;
+
+ if (tmpdir == NULL) {
+ tmpdir = P_tmpdir;
+ }
+
+ tmpdirlen = strlen (tmpdir);
+ tmpfname = xmalloc (tmpdirlen + 8);
+ strcpy (tmpfname, tmpdir);
+ strcpy (tmpfname + tmpdirlen, "/XXXXXX");
+ close(mkstemp(tmpfname));
+ ret = freopen (tmpfname, "w+b", fd);
+ if (ret == NULL)
+ error (EXIT_FAILURE, errno, "freopen");
+ unlink (tmpfname);
+ free (tmpfname);
+ return ret;
+}
+
/*
* Pattern operations.
*/
diff --git a/src/util.h b/src/util.h
index a5882a4..34f372b 100644
--- a/src/util.h
+++ b/src/util.h
@@ -42,6 +42,8 @@ char *xstrndup (const char *s, const size_t n);
int xmkstemp (char *pattern);
/* safe tmpfile */
FILE *xtmpfile (void);
+/* redirect fd to temp file */
+FILE *redirectfd (FILE* fd);
FILE *xopen(const char *file, const char *mode);
FILE *xopen_seekable(const char *file, const char *mode);
From c3334f8f36cd1629c441e7e6a7d5bb9356b3012e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= <holger@applied-asynchrony.com>
Date: Tue, 26 Aug 2025 19:22:48 +0200
Subject: [PATCH 2/2] Use redirectfd() in filterdiff (#91)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
---
src/filterdiff.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/filterdiff.c b/src/filterdiff.c
index b616f71..d0a7740 100644
--- a/src/filterdiff.c
+++ b/src/filterdiff.c
@@ -1828,15 +1828,10 @@ int main (int argc, char *argv[])
if (inplace_mode) {
/* Redirect stdout to temporary file for in-place processing */
- FILE *temp_output = xtmpfile();
- FILE *old_stdout = stdout;
- stdout = temp_output;
+ FILE *temp_output = redirectfd(stdout);
filterdiff (f, argv[i]);
- /* Restore stdout */
- stdout = old_stdout;
-
/* Write temp file contents back to original file */
if (write_file_inplace(argv[i], temp_output) != 0) {
error (EXIT_FAILURE, errno, "failed to write %s", argv[i]);