create temporary edit files at symlink target location (RHEL-85754)
Resolves: RHEL-85754
This commit is contained in:
parent
ad141a6b4d
commit
20a44e85b3
38
libuser-0.64-editlocation.patch
Normal file
38
libuser-0.64-editlocation.patch
Normal 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)
|
@ -1,6 +1,6 @@
|
||||
Name: libuser
|
||||
Version: 0.63
|
||||
Release: 16%{?dist}
|
||||
Release: 17%{?dist}
|
||||
License: LGPLv2+
|
||||
URL: https://pagure.io/libuser
|
||||
Source: http://releases.pagure.org/libuser/libuser-%{version}.tar.xz
|
||||
@ -13,6 +13,9 @@ Patch5: 0005-translation-update.patch
|
||||
# allow 32char username as other tools, sent upstream, for <= 0.64, RHEL-55983
|
||||
Patch6: libuser-0.63-32ch_username.patch
|
||||
|
||||
# fix symlink being on different mount point than target, sent upstream, for <= 0.64, RHEL-85754
|
||||
Patch7: libuser-0.64-editlocation.patch
|
||||
|
||||
BuildRequires: glib2-devel
|
||||
BuildRequires: linuxdoc-tools
|
||||
BuildRequires: pam-devel
|
||||
@ -126,6 +129,9 @@ make
|
||||
%{_datadir}/gtk-doc/html/*
|
||||
|
||||
%changelog
|
||||
* Wed Apr 02 2025 Michal Hlavinka <mhlavink@redhat.com> - 0.63-17
|
||||
- create temporary edit files at symlink target location (RHEL-85754)
|
||||
|
||||
* Wed Nov 06 2024 Michal Hlavinka <mhlavink@redhat.com> - 0.63-16
|
||||
- allow 32 char usernames (#RHEL-55983)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user