From 56b0a3ed9b67855e5d55f0377b9268f04b601a25 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Tue, 11 Nov 2025 22:02:40 +0000 Subject: [PATCH] import UBI libuser-0.64-11.el10 --- libuser-0.64-editlocation.patch | 38 +++++++++++++++++++++++++++++++++ libuser.spec | 10 +++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 libuser-0.64-editlocation.patch diff --git a/libuser-0.64-editlocation.patch b/libuser-0.64-editlocation.patch new file mode 100644 index 0000000..d48f18f --- /dev/null +++ b/libuser-0.64-editlocation.patch @@ -0,0 +1,38 @@ +diff --git a/modules/files.c b/modules/files.c +index 109f4af..c3fef5b 100644 +--- a/modules/files.c ++++ b/modules/files.c +@@ -360,6 +360,8 @@ editing_open(struct lu_module *module, const char *file_suffix, + struct lu_error **error) + { + struct editing *e; ++ struct stat st; ++ char *tmp; + char *backup_name; + int fd; + +@@ -391,7 +393,23 @@ editing_open(struct lu_module *module, const char *file_suffix, + goto err_fscreate; + close(fd); + +- e->new_filename = g_strconcat(e->filename, "+", NULL); ++ /* If file is a symlink, create new file at target location, ++ * otherwise later rename() could fail, because symlink and target ++ * can be at different directories which could mean different mount ++ * points. This is especially true for containers and ostree */ ++ if (lstat(e->filename, &st) == 0 && S_ISLNK(st.st_mode)) { ++ tmp = realpath(e->filename, NULL); ++ if (tmp == NULL) { ++ lu_error_new(error, lu_error_generic, ++ _("Error resolving `%s': %s"), e->filename, ++ strerror(errno)); ++ goto err_fscreate; ++ } ++ e->new_filename = g_strconcat(tmp, "+", NULL); ++ free(tmp); ++ } else { ++ e->new_filename = g_strconcat(e->filename, "+", NULL); ++ } + e->new_fd = open_and_copy_file(e->filename, e->new_filename, TRUE, + error); + if (e->new_fd == -1) diff --git a/libuser.spec b/libuser.spec index bc96b37..1be2707 100644 --- a/libuser.spec +++ b/libuser.spec @@ -1,9 +1,11 @@ Name: libuser Version: 0.64 -Release: 10%{?dist} +Release: 11%{?dist} License: LGPL-2.0-or-later URL: https://pagure.io/libuser Source: libuser-%{version}.tar.gz +# sent upstream, for <= 0.64, RHEL-85247 +Patch1: libuser-0.64-editlocation.patch BuildRequires: glib2-devel BuildRequires: linuxdoc-tools BuildRequires: pam-devel @@ -59,7 +61,8 @@ the libuser library, which provides a Python 3 API for manipulating and administering user and group accounts. %prep -%autosetup -p 1 +%autosetup -N +%patch -P 1 -p 1 -b .editlocation %build ./autogen.sh @@ -115,6 +118,9 @@ export PYTHONPATH %{_datadir}/gtk-doc/html/* %changelog +* Wed Apr 02 2025 Michal Hlavinka - 0.64-11 +- create temporary edit files at symlink target location (RHEL-85247) + * Wed Nov 06 2024 Michal Hlavinka - 0.64-10 - rebuild, fix FTBFS (#RHEL-65455)