Github messages for voidlinux
 help / color / mirror / Atom feed
From: loreb <loreb@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] recutils: patch to fix recins not working outside of $TMPDIR
Date: Tue, 08 Jun 2021 14:54:48 +0200	[thread overview]
Message-ID: <20210608125448.1s6OYZuUac_yGJhfRMYbHdxMHaCMfxqLh02Ng_awIxk@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-30567@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 2213 bytes --]

There is an updated pull request by loreb against master on the void-packages repository

https://github.com/loreb/void-packages master
https://github.com/void-linux/void-packages/pull/30567

recutils: patch to fix recins not working outside of $TMPDIR
Details at https://git.savannah.gnu.org/cgit/recutils.git/commit/utils/recutl.c?id=86f662a8202408134a235572ec60141d3082f975
Will no longer be necessary once 1.9 is released; fixes bug #30546
Thanks to ericonr for all the assistance.

note to self: bootstrap.conf is not shipped
add *temporary* dependency on automake
adding gnulib pieces is a real chore...

And then the GNU tools (rightfully) decided that the manpages were out
of date, because a file has been modified, and insisted on running
help2man - I simply told pre_configure to update the timestamps of the
manpages.

<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [x] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/30567.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-30567.patch --]
[-- Type: text/x-diff, Size: 5571 bytes --]

From e002829cfd0851bd62b7a9fdef99b0de2d83f5a3 Mon Sep 17 00:00:00 2001
From: Lorenzo Beretta <vc.net.loreb@gmail.com>
Date: Wed, 28 Apr 2021 14:20:53 +0200
Subject: [PATCH] recutils: patch to fix recins not working outside of $TMPDIR

Details at https://git.savannah.gnu.org/cgit/recutils.git/commit/utils/recutl.c?id=86f662a8202408134a235572ec60141d3082f975
Will no longer be necessary once 1.9 is released; fixes bug #30546
Thanks to ericonr for all the assistance.

note to self: bootstrap.conf is not shipped
add *temporary* dependency on automake
adding gnulib pieces is a real chore...

And then the GNU tools (rightfully) decided that the manpages were out
of date, because a file has been modified, and insisted on running
help2man - I simply told pre_configure to update the timestamps of the
manpages.

---

Importing qcopy_file_preserving as described above results in a 2kloc
path, so just invoke cp(1) until 1.9 is released
---
 srcpkgs/recutils/patches/copyfile.patch | 37 +++++++++++++++++
 srcpkgs/recutils/patches/exdev.patch    | 54 +++++++++++++++++++++++++
 srcpkgs/recutils/template               | 12 +++++-
 3 files changed, 101 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/recutils/patches/copyfile.patch
 create mode 100644 srcpkgs/recutils/patches/exdev.patch

diff --git a/srcpkgs/recutils/patches/copyfile.patch b/srcpkgs/recutils/patches/copyfile.patch
new file mode 100644
index 000000000000..c00805af2c6e
--- /dev/null
+++ b/srcpkgs/recutils/patches/copyfile.patch
@@ -0,0 +1,37 @@
+--- a/utils/recutl.c
++++ b/utils/recutl.c
+@@ -58,6 +58,33 @@
+ #include <recutl.h>
+ #include "read-file.h"
+ 
++#include <sys/wait.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <unistd.h>
++
++static int qcopy_file_preserving(const char *src, const char *dst)
++{
++        int stat_loc;
++        pid_t pid = fork();
++        if (pid < 0) {
++                perror("fork");
++                return -1;
++        }
++        if (pid == 0) {
++                execl("/bin/cp", "--", src, dst, (void *)0);
++                exit(1);
++        }
++        if (pid != waitpid(pid, &stat_loc, 0)) {
++                perror("waitpid");
++                return -1;
++        }
++        if (!(WIFEXITED(stat_loc) && WEXITSTATUS(stat_loc) == 0)) {
++                return -1;
++        }
++        return 0;
++}
++
+ /*
+  * Global variables.
+  */
+
diff --git a/srcpkgs/recutils/patches/exdev.patch b/srcpkgs/recutils/patches/exdev.patch
new file mode 100644
index 000000000000..38fb43498ad0
--- /dev/null
+++ b/srcpkgs/recutils/patches/exdev.patch
@@ -0,0 +1,54 @@
+From 86f662a8202408134a235572ec60141d3082f975 Mon Sep 17 00:00:00 2001
+From: "Jose E. Marchesi" <jose.marchesi@oracle.com>
+Date: Tue, 28 Jan 2020 12:13:42 +0100
+Subject: utils: make utilitis to work with temporary files in a different
+ filesystem
+
+2020-01-28  Jose E. Marchesi  <jose.marchesi@oracle.com>
+
+	* bootstrap.conf (gnulib_modules): Import the modules copy-file
+	and remove.
+	* utils/recutl.c (recutl_write_db_to_file): Copy and remove
+	instead of rename temporary files.
+---
+ utils/recutl.c | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+(limited to 'utils/recutl.c')
+(copy-file.h commented out to use /bin/cp)
+
+diff --git a/utils/recutl.c b/utils/recutl.c
+index 9cf823d..a814fd8 100644
+--- a/utils/recutl.c
++++ b/utils/recutl.c
+@@ -58,6 +58,7 @@
+ #include <rec.h>
+ #include <recutl.h>
+ #include "read-file.h"
++/*#include "copy-file.h"*/
+ 
+ /*
+  * Global variables.
+@@ -432,12 +433,13 @@ recutl_write_db_to_file (rec_db_t db,
+ 
+   if (file_name)
+     {
+-      /* Rename the temporary file to file_name.  */
+-      if (rename (tmp_file_name, file_name) == -1)
+-        {
+-          remove (tmp_file_name);
+-          recutl_fatal (_("renaming file %s to %s\n"), tmp_file_name, file_name);
+-        }
++      /* Rename the temporary file to file_name.  We copy and remove
++         instead of renaming because the later doesn't work across
++         different mount points, and it is getting common for /tmp to
++         be mounted in its own filesystem.  */
++      if (qcopy_file_preserving (tmp_file_name, file_name) != 0)
++        recutl_fatal (_("renaming file %s to %s\n"), tmp_file_name, file_name);
++      remove (tmp_file_name);
+ 
+       /* Restore the attributes of the original file. */
+       if (stat_result != -1)
+-- 
+cgit v1.2.1
+
diff --git a/srcpkgs/recutils/template b/srcpkgs/recutils/template
index 3e71312c4e25..c8b48e356837 100644
--- a/srcpkgs/recutils/template
+++ b/srcpkgs/recutils/template
@@ -1,10 +1,11 @@
 # Template file for 'recutils'
 pkgname=recutils
 version=1.8
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-bash-headers --disable-rpath"
-hostmakedepends="pkg-config"
+# TODO remove automake in 1.9; only needed for copy-file
+hostmakedepends="automake pkg-config"
 makedepends="acl-devel libgcrypt-devel libuuid-devel libcurl-devel"
 short_desc="Utilities to deal with recfiles"
 maintainer="Orphaned <orphan@voidlinux.org>"
@@ -12,7 +13,14 @@ license="GPL-3.0-or-later"
 homepage="https://www.gnu.org/software/recutils/"
 distfiles="${GNU_SITE}/recutils/recutils-${version}.tar.gz"
 checksum=df8eae69593fdba53e264cbf4b2307dfb82120c09b6fab23e2dad51a89a5b193
+patch_args=-Np1
 
+pre_configure() {
+	# XXX horrible kludge to avoid help2man - remove in 1.9
+	touch man/*.1
+	# XXX ONLY needed for copy-file - remove in 1.9
+	aclocal && automake
+}
 librec1_package() {
 	short_desc+=" - rec1 library"
 	pkg_install() {

  parent reply	other threads:[~2021-06-08 12:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28 21:30 [PR PATCH] " loreb
2021-04-28 21:38 ` [PR REVIEW] " ericonr
2021-04-28 21:46 ` [PR PATCH] [Updated] " loreb
2021-04-28 21:48 ` [PR REVIEW] " loreb
2021-04-28 21:52 ` ericonr
2021-04-28 21:55 ` loreb
2021-04-28 21:58 ` loreb
2021-04-28 21:58 ` [PR PATCH] [Updated] " loreb
2021-05-17 13:12 ` loreb
2021-06-07 15:44 ` loreb
2021-06-08  2:29 ` ericonr
2021-06-08 12:54 ` loreb [this message]
2021-06-08 13:02 ` loreb
2021-06-08 13:21 ` [PR REVIEW] " ericonr
2021-06-08 13:21 ` ericonr
2021-06-08 13:21 ` ericonr
2021-06-08 14:33 ` [PR PATCH] [Updated] " loreb
2021-06-08 14:34 ` [PR REVIEW] " loreb
2021-06-08 14:35 ` loreb
2021-06-08 15:17 ` [PR PATCH] [Updated] " loreb
2021-06-08 15:19 ` [PR REVIEW] " loreb
2022-05-18  2:09 ` github-actions
2022-05-18 14:46 ` [PR PATCH] [Closed]: " loreb
2022-05-18 14:46 ` loreb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210608125448.1s6OYZuUac_yGJhfRMYbHdxMHaCMfxqLh02Ng_awIxk@z \
    --to=loreb@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).