diff -p -up rpm-4.4.2.3/build/parseSpec.c.pix rpm-4.4.2.3/build/parseSpec.c --- rpm-4.4.2.3/build/parseSpec.c.pix 2008-05-27 11:12:45.000000000 +0200 +++ rpm-4.4.2.3/build/parseSpec.c 2008-05-28 13:26:08.000000000 +0200 @@ -136,6 +136,24 @@ static void forceIncludeFile(Spec spec, spec->fileStack = ofi; } +static int begins_with(const char *s, const char *prefix) +{ + return strncmp(s, prefix, strlen(prefix)) == 0; +} + +static int isCommentedDefine(const char *line) +{ + const char *p = line; + + SKIPSPACE(p); + if (*p++ == '#') { + SKIPSPACE(p); + if (begins_with(p, "%define") && + xisspace(p[strlen("%define")])) return 1; + } + return 0; +} + /** */ /*@-boundswrite@*/ @@ -158,6 +176,11 @@ static int copyNextLineFromOFI(Spec spec *to++ = '\0'; ofi->readPtr = from; + if (isCommentedDefine(spec->lbuf)) { + rpmError(RPMERR_BADSPEC, _("%s:%d: #%%define is forbidden, use #define to comment a %%define\n"), ofi->fileName, ofi->lineNum); + return RPMERR_BADSPEC; + } + /* Check if we need another line before expanding the buffer. */ for (p = spec->lbuf; *p; p++) { switch (*p) {