- fix segfault in devel symlink dependency generation from Mark Salter

(#338971)
- fix debugedit build with gcc 4.3
- drop popt-static build dependency
This commit is contained in:
Panu Matilainen 2008-01-04 07:19:06 +00:00
parent 77f9b1ed06
commit 9c33f48d08
3 changed files with 183 additions and 4 deletions

View File

@ -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 }
};

42
rpm-4.4.2.2-gcc43.patch Normal file
View File

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

View File

@ -6,14 +6,14 @@
Summary: The RPM package management system Summary: The RPM package management system
Name: rpm Name: rpm
Version: 4.4.2.2 Version: 4.4.2.2
Release: 11%{?dist} Release: 12%{?dist}
Group: System Environment/Base Group: System Environment/Base
Url: http://www.rpm.org/ Url: http://www.rpm.org/
Source: http://rpm.org/releases/rpm-4.4.x/%{name}-%{version}.tar.gz Source: http://rpm.org/releases/rpm-4.4.x/%{name}-%{version}.tar.gz
Patch1: rpm-4.4.1-prereq.patch Patch1: rpm-4.4.1-prereq.patch
Patch2: rpm-4.4.2-ghost-conflicts.patch Patch2: rpm-4.4.2-ghost-conflicts.patch
Patch3: rpm-4.4.2-trust.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 Patch5: rpm-4.4.2-rpmfc-skip.patch
Patch6: rpm-4.4.2.2-matchpathcon.patch Patch6: rpm-4.4.2.2-matchpathcon.patch
Patch7: rpm-4.4.2.1-no-popt.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 Patch13: rpm-4.4.2.2-nss.patch
Patch14: rpm-4.4.2.2-base64-unsigned-char.patch Patch14: rpm-4.4.2.2-base64-unsigned-char.patch
Patch15: rpm-4.4.2.2-cryptoinit.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 # XXX Beware, this is one murky license, partially GPL/LGPL dual-licensed
# and several different components with their own licenses included... # and several different components with their own licenses included...
@ -50,9 +51,9 @@ BuildRequires: elfutils-devel >= 0.112
BuildRequires: elfutils-libelf-devel-static BuildRequires: elfutils-libelf-devel-static
BuildRequires: readline-devel zlib-devel BuildRequires: readline-devel zlib-devel
BuildRequires: nss-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 # necessarily accurate
BuildRequires: popt-devel >= 1.10.2, popt-static >= 1.10.2 BuildRequires: popt-devel >= 1.10.2
BuildRequires: sqlite-devel BuildRequires: sqlite-devel
BuildRequires: gettext-devel BuildRequires: gettext-devel
BuildRequires: libselinux-devel BuildRequires: libselinux-devel
@ -155,6 +156,7 @@ that will manipulate RPM packages and databases.
%patch13 -p1 -b .nss %patch13 -p1 -b .nss
%patch14 -p1 -b .base64 %patch14 -p1 -b .base64
%patch15 -p1 -b .nss-init %patch15 -p1 -b .nss-init
%patch16 -p1 -b .gcc43
# force external popt # force external popt
rm -rf popt/ rm -rf popt/
@ -417,6 +419,11 @@ exit 0
%endif %endif
%changelog %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 * Thu Nov 15 2007 Panu Matilainen <pmatilai@redhat.com> 4.4.2.2-11
- Unbreak debugedit (missing crypto initialization) - Unbreak debugedit (missing crypto initialization)