import UBI libuser-0.64-11.el10

This commit is contained in:
eabdullin 2025-11-11 22:02:40 +00:00
parent 4ced09ef87
commit 56b0a3ed9b
2 changed files with 46 additions and 2 deletions

View File

@ -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)

View File

@ -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 <mhlavink@redhat.com> - 0.64-11
- create temporary edit files at symlink target location (RHEL-85247)
* Wed Nov 06 2024 Michal Hlavinka <mhlavink@redhat.com> - 0.64-10
- rebuild, fix FTBFS (#RHEL-65455)