public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpm] pmatilai-v6: - fix segfault in devel symlink dependency generation from Mark Salter
@ 2026-11-23  9:24 Panu Matilainen
  0 siblings, 0 replies; only message in thread
From: Panu Matilainen @ 2026-11-23  9:24 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/rpm
            Branch : pmatilai-v6
            Commit : 9c33f48d0842468cd10b3142198f6c3933050410
            Author : Panu Matilainen <pmatilai@fedoraproject.org>
            Date   : 2008-01-04T07:19:06+00:00
            Stats  : +183/-4 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/rpm/c/9c33f48d0842468cd10b3142198f6c3933050410?branch=pmatilai-v6

            Log:
            - fix segfault in devel symlink dependency generation from Mark Salter
    (#338971)
- fix debugedit build with gcc 4.3
- drop popt-static build dependency

---
diff --git a/rpm-4.4.2.2-devel-autodep.patch b/rpm-4.4.2.2-devel-autodep.patch
new file mode 100644
index 0000000..4b01f6c
--- /dev/null
+++ b/rpm-4.4.2.2-devel-autodep.patch
@@ -0,0 +1,130 @@
+diff -up rpm-4.4.2.2/build/rpmfc.c.develdeps rpm-4.4.2.2/build/rpmfc.c
+--- rpm-4.4.2.2/build/rpmfc.c.develdeps	2007-09-11 09:28:12.000000000 +0300
++++ rpm-4.4.2.2/build/rpmfc.c	2007-12-21 14:22:55.000000000 +0200
+@@ -497,7 +497,7 @@ static struct rpmfcTokens_s rpmfcTokens[
+   { "ASCII text",		RPMFC_WHITE|RPMFC_INCLUDE },
+   { "ISO-8859 text",		RPMFC_WHITE|RPMFC_INCLUDE },
+ 
+-  { "symbolic link to",		RPMFC_SYMLINK },
++  { "symbolic link to",		RPMFC_SYMLINK|RPMFC_INCLUDE },
+   { "socket",			RPMFC_DEVICE },
+   { "special",			RPMFC_DEVICE },
+ 
+@@ -647,6 +647,109 @@ rpmfc rpmfcNew(void)
+ }
+ 
+ /**
++ * Ensure that symlinks for shared libs generate a dep on the shared lib
++ * @param fc            file classifier
++ * @return              0 on success
++ */
++static int rpmfcSYMLINK(rpmfc fc)
++{
++    const char * fn = fc->fn[fc->ix];
++    struct stat sb;
++    int fdno;
++
++    if (stat(fn, &sb) < 0)
++	return -1;
++    if (S_ISLNK(sb.st_mode))
++        return -1;
++    
++    fdno = open(fn, O_RDONLY);
++    if (fdno < 0) {
++	return fdno;
++    }
++
++#if HAVE_GELF_H && HAVE_LIBELF
++    Elf * elf = NULL;
++    GElf_Ehdr ehdr_mem, * ehdr;
++    int isElf64;
++    int i, cnt;
++    char * soname = NULL;
++    char buf[BUFSIZ];
++    char * t;
++    rpmds ds;
++
++    (void) elf_version(EV_CURRENT);
++    elf = NULL;
++    if ((elf = elf_begin (fdno, ELF_C_READ_MMAP, NULL)) == NULL
++        || elf_kind(elf) != ELF_K_ELF
++        || (ehdr = gelf_getehdr(elf, &ehdr_mem)) == NULL
++        || ehdr->e_type != ET_DYN)
++	goto exit;
++
++    isElf64 = ehdr->e_ident[EI_CLASS] == ELFCLASS64;
++
++    for (i = 0; i < ehdr->e_phnum; ++i) {
++      GElf_Phdr phdr_mem;
++      GElf_Phdr *phdr = gelf_getphdr (elf, i, &phdr_mem);
++      GElf_Shdr shdr_mem;
++      Elf_Data * data = NULL;
++      Elf_Scn * scn = NULL;
++      GElf_Shdr *shdr = NULL;
++
++      if (phdr == NULL || phdr->p_type != PT_DYNAMIC)
++          continue;
++
++      while ((scn = elf_nextscn(elf, scn)) != NULL) {
++	  shdr = gelf_getshdr(scn, &shdr_mem);
++	  if (shdr->sh_offset == phdr->p_offset)
++		break;
++      }
++ 
++      scn = gelf_offscn(elf, phdr->p_offset);
++      shdr = gelf_getshdr(scn, &shdr_mem);
++
++      if (scn != NULL && shdr != NULL && shdr->sh_type == SHT_DYNAMIC)
++          data = elf_getdata (scn, NULL);
++      if (data == NULL)
++          continue; 
++          
++      for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) {
++          GElf_Dyn dynmem;
++          GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dynmem);
++          if (dyn == NULL)
++              break;
++          if (dyn->d_tag != DT_SONAME)
++              continue;
++
++          /* add the soname to package deps */
++          soname = elf_strptr(elf, shdr->sh_link, dyn->d_un.d_val);
++          if (soname == NULL)
++              break;
++          buf[0] = '\0';
++          t = buf;
++          t = stpcpy(t, soname);
++#if !defined(__alpha__)
++          if (isElf64)
++              t = stpcpy(t, "()(64bit)");
++#endif
++          t++;
++          /* Add to package dependencies. */
++          ds = rpmdsSingle(RPMTAG_REQUIRENAME,
++                           buf, "", RPMSENSE_FIND_REQUIRES);
++          rpmdsMerge(&fc->requires, ds);
++          rpmfcSaveArg(&fc->ddict, rpmfcFileDep(t, fc->ix, ds));
++          ds = rpmdsFree(ds);
++          break;
++      }
++    }
++exit:
++    if (elf) (void) elf_end(elf);
++    close(fdno);
++    return 0;
++#endif
++    return -1;
++}
++
++/**
+  * Extract script dependencies.
+  * @param fc		file classifier
+  * @return		0 on success
+@@ -1094,6 +1197,7 @@ static struct rpmfcApplyTbl_s rpmfcApply
+     { rpmfcSCRIPT,	(RPMFC_SCRIPT|RPMFC_PERL) },
+     { rpmfcSCRIPT,	(RPMFC_SCRIPT|RPMFC_PYTHON) },
+     { rpmfcSCRIPT,      RPMFC_MONO },
++    { rpmfcSYMLINK,     RPMFC_SYMLINK },
+     { NULL, 0 }
+ };
+ 

diff --git a/rpm-4.4.2.2-gcc43.patch b/rpm-4.4.2.2-gcc43.patch
new file mode 100644
index 0000000..ccb0649
--- /dev/null
+++ b/rpm-4.4.2.2-gcc43.patch
@@ -0,0 +1,42 @@
+diff -up rpm-4.4.2.2/tools/debugedit.c.gcc43 rpm-4.4.2.2/tools/debugedit.c
+--- rpm-4.4.2.2/tools/debugedit.c.gcc43	2008-01-04 08:57:09.000000000 +0200
++++ rpm-4.4.2.2/tools/debugedit.c	2008-01-04 08:58:40.000000000 +0200
+@@ -1353,12 +1353,6 @@ handle_build_id (DSO *dso, Elf_Data *bui
+      or Elf64 object, only that we are consistent in what bits feed the
+      hash so it comes out the same for the same file contents.  */
+   {
+-    inline void process (const void *data, size_t size);
+-    inline void process (const void *data, size_t size)
+-    {
+-      rpmDigestUpdate(ctx, data, size);
+-    }
+-
+     union
+     {
+       GElf_Ehdr ehdr;
+@@ -1387,7 +1381,7 @@ handle_build_id (DSO *dso, Elf_Data *bui
+ 	  goto bad;
+ 	if (elf64_xlatetom (&x, &x, dso->ehdr.e_ident[EI_DATA]) == NULL)
+ 	  goto bad;
+-	process (x.d_buf, x.d_size);
++	rpmDigestUpdate(ctx, x.d_buf, x.d_size);
+       }
+ 
+     x.d_type = ELF_T_SHDR;
+@@ -1399,14 +1393,14 @@ handle_build_id (DSO *dso, Elf_Data *bui
+ 	  u.shdr.sh_offset = 0;
+ 	  if (elf64_xlatetom (&x, &x, dso->ehdr.e_ident[EI_DATA]) == NULL)
+ 	    goto bad;
+-	  process (x.d_buf, x.d_size);
++	  rpmDigestUpdate(ctx, x.d_buf, x.d_size);
+ 
+ 	  if (u.shdr.sh_type != SHT_NOBITS)
+ 	    {
+ 	      Elf_Data *d = elf_rawdata (dso->scn[i], NULL);
+ 	      if (d == NULL)
+ 		goto bad;
+-	      process (d->d_buf, d->d_size);
++	      rpmDigestUpdate(ctx, x.d_buf, x.d_size);
+ 	    }
+ 	}
+   }

diff --git a/rpm.spec b/rpm.spec
index e2e9c0d..b529fa8 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -6,14 +6,14 @@
 Summary: The RPM package management system
 Name: rpm
 Version: 4.4.2.2
-Release: 11%{?dist}
+Release: 12%{?dist}
 Group: System Environment/Base
 Url: http://www.rpm.org/
 Source: http://rpm.org/releases/rpm-4.4.x/%{name}-%{version}.tar.gz
 Patch1: rpm-4.4.1-prereq.patch
 Patch2: rpm-4.4.2-ghost-conflicts.patch
 Patch3: rpm-4.4.2-trust.patch
-Patch4: rpm-4.4.2-devel-autodep.patch
+Patch4: rpm-4.4.2.2-devel-autodep.patch
 Patch5: rpm-4.4.2-rpmfc-skip.patch
 Patch6: rpm-4.4.2.2-matchpathcon.patch
 Patch7: rpm-4.4.2.1-no-popt.patch
@@ -25,6 +25,7 @@ Patch12: rpm-4.4.2.2-problem-nevra.patch
 Patch13: rpm-4.4.2.2-nss.patch
 Patch14: rpm-4.4.2.2-base64-unsigned-char.patch
 Patch15: rpm-4.4.2.2-cryptoinit.patch
+Patch16: rpm-4.4.2.2-gcc43.patch
 
 # XXX Beware, this is one murky license, partially GPL/LGPL dual-licensed
 # and several different components with their own licenses included...
@@ -50,9 +51,9 @@ BuildRequires: elfutils-devel >= 0.112
 BuildRequires: elfutils-libelf-devel-static
 BuildRequires: readline-devel zlib-devel
 BuildRequires: nss-devel
-# The popt versions here just document an older known-good version, not
+# The popt version here just document an older known-good version, not
 # necessarily accurate
-BuildRequires: popt-devel >= 1.10.2, popt-static >= 1.10.2
+BuildRequires: popt-devel >= 1.10.2 
 BuildRequires: sqlite-devel
 BuildRequires: gettext-devel
 BuildRequires: libselinux-devel
@@ -155,6 +156,7 @@ that will manipulate RPM packages and databases.
 %patch13 -p1 -b .nss
 %patch14 -p1 -b .base64
 %patch15 -p1 -b .nss-init
+%patch16 -p1 -b .gcc43
 
 # force external popt
 rm -rf popt/
@@ -417,6 +419,11 @@ exit 0
 %endif
 
 %changelog
+* Fri Jan 04 2008 Panu Matilainen <pmatilai@redhat.com> 4.4.2.2-12
+- fix segfault in devel symlink dependency generation from Mark Salter (#338971)
+- fix debugedit build with gcc 4.3
+- drop popt-static build dependency
+
 * Thu Nov 15 2007 Panu Matilainen <pmatilai@redhat.com> 4.4.2.2-11
 - Unbreak debugedit (missing crypto initialization)
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-23  9:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23  9:24 [rpms/rpm] pmatilai-v6: - fix segfault in devel symlink dependency generation from Mark Salter Panu Matilainen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox