Add upstream patch to fix symlinks on recent kernels (RHBZ#1770304).
This commit is contained in:
parent
7a88a12661
commit
ad7511ce31
58
0001-ext2-Build-symbolic-links-correctly-RHBZ-1770304.patch
Normal file
58
0001-ext2-Build-symbolic-links-correctly-RHBZ-1770304.patch
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
From 487e8c964078f823646d3b0584745ab7d0ef99ca Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||||
|
Date: Tue, 26 Nov 2019 09:01:21 +0000
|
||||||
|
Subject: [PATCH] ext2: Build symbolic links correctly (RHBZ#1770304).
|
||||||
|
|
||||||
|
We created symlinks in two steps, by creating the empty inode and then
|
||||||
|
calling ext2fs_symlink to populate it. This created broken symlinks
|
||||||
|
where the directory name contained a / character, eg:
|
||||||
|
|
||||||
|
lrwxrwxrwx 1 root root 7 Nov 26 08:43 /bin -> usr/bin
|
||||||
|
lrwxrwxrwx 1 root root 7 Nov 26 08:43 /lib -> usr/lib
|
||||||
|
lrwxrwxrwx 1 root root 9 Nov 26 08:43 /lib64 -> usr/lib64
|
||||||
|
lrwxrwxrwx 1 root root 8 Nov 26 08:43 /sbin -> usr/sbin
|
||||||
|
lrwxrwxrwx 1 root root 7 Nov 26 08:38 bin -> usr/bin
|
||||||
|
|
||||||
|
This breaks with Linux >= 5.3.8, most likely because of extra
|
||||||
|
validation now being done at the VFS layer:
|
||||||
|
|
||||||
|
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/fs/readdir.c?id=8a23eb804ca4f2be909e372cf5a9e7b30ae476cd
|
||||||
|
|
||||||
|
It's unnecessary to create the empty inode since ext2fs_symlink can
|
||||||
|
create the inode for us perfectly fine if we simply pass ino == 0, and
|
||||||
|
it creates them correctly too.
|
||||||
|
|
||||||
|
Thanks: Toolybird for identifying the problem and kernel patch.
|
||||||
|
---
|
||||||
|
src/ext2fs-c.c | 8 +-------
|
||||||
|
1 file changed, 1 insertion(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/ext2fs-c.c b/src/ext2fs-c.c
|
||||||
|
index e8ab972..8903f74 100644
|
||||||
|
--- a/src/ext2fs-c.c
|
||||||
|
+++ b/src/ext2fs-c.c
|
||||||
|
@@ -782,12 +782,6 @@ ext2_copy_file (struct ext2_data *data, const char *src, const char *dest)
|
||||||
|
}
|
||||||
|
/* Create a symlink. */
|
||||||
|
else if (S_ISLNK (statbuf.st_mode)) {
|
||||||
|
- ext2_ino_t ino;
|
||||||
|
- ext2_empty_inode (data->fs, dir_ino, dirname, basename,
|
||||||
|
- statbuf.st_mode, statbuf.st_uid, statbuf.st_gid,
|
||||||
|
- statbuf.st_ctime, statbuf.st_atime, statbuf.st_mtime,
|
||||||
|
- 0, 0, EXT2_FT_SYMLINK, &ino);
|
||||||
|
-
|
||||||
|
char *buf = malloc (statbuf.st_size+1);
|
||||||
|
if (buf == NULL)
|
||||||
|
caml_raise_out_of_memory ();
|
||||||
|
@@ -797,7 +791,7 @@ ext2_copy_file (struct ext2_data *data, const char *src, const char *dest)
|
||||||
|
if (r > statbuf.st_size)
|
||||||
|
r = statbuf.st_size;
|
||||||
|
buf[r] = '\0';
|
||||||
|
- ext2fs_symlink (data->fs, dir_ino, ino, dest, buf);
|
||||||
|
+ ext2fs_symlink (data->fs, dir_ino, 0, basename, buf);
|
||||||
|
free (buf);
|
||||||
|
}
|
||||||
|
/* Create directory. */
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
@ -26,7 +26,7 @@
|
|||||||
Summary: Tool for creating supermin appliances
|
Summary: Tool for creating supermin appliances
|
||||||
Name: supermin
|
Name: supermin
|
||||||
Version: 5.1.20
|
Version: 5.1.20
|
||||||
Release: 9%{?dist}
|
Release: 10%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
|
|
||||||
%if 0%{?rhel} >= 7
|
%if 0%{?rhel} >= 7
|
||||||
@ -51,6 +51,10 @@ Source2: libguestfs.keyring
|
|||||||
Patch1: 0001-rpm-extend-the-Multiple_matches-exception.patch
|
Patch1: 0001-rpm-extend-the-Multiple_matches-exception.patch
|
||||||
Patch2: 0002-Print-Librpm.Multiple_matches-exceptions.patch
|
Patch2: 0002-Print-Librpm.Multiple_matches-exceptions.patch
|
||||||
|
|
||||||
|
# Upstream patch to fix symlinks.
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1770304
|
||||||
|
Patch3: 0001-ext2-Build-symbolic-links-correctly-RHBZ-1770304.patch
|
||||||
|
|
||||||
BuildRequires: /usr/bin/pod2man
|
BuildRequires: /usr/bin/pod2man
|
||||||
BuildRequires: /usr/bin/pod2html
|
BuildRequires: /usr/bin/pod2html
|
||||||
BuildRequires: rpm
|
BuildRequires: rpm
|
||||||
@ -171,6 +175,9 @@ make check || {
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Nov 28 2019 Richard W.M. Jones <rjones@redhat.com> - 5.1.20-10
|
||||||
|
- Add upstream patch to fix symlinks on recent kernels (RHBZ#1770304).
|
||||||
|
|
||||||
* Wed Nov 27 2019 Richard W.M. Jones <rjones@redhat.com> - 5.1.20-9
|
* Wed Nov 27 2019 Richard W.M. Jones <rjones@redhat.com> - 5.1.20-9
|
||||||
- Use gpgverify macro instead of explicit gpgv2 command.
|
- Use gpgverify macro instead of explicit gpgv2 command.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user