allow macro undef/change while expanding the macro itself

OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=95
This commit is contained in:
Michael Schröder 2011-05-17 08:47:54 +00:00 committed by Git OBS Bridge
parent cebe6dd1a8
commit e01b67d426
3 changed files with 29 additions and 1 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue May 17 10:47:00 CEST 2011 - mls@suse.de
- allow macro undef/change while expanding the macro itself
-------------------------------------------------------------------
Mon May 16 14:45:05 CEST 2011 - mls@suse.de

View File

@ -115,10 +115,12 @@ Patch77: emptyprep.diff
Patch78: nomagiccheck.diff
Patch79: findsupplements.diff
Patch80: magic_and_path.diff
Patch81: safemacro.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#
# avoid bootstrapping problem
%define _binary_payload w9.bzdio
%undefine _suse_insert_debug_package
%description
RPM Package Manager is the main tool for managing the software packages
@ -178,7 +180,7 @@ rm -f rpmdb/db.h
%patch -P 50 -P 51 -P 52 -P 53 -P 54 -P 55 -P 56 -P 57 -P 58 -P 59
%patch -P 60 -P 61 -P 62 -P 63 -P 64 -P 65 -P 66 -P 67 -P 68 -P 69
%patch -P 70 -P 71 -P 72 -P 73 -P 74 -P 75 -P 76 -P 77 -P 78 -P 79
%patch -P 80
%patch -P 80 -P 81
#chmod 755 scripts/find-supplements{,.ksyms}
#chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms
#chmod 755 scripts/firmware.prov

21
safemacro.diff Normal file
View File

@ -0,0 +1,21 @@
--- rpmio/macro.c.orig 2011-05-17 08:43:40.000000000 +0000
+++ rpmio/macro.c 2011-05-17 08:44:48.000000000 +0000
@@ -1016,12 +1016,12 @@ expandMacro(MacroBuf mb, const char *src
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);