Merge branch 'master' into f15

* master: (3 commits)
  - fix crash if prep or changelog section in spec is empty (#706959) - fix crash on macro which undefines itself - fix script dependency generation with file 5.07 string changes (#712251)
  ...
This commit is contained in:
Panu Matilainen 2011-06-10 12:51:02 +03:00
commit 59df4acec7
7 changed files with 336 additions and 2 deletions

View File

@ -0,0 +1,130 @@
--- rpm-4.9.0/tools/debugedit.c 2010-12-03 13:11:57.000000000 +0100
+++ rpm-4.9.0/tools/debugedit.c.jj 2011-05-25 18:49:53.151936963 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2005, 2007, 2009, 2010 Red Hat, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2005, 2007, 2009, 2010, 2011 Red Hat, Inc.
Written by Alexander Larsson <alexl@redhat.com>, 2002
Based on code by Jakub Jelinek <jakub@redhat.com>, 2001.
@@ -44,6 +44,10 @@
#include "tools/hashtab.h"
#define DW_TAG_partial_unit 0x3c
+#define DW_FORM_sec_offset 0x17
+#define DW_FORM_exprloc 0x18
+#define DW_FORM_flag_present 0x19
+#define DW_FORM_ref_sig8 0x20
char *base_dir = NULL;
char *dest_dir = NULL;
@@ -220,6 +224,7 @@ static struct
#define DEBUG_STR 8
#define DEBUG_FRAME 9
#define DEBUG_RANGES 10
+#define DEBUG_TYPES 11
{ ".debug_info", NULL, NULL, 0, 0, 0 },
{ ".debug_abbrev", NULL, NULL, 0, 0, 0 },
{ ".debug_line", NULL, NULL, 0, 0, 0 },
@@ -231,6 +236,7 @@ static struct
{ ".debug_str", NULL, NULL, 0, 0, 0 },
{ ".debug_frame", NULL, NULL, 0, 0, 0 },
{ ".debug_ranges", NULL, NULL, 0, 0, 0 },
+ { ".debug_types", NULL, NULL, 0, 0, 0 },
{ NULL, NULL, NULL, 0, 0, 0 }
};
@@ -323,7 +329,8 @@ no_memory:
goto no_memory;
}
form = read_uleb128 (ptr);
- if (form == 2 || form > DW_FORM_indirect)
+ if (form == 2
+ || (form > DW_FORM_flag_present && form != DW_FORM_ref_sig8))
{
error (0, 0, "%s: Unknown DWARF DW_FORM_%d", dso->filename, form);
htab_delete (h);
@@ -352,7 +359,6 @@ static char *
canonicalize_path (const char *s, char *d)
{
char *rv = d;
- const char *sroot;
char *droot;
if (IS_DIR_SEPARATOR (*s))
@@ -368,7 +374,6 @@ canonicalize_path (const char *s, char *
s++;
}
droot = d;
- sroot = s;
while (*s)
{
@@ -495,7 +500,7 @@ edit_dwarf2_line (DSO *dso, uint32_t off
}
value = read_16 (ptr);
- if (value != 2 && value != 3)
+ if (value != 2 && value != 3 && value != 4)
{
error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
value);
@@ -511,8 +516,8 @@ edit_dwarf2_line (DSO *dso, uint32_t off
return 1;
}
- opcode_base = ptr[4];
- ptr = dir = ptr + 4 + opcode_base;
+ opcode_base = ptr[4 + (value >= 4)];
+ ptr = dir = ptr + 4 + (value >= 4) + opcode_base;
/* dir table: */
value = 1;
@@ -739,7 +744,8 @@ edit_attributes (DSO *dso, unsigned char
{
if (t->attr[i].attr == DW_AT_stmt_list)
{
- if (form == DW_FORM_data4)
+ if (form == DW_FORM_data4
+ || form == DW_FORM_sec_offset)
{
list_offs = do_read_32_relocated (ptr);
found_list_offs = 1;
@@ -841,6 +847,8 @@ edit_attributes (DSO *dso, unsigned char
else
ptr += 4;
break;
+ case DW_FORM_flag_present:
+ break;
case DW_FORM_addr:
ptr += ptr_size;
break;
@@ -855,10 +863,12 @@ edit_attributes (DSO *dso, unsigned char
break;
case DW_FORM_ref4:
case DW_FORM_data4:
+ case DW_FORM_sec_offset:
ptr += 4;
break;
case DW_FORM_ref8:
case DW_FORM_data8:
+ case DW_FORM_ref_sig8:
ptr += 8;
break;
case DW_FORM_sdata:
@@ -887,6 +897,7 @@ edit_attributes (DSO *dso, unsigned char
form = DW_FORM_block1;
break;
case DW_FORM_block:
+ case DW_FORM_exprloc:
len = read_uleb128 (ptr);
form = DW_FORM_block1;
assert (len < UINT_MAX);
@@ -1190,7 +1201,7 @@ edit_dwarf2 (DSO *dso)
}
cu_version = read_16 (ptr);
- if (cu_version != 2 && cu_version != 3)
+ if (cu_version != 2 && cu_version != 3 && cu_version != 4)
{
error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
cu_version);

View File

@ -0,0 +1,55 @@
--- rpm-4.9.0/scripts/find-debuginfo.sh 2011-02-19 07:57:21.000000000 +0100
+++ rpm-4.9.0/scripts/find-debuginfo.sh.orig 2011-02-19 08:50:23.000000000 +0100
@@ -127,6 +127,23 @@ debug_link()
link_relative "$t" "$l" "$RPM_BUILD_ROOT"
}
+# Provide .2, .3, ... symlinks to all filename instances of this build-id.
+make_id_dup_link()
+{
+ local id="$1" file="$2" idfile
+
+ local n=1
+ while true; do
+ idfile=".build-id/${id:0:2}/${id:2}.$n"
+ [ $# -eq 3 ] && idfile="${idfile}$3"
+ if [ ! -L "$RPM_BUILD_ROOT/usr/lib/debug/$idfile" ]; then
+ break
+ fi
+ n=$[$n+1]
+ done
+ debug_link "$file" "/$idfile"
+}
+
# Make a build-id symlink for id $1 with suffix $3 to file $2.
make_id_link()
{
@@ -140,6 +157,8 @@ make_id_link()
return
fi
+ make_id_dup_link "$@"
+
[ $# -eq 3 ] && return 0
local other=$(readlink -m "$root_idfile")
@@ -188,6 +207,9 @@ while read nlinks inum f; do
if [ $nlinks -gt 1 ]; then
eval linked=\$linked_$inum
if [ -n "$linked" ]; then
+ eval id=\$linkedid_$inum
+ make_id_dup_link "$id" "$dn/$(basename $f)"
+ make_id_dup_link "$id" "/usr/lib/debug$dn/$bn" .debug
link=$debugfn
get_debugfn "$linked"
echo "hard linked $link to $debugfn"
@@ -202,6 +224,9 @@ while read nlinks inum f; do
echo "extracting debug info from $f"
id=$(/usr/lib/rpm/debugedit -b "$RPM_BUILD_DIR" -d /usr/src/debug \
-i -l "$SOURCEFILE" "$f") || exit
+ if [ $nlinks -gt 1 ]; then
+ eval linkedid_$inum=\$id
+ fi
if [ -z "$id" ]; then
echo >&2 "*** ${strict_error}: No build ID note found in $f"
$strict && exit 2

View File

@ -0,0 +1,21 @@
commit 78a6cf6fbf047c5bf0066df21792e4c9925d04a0
Author: Michael Schroeder <mls@suse.de>
Date: Tue May 24 08:51:56 2011 +0300
Do not die on empty changelog section
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
diff --git a/build/parseChangelog.c b/build/parseChangelog.c
index 36a19c3..d4681cb 100644
--- a/build/parseChangelog.c
+++ b/build/parseChangelog.c
@@ -233,7 +233,7 @@ int parseChangelog(rpmSpec spec)
}
}
- if (addChangelog(spec->packages->header, sb)) {
+ if (sb && addChangelog(spec->packages->header, sb)) {
goto exit;
}
res = nextPart;

View File

@ -0,0 +1,21 @@
commit 39800e901e2258685d1fc34e1e9a7b8a058e11ce
Author: Michael Schroeder <mls@suse.de>
Date: Mon May 16 11:57:44 2011 +0300
Fix segfault on build with empty %prep section
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
diff --git a/build/parsePrep.c b/build/parsePrep.c
index c0508ec..9e61dde 100644
--- a/build/parsePrep.c
+++ b/build/parsePrep.c
@@ -504,7 +504,7 @@ int parsePrep(rpmSpec spec)
}
}
- for (ARGV_const_t lines = saveLines; *lines; lines++) {
+ for (ARGV_const_t lines = saveLines; lines && *lines; lines++) {
res = 0;
if (rstreqn(*lines, "%setup", sizeof("%setup")-1)) {
res = doSetupMacro(spec, *lines);

View File

@ -0,0 +1,39 @@
commit db4905f51eb80b55c408e3a659bab6b4ec5d9e3b
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Fri Jun 10 12:08:45 2011 +0300
Adjust script detection rules to work with file >= 5.07 too (RhBug:712251)
- Somewhere between file 5.05 and 5.07 it started adding encoding
to script descriptions, eg "<mumble> script text executable" became
"<mumble> script, <encoding> text executable" breaking what had
been working for 10+ years in the case of old find-requires.
- Permit either comma or space after "script", this works for both
old and new file.
diff --git a/autodeps/linux.req b/autodeps/linux.req
index cf60bd9..b9a8f99 100644
--- a/autodeps/linux.req
+++ b/autodeps/linux.req
@@ -20,10 +20,11 @@ fi
# --- Grab the file manifest and classify files.
#filelist=`sed "s/['\"]/\\\&/g"`
filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"`
-exelist=`echo $filelist | xargs -r file | grep -Ev ":.* (commands|script) " | \
+exelist=`echo $filelist | xargs -r file | \
+ grep -Ev ":.* (commands|script)[, ]" | \
grep ":.*executable" | cut -d: -f1`
scriptlist=`echo $filelist | xargs -r file | \
- grep -E ":.* (commands|script) " | cut -d: -f1`
+ grep -E ":.* (commands|script)[, ]" | cut -d: -f1`
liblist=`echo $filelist | xargs -r file | \
grep ":.*shared object" | cut -d : -f1`
diff --git a/fileattrs/script.attr b/fileattrs/script.attr
index 13b8ba0..79f4d73 100644
--- a/fileattrs/script.attr
+++ b/fileattrs/script.attr
@@ -1,3 +1,3 @@
%__script_requires %{_rpmconfigdir}/script.req
-%__script_magic ^.* script text.*$
+%__script_magic ^.* script[, ].*$
%__script_flags exeonly

View File

@ -0,0 +1,35 @@
commit f4c79584d01c6394544c86c122d2f32f77a1d02d
Author: Michael Schroeder <mls@suse.de>
Date: Wed May 18 09:04:40 2011 +0300
Always copy macro source when expanding it
- A macro can undefine itself, and unless we grab a copy of it we'll
end up accessing already freed memory. Fixes a regression from
commit ebc4ceaaeb8bb59019f4635471b28eb5f3eaaaa6 which assumed
a copy is not always needed.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
diff --git a/rpmio/macro.c b/rpmio/macro.c
index 8ea4819..d79ef18 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -1022,12 +1022,12 @@ expandMacro(MacroBuf mb, const char *src, size_t slen)
char *source = NULL;
/* Handle non-terminated substrings by creating a terminated copy */
- if (slen > 0) {
- source = xmalloc(slen + 1);
- strncpy(source, src, slen);
- source[slen] = '\0';
- s = source;
- }
+ if (!slen)
+ slen = strlen(src);
+ source = xmalloc(slen + 1);
+ strncpy(source, src, slen);
+ source[slen] = '\0';
+ s = source;
if (mb->buf == NULL) {
size_t blen = MACROBUFSIZ + strlen(s);

View File

@ -21,10 +21,10 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: %{?snapver:0.%{snapver}.}6%{?dist}
Release: %{?snapver:0.%{snapver}.}9%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/rpm-4.8.x/%{name}-%{srcver}.tar.bz2
Source0: http://rpm.org/releases/rpm-4.9.x/%{name}-%{srcver}.tar.bz2
%if %{with int_bdb}
Source1: db-%{bdbver}.tar.gz
%endif
@ -54,10 +54,21 @@ Patch104: rpm-4.9.0-fstate-verify.patch
Patch105: rpm-4.9.0-fstate-deps.patch
# Preferred color pkgs should be erased last
Patch106: rpm-4.9.0-prefcolor-erase.patch
# Fix crash on empty prep-section
Patch107: rpm-4.9.0-empty-prep-crash.patch
# Fix crash on empty changelog-section
Patch108: rpm-4.9.0-empty-changelog-crash.patch
# Fix crash on macro undefining itself
Patch109: rpm-4.9.0-macro-self-undefine.patch
# Fix breakage caused by file 5.07 string changes
Patch110: rpm-4.9.0-file-compat.patch
# These are not yet upstream
Patch301: rpm-4.6.0-niagara.patch
Patch302: rpm-4.7.1-geode-i686.patch
# To be upstreamed after rawhide-testdrive (#641377, #707677)
Patch303: rpm-4.9.0-debugedit-dwarf4.patch
Patch304: rpm-4.9.0-debuginfo-allnames.patch
# Partially GPL/LGPL dual-licensed and some bits with BSD
# SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD
@ -227,9 +238,15 @@ packages on a system.
%patch104 -p1 -b .fstate-verify
%patch105 -p1 -b .fstate-deps
%patch106 -p1 -b .prefcolor-erase
%patch107 -p1 -b .empty-prep-crash
%patch108 -p1 -b .empty-changelog-crash
%patch109 -p1 -b .macro-self-undefine
%patch110 -p1 -b .file-compat
%patch301 -p1 -b .niagara
%patch302 -p1 -b .geode
%patch303 -p1 -b .dwarf-4
%patch304 -p1 -b .debuginfo-allnames
%if %{with int_bdb}
ln -s db-%{bdbver} db
@ -321,6 +338,9 @@ make check
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%post build-libs -p /sbin/ldconfig
%postun build-libs -p /sbin/ldconfig
%posttrans
# XXX this is klunky and ugly, rpm itself should handle this
dbstat=/usr/lib/rpm/rpmdb_stat
@ -440,6 +460,19 @@ exit 0
%doc COPYING doc/librpm/html/*
%changelog
* Fri Jun 10 2011 Panu Matilainen <pmatilai@redhat.com> - 4.9.0-9
- fix crash if prep or changelog section in spec is empty (#706959)
- fix crash on macro which undefines itself
- fix script dependency generation with file 5.07 string changes (#712251)
* Thu May 26 2011 Panu Matilainen <pmatilai@redhat.com> - 4.9.0-8
- add dwarf-4 support to debugedit (#707677)
- generate build-id symlinks for all filenames sharing a build-id (#641377)
* Thu Apr 07 2011 Panu Matilainen <pmatilai@redhat.com> - 4.9.0-7
- add missing ldconfig calls to build-libs sub-package
- fix source url
* Thu Apr 07 2011 Panu Matilainen <pmatilai@redhat.com> - 4.9.0-6
- revert the spec query change (#693338) for now, it breaks fedpkg