diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2011-06-16 19:21:54 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2011-06-16 19:30:34 +0300 |
commit | 7e067c3ed912b95109cdbe6b03648433edfc9e0b (patch) | |
tree | 089722ab4965ab052caa8e4f892c6bdc1f50cded /build/parseSpec.c | |
parent | 01b9b4048180ce28ccfceca91a7e5682e0611846 (diff) | |
download | librpm-tizen-7e067c3ed912b95109cdbe6b03648433edfc9e0b.tar.gz librpm-tizen-7e067c3ed912b95109cdbe6b03648433edfc9e0b.tar.bz2 librpm-tizen-7e067c3ed912b95109cdbe6b03648433edfc9e0b.zip |
Error on unclosed macros & trailing line continuations in spec (RhBug:681567)
- Track the starting line in case copyNextLineFromOFI() indicates
a multiline-construct. If we get an EOF from readLineFromOFI()
while inside multiline read, its an illegal construct of some kind
and we can even spit out a reasonably meaningful error pointing
out the starting line number of the bad construct.
Diffstat (limited to 'build/parseSpec.c')
-rw-r--r-- | build/parseSpec.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/build/parseSpec.c b/build/parseSpec.c index 89f1f40eb..a1a43d9a9 100644 --- a/build/parseSpec.c +++ b/build/parseSpec.c @@ -303,16 +303,26 @@ int readLine(rpmSpec spec, int strip) struct ReadLevelEntry *rl; OFI_t *ofi = spec->fileStack; int rc; + int startLine = 0; if (!restoreFirstChar(spec)) { retry: - if ((rc = readLineFromOFI(spec, ofi)) != 0) + if ((rc = readLineFromOFI(spec, ofi)) != 0) { + if (startLine > 0) { + rpmlog(RPMLOG_ERR, + _("line %d: unclosed macro or bad line continuation\n"), + startLine); + rc = PART_ERROR; + } return rc; + } ofi = spec->fileStack; /* Copy next file line into the spec line buffer */ rc = copyNextLineFromOFI(spec, ofi); if (rc > 0) { + if (startLine == 0) + startLine = spec->lineNum; goto retry; } else if (rc < 0) { return PART_ERROR; |