commit:     184cddf3f85fde7effacd6c8bc5f8f4801062163
Author:     Denis Pronin <dannftk <AT> yandex <DOT> ru>
AuthorDate: Mon Oct 23 14:44:31 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec 14 08:14:21 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=184cddf3

app-arch/rpm: fix building RPM package with clang

Signed-off-by: Denis Pronin <dannftk <AT> yandex.ru>
Closes: https://github.com/gentoo/gentoo/pull/33471
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-arch/rpm/files/rpm-4.8.1-clang.patch | 52 ++++++++++++++++++++++++++++++++
 app-arch/rpm/rpm-4.18.1.ebuild           |  1 +
 2 files changed, 53 insertions(+)

diff --git a/app-arch/rpm/files/rpm-4.8.1-clang.patch 
b/app-arch/rpm/files/rpm-4.8.1-clang.patch
new file mode 100644
index 000000000000..714fbc09b534
--- /dev/null
+++ b/app-arch/rpm/files/rpm-4.8.1-clang.patch
@@ -0,0 +1,52 @@
+https://github.com/rpm-software-management/rpm/commit/6ad8a71407b173b6c50d389f01edd8a4aecd6807
+--- a/lib/fsm.c
++++ b/lib/fsm.c
+@@ -1015,27 +1015,28 @@
+             }
+ 
+ setmeta:
+-          /* Special files require path-based ops */
+-          int mayopen = S_ISREG(fp->sb.st_mode) || S_ISDIR(fp->sb.st_mode);
+-          if (!rc && fd == -1 && mayopen) {
+-              int flags = O_RDONLY;
+-              /* Only follow safe symlinks, and never on temporary files */
+-              if (fp->suffix)
+-                  flags |= AT_SYMLINK_NOFOLLOW;
+-              fd = fsmOpenat(di.dirfd, fp->fpath, flags,
+-                              S_ISDIR(fp->sb.st_mode));
+-              if (fd < 0)
+-                  rc = RPMERR_OPEN_FAILED;
+-          }
++              {
++                  /* Special files require path-based ops */
++                  int mayopen = S_ISREG(fp->sb.st_mode) || 
S_ISDIR(fp->sb.st_mode);
++                  if (!rc && fd == -1 && mayopen) {
++                      int flags = O_RDONLY;
++                      /* Only follow safe symlinks, and never on temporary 
files */
++                      if (fp->suffix)
++                          flags |= AT_SYMLINK_NOFOLLOW;
++                      fd = fsmOpenat(di.dirfd, fp->fpath, flags,
++                                      S_ISDIR(fp->sb.st_mode));
++                      if (fd < 0)
++                          rc = RPMERR_OPEN_FAILED;
++                  }
++              if (!rc && fp->setmeta) {
++                      rc = fsmSetmeta(fd, di.dirfd, fp->fpath,
++                              fi, plugins, fp->action,
++                              &fp->sb, nofcaps);
++              }
+ 
+-          if (!rc && fp->setmeta) {
+-              rc = fsmSetmeta(fd, di.dirfd, fp->fpath,
+-                              fi, plugins, fp->action,
+-                              &fp->sb, nofcaps);
+-          }
+-
+-          if (fd != firstlinkfile)
+-              fsmClose(&fd);
++              if (fd != firstlinkfile)
++                      fsmClose(&fd);
++              }
+       }
+ 
+       /* Notify on success. */

diff --git a/app-arch/rpm/rpm-4.18.1.ebuild b/app-arch/rpm/rpm-4.18.1.ebuild
index b05d5a57334b..27f9c7e5e81a 100644
--- a/app-arch/rpm/rpm-4.18.1.ebuild
+++ b/app-arch/rpm/rpm-4.18.1.ebuild
@@ -63,6 +63,7 @@ RDEPEND="
 
 PATCHES=(
        "${FILESDIR}"/${PN}-4.8.1-db-path.patch
+       "${FILESDIR}"/${PN}-4.8.1-clang.patch
        "${FILESDIR}"/${PN}-4.17.0-libdir.patch
 )
 

Reply via email to