Fix bogus "unclosed %if" error when %include is used in conditionals
- All rpm versions log a bogus "unclosed %if" error when %include is used inside %if-%endif (and rpm >= 4.10 actually aborts the parse): the check for unclosed if occurs before checking whether there's more to come. - Move the error check into readLine() EOF path along with the other similar check to fix, and to consolidate the error handling to a single spot.
This commit is contained in:
parent
4e221afaa2
commit
e06177ee65
|
@ -259,14 +259,7 @@ retry:
|
|||
/* Make sure we have something in the read buffer */
|
||||
if (!(ofi->readPtr && *(ofi->readPtr))) {
|
||||
if (!fgets(ofi->readBuf, BUFSIZ, ofi->fp)) {
|
||||
/* EOF */
|
||||
if (spec->readStack->next) {
|
||||
rpmlog(RPMLOG_ERR, _("line %d: Unclosed %%if\n"),
|
||||
spec->readStack->lineNum);
|
||||
return PART_ERROR;
|
||||
}
|
||||
|
||||
/* remove this file from the stack */
|
||||
/* EOF, remove this file from the stack */
|
||||
ofi = popOFI(spec);
|
||||
|
||||
/* only on last file do we signal EOF to caller */
|
||||
|
@ -311,7 +304,11 @@ int readLine(rpmSpec spec, int strip)
|
|||
if (!restoreFirstChar(spec)) {
|
||||
retry:
|
||||
if ((rc = readLineFromOFI(spec, ofi)) != 0) {
|
||||
if (startLine > 0) {
|
||||
if (spec->readStack->next) {
|
||||
rpmlog(RPMLOG_ERR, _("line %d: Unclosed %%if\n"),
|
||||
spec->readStack->lineNum);
|
||||
rc = PART_ERROR;
|
||||
} else if (startLine > 0) {
|
||||
rpmlog(RPMLOG_ERR,
|
||||
_("line %d: unclosed macro or bad line continuation\n"),
|
||||
startLine);
|
||||
|
|
Loading…
Reference in New Issue